1 # Test-suite makefile for reposurgeon
3 # By setting the REPOSURGEON environment variable and using -e
4 # a different implementation can be plugged in to the tests.
6 # Use absolute path so tests that change working directory still use
7 # scripts from parent directory. Note that using $PWD seems to fail
8 # here under Gitlab's CI environment.
9 PATH := $(realpath ..):$(realpath .):${PATH}
11 # Defeat annoying behavior under Mac OS X - builtin echo doesn't do -n
15 @echo "=== No diff output is good news."
20 rm -fr *~ adventure.text adventure.data
22 # Show summary lines for all tests.
24 @grep --text '^##' *.log
27 if ( head -3 $$f | grep --text -q '^ *##' ); then :; else echo "$$f needs a description"; fi; \
30 # General regression testing of commands and output; look at the *.log and
31 # corresponding *.chk files to see which tests this runs.
32 TESTLOADS := $(shell ls -1 *.log | sed '/.log/s///')
33 buildregress: adventure.data
34 @for file in $(TESTLOADS); do \
35 echo "Remaking $${file}.chk"; \
36 advent <$${file}.log >$${file}.chk 2>&1 || exit 1; \
38 regress: adventure.data
39 @for file in $(TESTLOADS); do \
40 $(ECHO) -n " $${file} "; grep --text '##' $${file}.log || echo ' ## (no description)'; \
41 if advent < $${file}.log >/tmp/regress$$$$ 2>&1; \
42 then diff --text -u $${file}.chk /tmp/regress$$$$ || exit 1; \
43 else echo "*** Nonzero return status on $${file}!"; exit 1; fi \
45 @rm -f /tmp/regress$$$$
48 cp "$(realpath ..)"/adventure.text .
49 timeout 1 advent >/dev/null 2>&1; true