From b73c9b0a964ae6f2e3af5e597d7f98244f552efb Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 25 Mar 2022 07:38:42 -0700 Subject: Use awk for testsuite rather than cppawk. There are ways in which cppawk can be fundamentally broken which will cause the test suite to appear to succeed, but without actually running any tests. --- testsuite.awk | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 testsuite.awk (limited to 'testsuite.awk') diff --git a/testsuite.awk b/testsuite.awk new file mode 100755 index 0000000..2c9fd14 --- /dev/null +++ b/testsuite.awk @@ -0,0 +1,32 @@ +#!/usr/bin/awk -f + +BEGIN { + RS = "--\n" + FS = ":\n" +} + +function runtest(id, code, output, + failed) +{ + print code > "script.sh" + print output > "output" + + failed = 0 + + if (output == "ERR\n") { + if (system("sh script.sh > /dev/null 2>&1") == 0) + failed = 1 + } else if (system("[ \"$(sh script.sh)\" = \"$(cat output)\" ]") != 0) { + failed = 1 + } + + if (failed) + printf("test %s failed (for cppawk = %s)\n", id, ENVIRON["cppawk"]) + + close("script.sh") + close("output") +} + +$1 { + runtest($1, $2, $3) +} -- cgit v1.2.3