Debian Codegraph @

tests/Makefile

raw
1 TESTS= test_unicode \
2 test_state \
3 test_xml \
4 test_adacore_dom \
5 test_schema \
6 test_date_time \
7 test_numbers \
8 test_adacore_schema \
9 test_multiple_xsd \
10 test_examples_dom \
11 test_examples_sax \
12 test_examples_schema \
13 test_base64
14
15
16 # Force running all the tests
17 .PHONY: ${TESTS}
18
19 tests: ${TESTS}
20
21 EXECDIR=./obj/
22 RESULTS=$(shell pwd)/results
23 EXAMPLE_EXPECTED=$(shell pwd)/examples
24
25 test_unicode: EXEC=unicode/test_unicode
26 test_unicode: generic_test_unicode
27
28 test_base64: EXEC=base64/test_base64
29 test_base64: generic_test_base64
30
31 test_state: EXEC=sax/teststate
32 test_state: generic_test_state
33
34 test_xml: EXEC=dom/testxml
35 test_xml: ARGS=-auto
36 test_xml: generic_test_xml
37
38 test_schema: EXEC=schema/schematest
39 test_schema: ARGS=--xsd10
40 test_schema: generic_test_schema
41
42 test_date_time: EXEC=schema/test_date_time
43 test_date_time: generic_test_date_time
44
45 test_numbers: EXEC=schema/testnumbers
46 test_numbers: generic_test_numbers
47
48 test_adacore_dom: EXEC=adacore/dom/adacore_dom.sh
49 test_adacore_dom: EXECDIR=./
50
51 test_adacore_schema: EXEC=adacore/schema/adacore_schema.sh
52 test_adacore_schema: EXECDIR=./
53
54 ifneq ($(wildcard adacore/.*),)
55 test_adacore_dom: generic_test_adacore_dom
56 test_adacore_schema: generic_test_adacore_schema
57 else
58 test_adacore_dom: generic_not_run_adacore_dom
59 test_adacore_schema: generic_not_run_adacore_schema
60 endif
61
62 generic_test_%: BASE=$(notdir $(EXEC))
63 generic_test_%: DIR=$(dir $(EXEC))
64 generic_test_%:
65 @echo "$(EXEC)"
66 @cd $(DIR); \
67 mkdir -p obj; \
68 $(EXECDIR)$(BASE) $(ARGS) > obj/$(BASE).tmp_out; \
69 tr -d '\r' < obj/$(BASE).tmp_out > $(RESULTS)/$(BASE).out ; \
70 diff $(BASE).expected $(RESULTS)/$(BASE).out > $(RESULTS)/$(BASE).diff; \
71 if test -s $(RESULTS)/$(BASE).diff; then \
72 echo "DIFF"; \
73 cat $(RESULTS)/$(BASE).diff ; \
74 else \
75 echo "OK"; \
76 fi
77
78 generic_not_run_%:
79 @echo "$(EXEC) skipped"
80
81 test_multiple_xsd:
82 @echo "multiple xsd"
83 @cd schema/multiple_xsd; \
84 gprbuild -q -Pdefault.gpr; \
85 ./validate > $(RESULTS)/multiple_xsd.out; \
86 cp $(RESULTS)/multiple_xsd.out $(RESULTS)/multiple_xsd.diff; \
87 cat $(RESULTS)/multiple_xsd.diff
88
89 test_examples_dom:
90 @echo "test examples dom"
91 @cd ../docs/dom; \
92 gprbuild -q -p -Pdefault.gpr 2> $(RESULTS)/domexample.out; \
93 ./domexample >> $(RESULTS)/domexample.out; \
94 cp $(RESULTS)/domexample.out $(RESULTS)/domexample.diff; \
95 cat $(RESULTS)/domexample.diff; \
96 ./domexample2 > $(RESULTS)/domexample2.out; \
97 diff -b $(EXAMPLE_EXPECTED)/domexample2.expected $(RESULTS)/domexample2.out > $(RESULTS)/domexample2.diff; \
98 if test -s $(RESULTS)/domexample2.diff; then \
99 cat $(RESULTS)/domexample2.diff; fi; \
100 ./domschemaexample > $(RESULTS)/domschemaexample.out; \
101 cp $(RESULTS)/domschemaexample.out $(RESULTS)/domschemaexample.diff; \
102 cat $(RESULTS)/domschemaexample.diff
103
104 test_examples_sax:
105 @echo "test examples sax"
106 @cd ../docs/sax; \
107 gprbuild -q -p -Pdefault.gpr 2> $(RESULTS)/saxexample_main.out; \
108 ./saxexample_main >> $(RESULTS)/saxexample_main.out; \
109 diff -b $(EXAMPLE_EXPECTED)/saxexample_main.expected $(RESULTS)/saxexample_main.out > $(RESULTS)/saxexample_main.diff; \
110 if test -s $(RESULTS)/saxexample_main.diff; then \
111 cat $(RESULTS)/saxexample_main.diff; \
112 fi
113
114 test_examples_schema:
115 @echo "test examples schema"
116 @cd ../docs/schema; \
117 gprbuild -q -p -Pdefault.gpr 2> $(RESULTS)/schemaexample.out; \
118 ./schemaexample >> $(RESULTS)/schemaexample.out; \
119 cp $(RESULTS)/schemaexample.out $(RESULTS)/schemaexample.diff; \
120 cat $(RESULTS)/schemaexample.diff