xref: /freebsd/contrib/libxo/tests/core/Makefile.am (revision af23369a6deaaeb612ab266eb88b8bb8d560c322)
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 \
25test_11.c \
26test_12.c
27
28test_01_test_SOURCES = test_01.c
29test_02_test_SOURCES = test_02.c
30test_03_test_SOURCES = test_03.c
31test_04_test_SOURCES = test_04.c
32test_05_test_SOURCES = test_05.c
33test_06_test_SOURCES = test_06.c
34test_07_test_SOURCES = test_07.c
35test_08_test_SOURCES = test_08.c
36test_09_test_SOURCES = test_09.c
37test_10_test_SOURCES = test_10.c
38test_11_test_SOURCES = test_11.c
39test_12_test_SOURCES = test_12.c
40
41# TEST_CASES := $(shell cd ${srcdir} ; echo *.c )
42
43noinst_PROGRAMS = ${TEST_CASES:.c=.test}
44
45LDADD = \
46    ${top_builddir}/libxo/libxo.la
47
48if HAVE_HUMANIZE_NUMBER
49LDADD += -lutil
50endif
51
52EXTRA_DIST = \
53    ${TEST_CASES} \
54    ${addprefix saved/, ${TEST_CASES:.c=.E.err}} \
55    ${addprefix saved/, ${TEST_CASES:.c=.E.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    ${addprefix saved/, ${TEST_CASES:.c=.HP.err}} \
61    ${addprefix saved/, ${TEST_CASES:.c=.HP.out}} \
62    ${addprefix saved/, ${TEST_CASES:.c=.J.err}} \
63    ${addprefix saved/, ${TEST_CASES:.c=.J.out}} \
64    ${addprefix saved/, ${TEST_CASES:.c=.JP.err}} \
65    ${addprefix saved/, ${TEST_CASES:.c=.JP.out}} \
66    ${addprefix saved/, ${TEST_CASES:.c=.JPu.err}} \
67    ${addprefix saved/, ${TEST_CASES:.c=.JPu.out}} \
68    ${addprefix saved/, ${TEST_CASES:.c=.T.err}} \
69    ${addprefix saved/, ${TEST_CASES:.c=.T.out}} \
70    ${addprefix saved/, ${TEST_CASES:.c=.X.err}} \
71    ${addprefix saved/, ${TEST_CASES:.c=.X.out}} \
72    ${addprefix saved/, ${TEST_CASES:.c=.XP.err}} \
73    ${addprefix saved/, ${TEST_CASES:.c=.XP.out}} \
74    ${addprefix saved/, test_01.Ecsv1.out} \
75    ${addprefix saved/, test_01.Ecsv1.err} \
76    ${addprefix saved/, test_01.Ecsv2.out} \
77    ${addprefix saved/, test_01.Ecsv2.err} \
78    ${addprefix saved/, test_01.Ecsv3.out} \
79    ${addprefix saved/, test_01.Ecsv3.err}
80
81S2O = | ${SED} '1,/@@/d'
82
83all:
84
85valgrind:
86	@echo '## Running the regression tests under Valgrind'
87	${MAKE} CHECKER='valgrind -q' tests
88
89#TEST_TRACE = set -x ;
90
91TEST_JIG = \
92      ${CHECKER} ./$$base.test --libxo$$xoopts ${TEST_OPTS} \
93      > out/$$base.$$fmt.out 2> out/$$base.$$fmt.err ; \
94 ${DIFF} -Nu ${srcdir}/saved/$$base.$$fmt.out out/$$base.$$fmt.out ${S2O} ; \
95 ${DIFF} -Nu ${srcdir}/saved/$$base.$$fmt.err out/$$base.$$fmt.err ${S2O}
96
97TEST_JIG2 = \
98echo "... $$test ... $$fmt ..."; \
99xoopts==warn,$$csv ; \
100${TEST_JIG}; true;
101
102TEST_FORMATS = T XP JP JPu HP X J H HIPx
103
104test tests: ${bin_PROGRAMS}
105	@${MKDIR} -p out
106	-@ ${TEST_TRACE} (for test in ${TEST_CASES} ; do \
107	    base=`${BASENAME} $$test .c` ; \
108            (for fmt in ${TEST_FORMATS}; do \
109	        echo "... $$test ... $$fmt ..."; \
110                xoopts=:W$$fmt ; \
111	        ${TEST_JIG}; \
112                true; \
113            done) ; \
114            (for fmt in E; do \
115	        echo "... $$test ... $$fmt ..."; \
116                xoopts==warn,encoder=test ; \
117	        ${TEST_JIG}; \
118                true; \
119            done) \
120	done)
121	-@ (${TEST_TRACE} test=test_01.c; base=test_01; \
122	    (   fmt=Ecsv1; csv=encoder=csv ; \
123			${TEST_JIG2} ); \
124	    (   fmt=Ecsv2; csv=encoder=csv:path=top-level/data/item:no-header ; \
125			${TEST_JIG2} ); \
126	    (   fmt=Ecsv3; csv=@csv:path=item:leafs=sku.sold:no-quotes ; \
127			${TEST_JIG2} ); \
128	)
129
130
131one:
132	-@(test=${TEST_CASE}; data=${TEST_DATA}; ${TEST_ONE} ; true)
133
134accept:
135	-@(for test in ${TEST_CASES} ; do \
136	    base=`${BASENAME} $$test .c` ; \
137            (for fmt in ${TEST_FORMATS} E ; do \
138	        echo "... $$test ... $$fmt ..."; \
139	        ${CP} out/$$base.$$fmt.out ${srcdir}/saved/$$base.$$fmt.out ; \
140	        ${CP} out/$$base.$$fmt.err ${srcdir}/saved/$$base.$$fmt.err ; \
141	    done) \
142	done)
143	-@(test=test_01.c; base=test_01; for fmt in Ecsv1 Ecsv2 Ecsv3 ; do \
144	        echo "... $$test ... $$fmt ..."; \
145	        ${CP} out/$$base.$$fmt.out ${srcdir}/saved/$$base.$$fmt.out ; \
146	        ${CP} out/$$base.$$fmt.err ${srcdir}/saved/$$base.$$fmt.err ; \
147	done)
148
149.c.test:
150	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -o $@ $<
151
152CLEANFILES = ${TEST_CASES:.c=.test}
153CLEANDIRS = out
154
155clean-local:
156	rm -rf ${CLEANDIRS}
157