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