From 33fcf676128426f2ac9a4730d63fa481bb351518 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 18 Aug 2024 00:07:56 +0300 Subject: make check works again --- tests/scripts/gen-simple | 14 ++++++++++++++ tests/scripts/gen-simple-xfail | 29 +++++++++++++++++++++++++++++ tests/scripts/makefile | 16 ++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100755 tests/scripts/gen-simple create mode 100755 tests/scripts/gen-simple-xfail create mode 100644 tests/scripts/makefile (limited to 'tests/scripts') diff --git a/tests/scripts/gen-simple b/tests/scripts/gen-simple new file mode 100755 index 0000000..cf4c35c --- /dev/null +++ b/tests/scripts/gen-simple @@ -0,0 +1,14 @@ +#!/bin/sh + +mkdir -p $(for d in "${@}"; do echo "$d"; done | uniq | sed "s|^|reports/|") + +for s in "${@}" +do + echo ".PHONY: $s" >> tests.mk + echo "$s:" >> tests.mk + echo " @../ek $s/$s.ek > reports/$s/log 2>&1\\" >> tests.mk + echo " && echo OK > reports/$s/OK \\" >> tests.mk + echo " || echo ERR > reports/$s/OK" >> tests.mk +done + +echo "TESTS += " "${@}" >> tests.mk diff --git a/tests/scripts/gen-simple-xfail b/tests/scripts/gen-simple-xfail new file mode 100755 index 0000000..bb8c5ae --- /dev/null +++ b/tests/scripts/gen-simple-xfail @@ -0,0 +1,29 @@ +#!/bin/sh + +mkdir -p $(for d in "${@}"; do echo "$d"; done \ + | sed "s|,.*||" | uniq | sed "s|^|reports/|") + +for s in "${@}" +do + NAME=${s%%,*} + EMSG=${s#${NAME},} + echo ".PHONY: $NAME" >> tests.mk + echo "$NAME:" >> tests.mk + echo " @../ek $NAME/$NAME.ek > reports/$NAME/log 2>&1 \\" >> tests.mk + echo " && echo 'Wrong retval' > reports/$NAME/OK \\" >> tests.mk + echo " || :" >> tests.mk + echo " @grep '$EMSG' reports/$NAME/log > /dev/null; \\" >> tests.mk + echo " [ \$\$? -eq 0 ] \\" >> tests.mk + echo " && echo OK > reports/$NAME/OK \\" >> tests.mk + echo " || echo EMSG > reports/$NAME/OK" >> tests.mk +done + +echo -n "TESTS +=" >> tests.mk +for s in "${@}" +do + NAME=${s%%,*} + echo -n " $NAME" >> tests.mk +done + +# append newline +echo "" >> tests.mk diff --git a/tests/scripts/makefile b/tests/scripts/makefile new file mode 100644 index 0000000..a85d373 --- /dev/null +++ b/tests/scripts/makefile @@ -0,0 +1,16 @@ +.PHONY: all +all: check + +TESTS := +include tests.mk + +.PHONY: check +check: $(TESTS) + @cd reports; for d in * ; do \ + if [ ! -f "$$d/OK" ]; then \ + echo "BROKEN: $$d" ; \ + elif [ "$$(tail -n1 $$d/OK)" != "OK" ]; then \ + echo "FAIL: $$d" ; \ + fi \ + done + @echo "Done." -- cgit v1.3