14 Support for test suites
Automake supports two forms of test suites.
If the variable `TESTS' is defined, its value is taken to be a list
of programs to run in order to do the testing. The programs can either
be derived objects or source objects; the generated rule will look both
in `srcdir' and `.'. Programs needing data files should look for them
in `srcdir' (which is both an environment variable and a make variable)
so they work when building in a separate directory ( Build
Directories (autoconf)Build Directories.), and in particular for the
`distcheck' target ( Dist).
The number of failures will be printed at the end of the run. If a
given test program exits with a status of 77, then its result is ignored
in the final count. This feature allows non-portable tests to be
ignored in environments where they don't make sense.
The variable `TESTS_ENVIRONMENT' can be used to set environment
variables for the test run; the environment variable `srcdir' is set in
the rule. If all your test programs are scripts, you can also set
`TESTS_ENVIRONMENT' to an invocation of the shell (e.g. `$(SHELL)
-x'); this can be useful for debugging the tests.
If `dejagnu' (ftp://prep.ai.mit.edu/pub/gnu/dejagnu-1.3.tar.gz)
appears in `AUTOMAKE_OPTIONS', then a `dejagnu'-based test suite is
assumed. The value of the variable `DEJATOOL' is passed as the
`--tool' argument to `runtest'; it defaults to the name of the package.
The variable `RUNTESTDEFAULTFLAGS' holds the `--tool' and `--srcdir'
flags that are passed to dejagnu by default; this can be overridden if
The variables `EXPECT', `RUNTEST' and `RUNTESTFLAGS' can also be
overridden to provide project-specific values. For instance, you will
need to do this if you are testing a compiler toolchain, because the
default values do not take into account host and target names.
In either case, the testing is done via `make check'.
automatically generated byinfo2html