In a larger project, I have set up ./tests/Makefile.am
to run a number of tests when I call make check
. The file global_wrapper.c
contains the setup / breakdown code, and it calls test functions implemented in several subdirectories.
TESTS = global_test
check_PROGRAMS = global_test
global_test_SOURCES = global_wrapper.c foo/foo_test.c bar/bar_test.c
Works great. But the tests take a long time, so I would like to be able to optionally execute only tests from a single subdir. This is how I did it at first.
I added the subdirectories:
SUBDIRS = foo bar
In the subdirectories, I added local wrappers and Makefile.am
s:
TESTS = foo_test
check_PROGRAMS = foo_test
# the foo_test.c here is of course the same as in the global Makefile.am
foo_test_SOURCES = foo_wrapper.c foo_test.c
This, too, works great - when I call make check
in the subdirectory foo
, only the foo tests are executed.
However, when I now call make check
in ./tests
, all tests are executed twice. Once through global_test
, and once through the local test programs.
If I omit the SUBDIRS
statement in the global Makefile.am
, the subdirectory makefiles don t get build. If I omit TESTS
from the local Makefile.am
s, make check
doesn t do anything for the local directories.
I m not that familiar with automake, but I am pretty sure there is some way to solve this dilemma. Can anybody here give me a hint?