xref: /freebsd/contrib/libxo/tests/xo/Makefile.am (revision f0cfa1b168014f56c02b83e5f28412cc5f78d117)
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 = \
15xo_01.sh
16
17X=\
18xo_02.sh \
19xo_03.sh \
20xo_04.sh \
21xo_05.sh \
22xo_06.sh
23
24# TEST_CASES := $(shell cd ${srcdir} ; echo *.c )
25
26EXTRA_DIST = \
27    ${TEST_CASES} \
28    ${addprefix saved/, ${TEST_CASES:.sh=.T.err}} \
29    ${addprefix saved/, ${TEST_CASES:.sh=.T.out}} \
30    ${addprefix saved/, ${TEST_CASES:.sh=.XP.err}} \
31    ${addprefix saved/, ${TEST_CASES:.sh=.XP.out}} \
32    ${addprefix saved/, ${TEST_CASES:.sh=.JP.err}} \
33    ${addprefix saved/, ${TEST_CASES:.sh=.JP.out}} \
34    ${addprefix saved/, ${TEST_CASES:.sh=.HP.err}} \
35    ${addprefix saved/, ${TEST_CASES:.sh=.HP.out}} \
36    ${addprefix saved/, ${TEST_CASES:.sh=.X.err}} \
37    ${addprefix saved/, ${TEST_CASES:.sh=.X.out}} \
38    ${addprefix saved/, ${TEST_CASES:.sh=.J.err}} \
39    ${addprefix saved/, ${TEST_CASES:.sh=.J.out}} \
40    ${addprefix saved/, ${TEST_CASES:.sh=.H.err}} \
41    ${addprefix saved/, ${TEST_CASES:.sh=.H.out}} \
42    ${addprefix saved/, ${TEST_CASES:.sh=.HIPx.err}} \
43    ${addprefix saved/, ${TEST_CASES:.sh=.HIPx.out}}
44
45S2O = | ${SED} '1,/@@/d'
46
47all:
48
49#TEST_TRACE = set -x ;
50
51XO=../../xo/xo
52
53TEST_ONE = \
54      ${CHECKER} sh ${srcdir}/$$base.sh "${XO} --libxo:W$$fmt" ${TEST_OPTS} \
55      > out/$$base.$$fmt.out 2> out/$$base.$$fmt.err ; \
56 ${DIFF} -Nu ${srcdir}/saved/$$base.$$fmt.out out/$$base.$$fmt.out ${S2O} ; \
57 ${DIFF} -Nu ${srcdir}/saved/$$base.$$fmt.err out/$$base.$$fmt.err ${S2O}
58
59TEST_FORMATS = T XP JP HP X J H HIPx
60
61test tests: ${bin_PROGRAMS}
62	@${MKDIR} -p out
63	-@ ${TEST_TRACE} (for test in ${TEST_CASES} ; do \
64	    base=`${BASENAME} $$test .sh` ; \
65            (for fmt in ${TEST_FORMATS}; do \
66	        echo "... $$test ... $$fmt ..."; \
67	        ${TEST_ONE}; \
68                true; \
69            done) \
70	done)
71
72one:
73	-@(test=${TEST_CASE}; data=${TEST_DATA}; ${TEST_ONE} ; true)
74
75accept:
76	-@(for test in ${TEST_CASES} ; do \
77	    base=`${BASENAME} $$test .sh` ; \
78            (for fmt in ${TEST_FORMATS}; do \
79	        echo "... $$test ... $$fmt ..."; \
80	        ${CP} out/$$base.$$fmt.out ${srcdir}/saved/$$base.$$fmt.out ; \
81	        ${CP} out/$$base.$$fmt.err ${srcdir}/saved/$$base.$$fmt.err ; \
82	    done) \
83	done)
84
85CLEANFILES =
86CLEANDIRS = out
87
88clean-local:
89	rm -rf ${CLEANDIRS}
90