Next: Avoiding unnecessary checks and compilations, Previous: Integration with Version Control Systems, Up: Invoking gnulib-tool [Contents][Index]
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.