On Wed, 2017-07-05 at 01:28 +0300, Ilias Stamatis wrote:
I'm kind of a C newbie and I'm trying to take a crack at fixing some things
on the C codebase of DS. I've got a few really entry-level questions that
I'd like to ask.
1. How can I re-compile only a single file e.g.
How about re-compiling all plugins only?
Make will automatically pick up the timestamp of the file and recompile
it, along with any objects that depend on this.
2. What do you normally use to locate/jump to function/types definitions
and declarations when you don't know what something is? C tags?
grep, lots of grep. I often use other plugins as examples.
slapi-plugin.h has a lot of references in it too. Sometimes it's a bit
of experience, trial and error etc.
Two things that will help you when building plugins is to use ASAN
(--enable-asan) because you'll quickly find any C logic errors you make
wrt out of bounds. The other is to use gdb and br on your plugin hooks
to step through what's going on, when the functions are called, in what
I think that a simple plugin to start with might be addn. I wrote this
recently, and I tried to use "best practices" when doing so.
It's also really well commented I hope.
3. Which test cases are expected to be written in C, and which in python?
Python is for functional server behaviours, IE modifying this entry has
this plugin effect triggered.
The C tests in cmocka are to test behaviours of single functions. It's
hard (today) to mock the slapi_* apis to test a whole plugin, but you
can test *parts* of a plugin with cmocka. The password tests are a great
example of this.
4. After compiling the server, git status reports a list of untracked files:
Is there a reason why all these are not added in the .gitignore?
None - feel free to add them to the .gitignore :)
Additionally, I have another question regarding the Referential Integrity
The "referint-logfile" attribute is supposed to point to the plugin's log
file. The plug-in itself in my setup seems to work just fine. However the
file /opt/dirsrv/var/log/dirsrv/slapd-localhost/referint declared in the
configuration does not exist at all. Why's that? Is it somewhere else?
Is the referint logging turned on? The file may only be created once you
enable that plugin's logging feature ...
Another aspect is not to worry too much about it - we don't really care
if the old log system works on not, because we want to replace it with
our known existing slapi_log_err interface.
Red Hat, Australia/Brisbane