Next: , Previous: , Up: Top   [Contents][Index]


12 Interfacing with GNU Automake

CCTests is primarily meant to interface with the parallel test harness of GNU Automake, See Parallel Test Harness in GNU Automake.

Let’s say we are building a C language library with stem ‘demo’, which depends on the package CCExceptions and has source files under the directory src; we put the following in the Makefile.am template:

demo_CURRENT    = 1
demo_REVISION   = 0
demo_AGE        = 0

include_HEADERS         = src/demo.h

lib_LTLIBRARIES         = libdemo.la
libdemo_la_CPPFLAGS     = $(CCEXCEPTIONS_CFLAGS)
libdemo_la_LDFLAGS      = \
   -version-info $(demo_CURRENT):$(demo_REVISION):$(demo_AGE) \
   $(CCEXCEPTIONS_LIBS)
libdemo_la_SOURCES      = \
        src/demo.h              \
        src/demo-internals.h    \
        src/demo-version.c      \
        src/demo-stuff.c

we can declare the test suite programs, with source files under the directory tests, as follows:

check_PROGRAMS	= \
  tests/one       \
  tests/two       \
  tests/three

TESTS                   = $(check_PROGRAMS)

demo_tests_cppflags     = \
  -I$(srcdir)/src -I$(srcdir)/tests $(CCTESTS_CFLAGS)
demo_tests_ldadd        = libdemo.la $(CCTESTS_LIBS)

tests_one_CPPFLAGS      = $(demo_tests_cppflags)
tests_one_LDADD         = $(demo_tests_ldadd)

tests_two_CPPFLAGS      = $(demo_tests_cppflags)
tests_two_LDADD         = $(demo_tests_ldadd)

tests_three_CPPFLAGS    = $(cctests_tests_cppflags)
tests_three_LDADD       = $(cctests_tests_ldadd)
tests_three_SOURCES     = \
  tests/three-main.c    \
  tests/three-utils.c   \
  tests/three-header.h

now on the command line we can build everything and run the tests with:

$ make -j3 all && make -j3 check

if we want to run just the tests in the program one, we can do:

$ make -j3 check cctests_file=one

if we want to run just the tests in the groups named spiffy, we can do:

$ make -j3 check cctests_group=one

if we want to run just the tests in the test functions whose name include the string ‘1_3’, we can do:

$ make -j3 check cctests_name=1_3

obviously we can use multiple environment variables at the same time:

$ make -j3 check cctests_file=two cctests_name=1_3

Next: , Previous: , Up: Top   [Contents][Index]

This document describes version 0.4.1-devel.1 of CCTests.