xref: /freebsd/contrib/libxo/tests/core/Makefile.am (revision b78ee15e9f04ae15c3e1200df974473167524d17)
1#
2# $Id$
3#
4# Copyright 2014, Juniper Networks, Inc.
5# All rights reserved.
6# This SOFTWARE is licensed under the LICENSE provided in the
7# ../Copyright file. By downloading, installing, copying, or otherwise
8# using the SOFTWARE, you agree to be bound by the terms of that
9# LICENSE.
10
11AM_CFLAGS = -I${top_srcdir} -I${top_srcdir}/libxo
12
13# Ick: maintained by hand!
14TEST_CASES = \
15test_01.c \
16test_02.c \
17test_03.c \
18test_04.c \
19test_05.c \
20test_06.c \
21test_07.c \
22test_08.c \
23test_09.c \
24test_10.c
25
26test_01_test_SOURCES = test_01.c
27test_02_test_SOURCES = test_02.c
28test_03_test_SOURCES = test_03.c
29test_04_test_SOURCES = test_04.c
30test_05_test_SOURCES = test_05.c
31test_06_test_SOURCES = test_06.c
32test_07_test_SOURCES = test_07.c
33test_08_test_SOURCES = test_08.c
34test_09_test_SOURCES = test_09.c
35test_10_test_SOURCES = test_10.c
36
37# TEST_CASES := $(shell cd ${srcdir} ; echo *.c )
38
39noinst_PROGRAMS = ${TEST_CASES:.c=.test}
40
41LDADD = \
42    ${top_builddir}/libxo/libxo.la
43
44EXTRA_DIST = \
45    ${TEST_CASES} \
46    ${addprefix saved/, ${TEST_CASES:.c=.T.err}} \
47    ${addprefix saved/, ${TEST_CASES:.c=.T.out}} \
48    ${addprefix saved/, ${TEST_CASES:.c=.XP.err}} \
49    ${addprefix saved/, ${TEST_CASES:.c=.XP.out}} \
50    ${addprefix saved/, ${TEST_CASES:.c=.JP.err}} \
51    ${addprefix saved/, ${TEST_CASES:.c=.JP.out}} \
52    ${addprefix saved/, ${TEST_CASES:.c=.HP.err}} \
53    ${addprefix saved/, ${TEST_CASES:.c=.HP.out}} \
54    ${addprefix saved/, ${TEST_CASES:.c=.X.err}} \
55    ${addprefix saved/, ${TEST_CASES:.c=.X.out}} \
56    ${addprefix saved/, ${TEST_CASES:.c=.J.err}} \
57    ${addprefix saved/, ${TEST_CASES:.c=.J.out}} \
58    ${addprefix saved/, ${TEST_CASES:.c=.H.err}} \
59    ${addprefix saved/, ${TEST_CASES:.c=.H.out}} \
60    ${addprefix saved/, ${TEST_CASES:.c=.HIPx.err}} \
61    ${addprefix saved/, ${TEST_CASES:.c=.HIPx.out}}
62
63S2O = | ${SED} '1,/@@/d'
64
65all:
66
67valgrind:
68	@echo '## Running the regression tests under Valgrind'
69	${MAKE} CHECKER='valgrind -q' tests
70
71#TEST_TRACE = set -x ;
72
73TEST_ONE = \
74  LIBXO_OPTIONS=:W$$fmt \
75      ${CHECKER} ./$$base.test ${TEST_OPTS} \
76      > out/$$base.$$fmt.out 2> out/$$base.$$fmt.err ; \
77 ${DIFF} -Nu ${srcdir}/saved/$$base.$$fmt.out out/$$base.$$fmt.out ${S2O} ; \
78 ${DIFF} -Nu ${srcdir}/saved/$$base.$$fmt.err out/$$base.$$fmt.err ${S2O}
79
80TEST_FORMATS = T XP JP HP X J H HIPx
81
82test tests: ${bin_PROGRAMS}
83	@${MKDIR} -p out
84	-@ ${TEST_TRACE} (for test in ${TEST_CASES} ; do \
85	    base=`${BASENAME} $$test .c` ; \
86            (for fmt in ${TEST_FORMATS}; do \
87	        echo "... $$test ... $$fmt ..."; \
88	        ${TEST_ONE}; \
89                true; \
90            done) \
91	done)
92
93one:
94	-@(test=${TEST_CASE}; data=${TEST_DATA}; ${TEST_ONE} ; true)
95
96accept:
97	-@(for test in ${TEST_CASES} ; do \
98	    base=`${BASENAME} $$test .c` ; \
99            (for fmt in ${TEST_FORMATS}; do \
100	        echo "... $$test ... $$fmt ..."; \
101	        ${CP} out/$$base.$$fmt.out ${srcdir}/saved/$$base.$$fmt.out ; \
102	        ${CP} out/$$base.$$fmt.err ${srcdir}/saved/$$base.$$fmt.err ; \
103	    done) \
104	done)
105
106.c.test:
107	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -o $@ $<
108
109CLEANFILES = ${TEST_CASES:.c=.test}
110CLEANDIRS = out
111
112clean-local:
113	rm -rf ${CLEANDIRS}
114