7.7 Testing
Automake also includes simple support for testing your program.
The most simple form of this is the `TESTS' variable. This
variable holds a list of tests which are run when the user runs
make check . Each test is built (if necessary) and then executed.
For each test, make prints a single line indicating whether the
test has passed or failed. Failure means exiting with a non-zero
status, with the special exception that an exit status of `77'
(2)
means that the test should be ignored. make check also prints a
summary showing the number of passes and fails.
Automake also supports the notion of an xfail, which is a test
which is expected to fail. Sometimes this is useful when you want to
track a known failure, but you aren't prepared to fix it right away.
Tests which are expected to fail should be listed in both `TESTS'
and `XFAIL_TESTS'.
The special prefix `check' can be used with primaries to indicate
that the objects should only be built at make check time. For
example, here is how you can build a program that will only be used
during the testing process:
|
check_PROGRAMS = test-program
test_program_SOURCES = ...
|
Automake also supports the use of DejaGNU, the GNU test framework.
DejaGNU support can be enabled using the `dejagnu' option:
|
AUTOMAKE_OPTIONS = dejagnu
|
The resulting `Makefile.in' will include code to invoke the
runtest program appropriately.
|