diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2026-05-01 20:35:00 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2026-05-01 22:16:26 +0300 |
| commit | 8946c27306abed7065afad3f015df5ee81e72ad2 (patch) | |
| tree | c53c9a2c0437109e9c1e3f873bf8a54220ee5ded /tests/scripts/run-xfail | |
| parent | 7790e27b3423901e2080bfd3c600a65a48d42886 (diff) | |
| download | fwd-8946c27306abed7065afad3f015df5ee81e72ad2.tar.gz fwd-8946c27306abed7065afad3f015df5ee81e72ad2.zip | |
add support for coverage
Diffstat (limited to 'tests/scripts/run-xfail')
| -rwxr-xr-x | tests/scripts/run-xfail | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/scripts/run-xfail b/tests/scripts/run-xfail new file mode 100755 index 0000000..35bcc75 --- /dev/null +++ b/tests/scripts/run-xfail @@ -0,0 +1,58 @@ +#!/bin/sh +NAME="$1" +EMSG="$2" + +try_vg() { + if [ "x$VALGRIND" != "x0" ] && which valgrind > /dev/null >&1; then + eval "valgrind -q --leak-check=full --error-exitcode=169 $1" + else + eval "$1" + fi + + RETVAL=$? + return "$RETVAL" +} + +I=0 +while :; do + if try_vg "../fwd $NAME/$NAME.fwd" \ + 1> "reports/$NAME/gen.c" \ + 2> "reports/$NAME/run-$I" + then + # success was not expected + echo "SUCC" > reports/$NAME/OK + exit 0 + fi + + if [ "$RETVAL" = 169 ]; then + echo "VALGRIND" > reports/$NAME/OK + + # don't return on an error so that makefile continues running + # other tests that are maybe failing, and reports the status + # after all tests have been run + exit 0 + fi + + # correctly handled coverage exception, continue to next run + # here we check for the special 'internal error' which should be + # reported if the error was handled gracefully, otherwise since the + # error message is not the one we expected and not a covsrv error, we + # don't know what it is and could end up in an infinite loop if we don't + # stop here. + if grep 'COVSRV: EXIT' "reports/$NAME/gen.c" > /dev/null \ + && grep 'internal error:' "reports/$NAME/run-$I" > /dev/null; then + I=$((I+1)) + continue + fi + + if grep "$EMSG" "reports/$NAME/run-$I" > /dev/null; then + # we exited with the expected error message and without leaking + # memory, presume covsrv is happy as well + echo "OK" > reports/$NAME/OK + exit 0 + fi + + # incorrectly handled coverage exception, stop run + echo "MEMERR" > reports/$NAME/OK + exit 0 +done |
