xref: /freebsd/contrib/libxo/tests/core/Makefile.am (revision ff0ba87247820afbdfdc1b307c803f7923d0e4d3)
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
22
23test_01_test_SOURCES = test_01.c
24test_02_test_SOURCES = test_02.c
25test_03_test_SOURCES = test_03.c
26test_04_test_SOURCES = test_04.c
27test_05_test_SOURCES = test_05.c
28test_06_test_SOURCES = test_06.c
29test_07_test_SOURCES = test_07.c
30
31# TEST_CASES := $(shell cd ${srcdir} ; echo *.c )
32
33noinst_PROGRAMS = ${TEST_CASES:.c=.test}
34
35LDADD = \
36    ${top_builddir}/libxo/libxo.la
37
38EXTRA_DIST = \
39    ${TEST_CASES} \
40    ${addprefix saved/, ${TEST_CASES:.c=.T.err}} \
41    ${addprefix saved/, ${TEST_CASES:.c=.T.out}} \
42    ${addprefix saved/, ${TEST_CASES:.c=.XP.err}} \
43    ${addprefix saved/, ${TEST_CASES:.c=.XP.out}} \
44    ${addprefix saved/, ${TEST_CASES:.c=.JP.err}} \
45    ${addprefix saved/, ${TEST_CASES:.c=.JP.out}} \
46    ${addprefix saved/, ${TEST_CASES:.c=.HP.err}} \
47    ${addprefix saved/, ${TEST_CASES:.c=.HP.out}} \
48    ${addprefix saved/, ${TEST_CASES:.c=.X.err}} \
49    ${addprefix saved/, ${TEST_CASES:.c=.X.out}} \
50    ${addprefix saved/, ${TEST_CASES:.c=.J.err}} \
51    ${addprefix saved/, ${TEST_CASES:.c=.J.out}} \
52    ${addprefix saved/, ${TEST_CASES:.c=.H.err}} \
53    ${addprefix saved/, ${TEST_CASES:.c=.H.out}} \
54    ${addprefix saved/, ${TEST_CASES:.c=.HIPx.err}} \
55    ${addprefix saved/, ${TEST_CASES:.c=.HIPx.out}}
56
57S2O = | ${SED} '1,/@@/d'
58
59all:
60
61valgrind:
62	@echo '## Running the regression tests under Valgrind'
63	${MAKE} CHECKER='valgrind -q' tests
64
65#TEST_TRACE = set -x ;
66
67TEST_ONE = \
68  LIBXO_OPTIONS=:W$$fmt \
69      ${CHECKER} ./$$base.test ${TEST_OPTS} \
70      > out/$$base.$$fmt.out 2> out/$$base.$$fmt.err ; \
71 ${DIFF} -Nu ${srcdir}/saved/$$base.$$fmt.out out/$$base.$$fmt.out ${S2O} ; \
72 ${DIFF} -Nu ${srcdir}/saved/$$base.$$fmt.err out/$$base.$$fmt.err ${S2O}
73
74TEST_FORMATS = T XP JP HP X J H HIPx
75
76test tests: ${bin_PROGRAMS}
77	@${MKDIR} -p out
78	-@ ${TEST_TRACE} (for test in ${TEST_CASES} ; do \
79	    base=`${BASENAME} $$test .c` ; \
80            (for fmt in ${TEST_FORMATS}; do \
81	        echo "... $$test ... $$fmt ..."; \
82	        ${TEST_ONE}; \
83                true; \
84            done) \
85	done)
86
87one:
88	-@(test=${TEST_CASE}; data=${TEST_DATA}; ${TEST_ONE} ; true)
89
90accept:
91	-@(for test in ${TEST_CASES} ; do \
92	    base=`${BASENAME} $$test .c` ; \
93            (for fmt in ${TEST_FORMATS}; do \
94	        echo "... $$test ... $$fmt ..."; \
95	        ${CP} out/$$base.$$fmt.out ${srcdir}/saved/$$base.$$fmt.out ; \
96	        ${CP} out/$$base.$$fmt.err ${srcdir}/saved/$$base.$$fmt.err ; \
97	    done) \
98	done)
99
100.c.test:
101	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -o $@ $<
102
103CLEANFILES = ${TEST_CASES:.c=.test}
104CLEANDIRS = out
105
106clean-local:
107	rm -rf ${CLEANDIRS}
108