wiki:trunk/installation/building/plugins/ldap-sync

Compiling the source code with cmake

Regular build

tar -xvjf libopensync-plugin-ldap-0.39.tar.bz2
cd libopensync-plugin-ldap-0.39
mkdir build
cd build

PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" cmake
-DCMAKE_INSTALL_PREFIX=/usr/local -DUPDATE_TYPE=svn
/home/user1/libopensync-plugin-ldap-0.39

make -s
sudo make -s install
sudo ldconfig

Debug build

tar -xvjf libopensync-plugin-ldap-0.39.tar.bz2
cd libopensync-plugin-ldap-0.39
mkdir build_debug
cd build_debug

PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" cmake
-DCMAKE_INSTALL_PREFIX=/usr/local -DUPDATE_TYPE=svn
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON
/home/user1/libopensync-plugin-ldap-0.39

make -s
sudo make -s install
sudo ldconfig

Build doxygen based documentation of the source code

cd build

make doxygen

firefox doc/html/index.html &

Tests

There is a "test" target. It is primarily intended for developers. Tests which I expect to fail are commented out in the CMakeLists.txt.

Requirements

The tests make use of external tools, most notably:

• xmllint

• xsltproc

• ldapsearch

• ldapadd

• ldapmodify

• ldapdelete

• valgrind

Also required is a running and adequately configured LDAP server. This server must be configured in a way that allows sufficient access to the user that is set in the $AUTH variable in tests/test.conf. Moreover, the “dc=example,dc=com” DN must exist in the DIT. This requires in /etc/openldap/slapd.conf at least

database bdb

suffix "dc=example,dc=com"

If you prefer a different DN, you must change

• tests/test.conf and

• tests/*.ldif

accordingly.

Moreover the configuration as laid out in src/ldap-sync must correspond with the settings of the LDAP server. If necessary change src/ldap-sync as needed (username, password, authentication method, base names etc.).

Running the tests

mkdir build_debug
cd build_debug

PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" cmake
-DCMAKE_INSTALL_PREFIX=/usr/local -DUPDATE_TYPE=svn
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON
-DRUN_LONG_TESTS=off
/home/user1/libopensync-0.39/libopensync-plugin-ldap-0.39

or:

PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" cmake
-DCMAKE_INSTALL_PREFIX=/usr/local -DUPDATE_TYPE=svn
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON
-DRUN_LONG_TESTS=on
/home/user1/libopensync-0.39/libopensync-plugin-ldap-0.39

and then:

make

make test

Tests with valgrind take quite some time: They are run only when cmake is run with "-DRUN_LONG_TESTS=on".

Display a list of tests

cd build

ctest -N

Run only one particular test

cd build

ctest -I 51,51

ctest -R remove_test_ldifs

reset; time ctest -R "^add_mod_del_contact1_and_fastsync"

And in case of any problems:

ctest -I 51,51 -V

ctest -R remove_test_ldifs -V

reset; time ctest -R "^add_mod_del_contact1_and_fastsync" -V