Hi,

On 01.08.2013 00:46, Peng Yu wrote:

> I'm not able to understand the usage of TESTS in Makefile.am, as there
> are many other things discussed in conjunction with TESTS and which
> obscures the description of TESTS. Could anybody point me a minimal
> example (without any things unrelated to TESTS) that demonstrates the
> usage of TESTS? Thanks.

While not an example, it can be simplified to:

When 'make check' is run, each file listed in TESTS is executed in turn,
and if the return code is non-zero, this is flagged as an error.

Depending on your project, these files can be either scripts that invoke
a program from your project and verifies its behaviour, or programs that
are specially built, if you want to test a library.

If you write

TESTS = foo bar

then 'make check' will invoke

,/foo

followed by

./bar

How "foo" and "bar" are built is completely independent, for a program
you could use

check_PROGRAMS = foo bar

foo_SOURCES = foo.c
bar_SOURCES = bar.c

The "check_" tells automake to build these programs only before running
the tests.

   Simon

Reply via email to