TAPify the test suite.
[super-star-trek.git] / test / Makefile
1 # Test-suite makefile for sst
2
3 PYTHON=python
4
5 TAPFILTER=cat
6 ifeq (,$(command -v tapview))
7         TAPFILTER=tapview
8 else
9         ifeq (,$(command -v tappy))
10                 TAPFILTER=tappy
11         endif
12 endif
13
14 all:
15         @echo "With Python 2:"
16         @$(MAKE) -e PYTHON=python2 regress | $(TAPFILTER)
17         @echo "With Python 3:"
18         @$(MAKE) -e PYTHON=python3 regress | $(TAPFILTER)
19         @echo "No diff output is good news."
20
21 .SUFFIXES: .log .chk
22
23 .log.chk:
24         ../sst.py -r $< >$@ 2>&1
25
26 TESTLOADS := $(shell ls *.log | sed '/.log/s///')
27 buildregress:
28         @for test in $(TESTLOADS); do \
29             if [ ! -f $${test}.tst ] ; \
30             then \
31                     echo "Remaking $${test}.chk"; \
32                     rm -f $${test}.chk && ../sst.py -r $${test}.log >$${test}.chk 2>&1; \
33             fi \
34         done
35 regress:
36         echo "1..$$(ls *.log | wc -l)"
37         @for test in $(TESTLOADS); \
38         do \
39             if [ ! -f $${test}.tst ] ; \
40             then \
41                 legend=$$(sed -n -e '/# Test/s//Test/p' <$${test}.log); \
42                 ../sst.py -r "$${test}.log" | ./tapdiffer "$${legend}" "$${test}.chk"; \
43             fi \
44         done
45         @rm -f /tmp/regress