filters: Added GP_FilterKernelPrint() function.
[gfxprim.git] / tests.mk
blob39f083529871346260269a4e490a61fe51ab3147
1 .PHONY: tests runtests
4 # List of test targets (testsuite incl. automatically)
6 ifndef TESTS
7 TESTS=
8 endif
11 # Testsuite with automated collection of tests
12 # All .test.c files are scraped for GP_TEST definitions
15 ifdef TESTSUITE
16 # a bit crude way to link with test minilibrary
17 GP_TESTLIB_SRCS=$(wildcard ${TOPDIR}/tests/common/*.c)
18 CSOURCES+=${GP_TESTLIB_SRCS}
20 # generated suite creation code
21 TESTSUITE_GEN=collected_tests.gen.c # also fixed in the code generator
22 CLEAN+=${TESTSUITE_GEN}
24 ${TESTSUITE_GEN}: $(filter-out ${TESTSUITE_GEN},${GENSOURCES}) ${GENHEADERS}
25 ifdef VERBOSE
26 ${PYTHON} ${TOPDIR}/pylib/bin/generate_collected_tests.py -t $(TEMPLATE_DIR) "." "$@"
27 else
28 @echo "TSTS $@"
29 @${PYTHON} ${TOPDIR}/pylib/bin/generate_collected_tests.py -t $(TEMPLATE_DIR) "." "$@"
30 endif
33 TESTSUITE_SRCS=$(wildcard *.test.c) ${GENSOURCES} ${GENHEADERS} ${GP_TESTLIB_SRCS} ${TESTSUITE_GEN}
34 INCLUDE+=../tests/common
35 TESTSUITE_OBJS=$(patsubst %.c,%.o,$(TESTSUITE_SRCS))
36 CLEAN+=${TESTSUITE} ${TESTSUITE_OBJS}
37 TESTS+=${TESTSUITE}
39 ${TESTSUITE}: ${TESTSUITE_OBJS}
40 ifdef VERBOSE
41 $(CC) $(CFLAGS) $(LDFLAGS) -Wl,--start-group $(LDLIBS) $^ -Wl,--end-group -o $@
42 else
43 @echo "LD $@"
44 @$(CC) $(CFLAGS) $(LDFLAGS) -Wl,--start-group $(LDLIBS) $^ -Wl,--end-group -o $@
45 endif # VERBOSE
47 endif # TESTSUITE
49 tests: $(TESTS)
51 runtests: tests
52 for test in $(TESTS); do LD_LIBRARY_PATH=../../build ./"$$test"; done
54 # WARN: avoid double includion?
55 include $(TOPDIR)/gen.mk