1 # Test-suite makefile for reposurgeon
3 # Use absolute path so tests that change working directory still use
4 # scripts from parent directory. Note that using $PWD seems to fail
5 # here under Gitlab's CI environment.
6 PATH := $(realpath ..):$(realpath .):${PATH}
8 # Defeat annoying behavior under Mac OS X - builtin echo doesn't do -n
12 @echo "=== No diff output is good news."
17 rm -fr *~ adventure.text
19 # Show summary lines for all tests.
21 @grep --text '^##' *.log
24 if ( head -3 $$f | grep --text -q '^ *##' ); then :; else echo "$$f needs a description"; fi; \
27 # General regression testing of commands and output; look at the *.log and
28 # corresponding *.chk files to see which tests this runs.
29 TESTLOADS := $(shell ls -1 *.log | sed '/.log/s///')
31 @for file in $(TESTLOADS); do \
32 echo "Remaking $${file}.chk"; \
33 advent <$${file}.log >$${file}.chk 2>&1 || exit 1; \
36 @for file in $(TESTLOADS); do \
37 $(ECHO) -n " $${file} "; grep --text '##' $${file}.log || echo ' ## (no description)'; \
38 if advent < $${file}.log >/tmp/regress$$$$ 2>&1; \
39 then diff --text -u $${file}.chk /tmp/regress$$$$ || exit 1; \
40 else echo "*** Nonzero return status on $${file}!"; exit 1; fi \
42 @rm -f /tmp/regress$$$$