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
17 all: listcheck regress
18 @echo "=== No diff output is good news."
23 rm -fr *~ adventure.text adventure.data
25 # Show summary lines for all tests.
27 @grep --text '^##' *.log
30 if ( head -3 $$f | grep --text -q '^ *##' ); then :; else echo "$$f needs a description"; fi; \
33 # General regression testing of commands and output; look at the *.log and
34 # corresponding *.chk files to see which tests this runs.
35 TESTLOADS := $(shell ls -1 *.log | sed '/.log/s///')
36 buildregress: adventure.data
37 @for file in $(TESTLOADS); do \
38 echo "Remaking $${file}.chk"; \
39 $(REPOSURGEON) advent <$${file}.log >$${file}.chk \
42 regress: adventure.data
43 @for file in $(TESTLOADS); do \
44 $(ECHO) -n " $${file} "; grep --text '##' $${file}.log || echo ' ## (no description)'; \
45 if advent < $${file}.log >/tmp/regress$$$$ 2>&1; \
46 then diff --text -u $${file}.chk /tmp/regress$$$$ || exit 1; \
47 else echo "*** Nonzero return status on $${file}!"; exit 1; fi \
49 @rm -f /tmp/regress$$$$
52 cp "$(realpath ..)"/adventure.text .
53 timeout 1 advent >/dev/null 2>&1; true