Skip to content

Commit

Permalink
CN: upgrade test-runner script
Browse files Browse the repository at this point in the history
Will produce complete output even if a test fails.
  • Loading branch information
talsewell committed Aug 16, 2023
1 parent b1f9e61 commit c096ea9
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions tests/run-cn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,49 @@

DIRNAME=$(dirname $0)

set -e

SUCC=$(find $DIRNAME/cn -name '*.c' | grep -v '\.error\.c' | grep -v '\.unknown\.c')

NUM_FAILED=0
FAILED=''

for TEST in $SUCC
do
echo cn $TEST
cn $TEST
if ! cn $TEST
then
NUM_FAILED=$(( $NUM_FAILED + 1 ))
FAILED="$FAILED $TEST"
fi
done

FAIL=$(find $DIRNAME/cn -name '*.error.c')

for TEST in $FAIL
do
echo cn --expect-fail $TEST
cn --expect-failure $TEST
if ! cn --expect-failure $TEST
then
NUM_FAILED=$(( $NUM_FAILED + 1 ))
FAILED="$FAILED $TEST"
fi
done

echo "All tests passed."
UNKNOWN=$(find $DIRNAME/cn -name '*.unknown.c')

echo $UNKNOWN | xargs -n 1 cn

echo
echo 'Done running tests.'
echo

if [ -z "$FAILED" ]
then
echo "All tests passed."
exit 0
else
echo "$NUM_FAILED tests failed:"
echo " $FAILED"
exit 1
fi

return 0

0 comments on commit c096ea9

Please sign in to comment.