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