A typical solution is to write tests so that they look in the source directory for data files. For example, you can refer to $srcdir
in a test or convert test
to test.in
and refer to @ srcdir@
.
If your tests are all in the source directory, you can run all the tests in this directory by setting TESTS_ENVIRONMENT in Makefile.am:
TESTS_ENVIRONMENT = cd $(srcdir) &&
This will fail if some of your tests are created by configure and therefore will live only in the build directory, in which case you can selectively cd with something like:
TESTS_ENVIRONMENT = { test $${tst} = mytest && cd $(srcdir); true; } &&
Trying to use TESTS_ENVIRONMENT, as it is fragile at best, and it would be better to write tests so that they look in the source directory for the data files.
source share