Next: , Previous: , Up: Invoking gnulib-tool   [Contents][Index]


3.14 Bundling the unit tests of the Gnulib modules

You can bundle the unit tests of the Gnulib modules together with your package, through the ‘--with-tests’ option. Together with ‘--with-tests’, you also specify the directory for these tests through the ‘--tests-base’ option. Of course, you need to add this directory to the SUBDIRS variable in the Makefile.am of the parent directory.

The advantage of having the unit tests bundled is that when your program has a problem on a particular platform, running the unit tests may help determine quickly if the problem is on Gnulib’s side or on your package’s side. Also, it helps verifying Gnulib’s portability, of course.

The unit tests will be compiled and run when the user runs ‘make check’. When the user runs only ‘make’, the unit tests will not be compiled.

In the SUBDIRS variable, it is useful to put the Gnulib tests directory after the directory containing the other tests, not before:

SUBDIRS = gnulib-lib src man tests gnulib-tests

This will ensure that on platforms where there are test failures in either directory, users will see and report the failures from the tests of your program.

Note: In packages which use more than one invocation of gnulib-tool in the scope of the same configure.ac, you cannot use ‘--with-tests’. You will have to use a separate configure.ac in this case.