diff options
author | Adrian Thurston <thurston@colm.net> | 2019-10-16 10:43:04 -0300 |
---|---|---|
committer | Adrian Thurston <thurston@colm.net> | 2019-10-16 10:43:04 -0300 |
commit | d605f733cd8b0f7e6efa93317060135418fbccc9 (patch) | |
tree | 914324305045a4951091ec5f724efe8bc2cc3818 /test/ragel.d | |
parent | 605ca5e59fc2fc309771bffc06819a06c7a8696e (diff) | |
download | colm-d605f733cd8b0f7e6efa93317060135418fbccc9.tar.gz |
testing: capture errors from gentests and emit at end of run
Diffstat (limited to 'test/ragel.d')
-rw-r--r-- | test/ragel.d/gentests.sh | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/test/ragel.d/gentests.sh b/test/ragel.d/gentests.sh index 41603ecd..2c40ee9c 100644 --- a/test/ragel.d/gentests.sh +++ b/test/ragel.d/gentests.sh @@ -42,6 +42,7 @@ trap sig_exit SIGTERM wk=working test -d $wk || mkdir $wk +echo $wk/* | xargs rm -Rf while getopts "gcnmleT:F:W:G:P:CDJRAZOUKY-:" opt; do case $opt in @@ -79,6 +80,9 @@ while getopts "gcnmleT:F:W:G:P:CDJRAZOUKY-:" opt; do ;; esac ;; + ?) + exit 1; + ;; esac done @@ -380,6 +384,7 @@ function run_translate() { test_case=$1 + # Recompute the root. root=`basename $test_case` root=${root%.rl}; @@ -405,7 +410,7 @@ function run_translate() # If the test case has a directory by the same name, copy it into the # working direcotory. if [ -d $root ]; then - cp -a $root working/ + cp -a $root $wk/ fi expected_out=$wk/$root.exp; @@ -421,7 +426,7 @@ function run_translate() lang=`sed '/@LANG:/s/^.*: *//p;d' $test_case` if [ -z "$lang" ]; then echo "$test_case: language unset"; >&2 - exit 1; + continue fi cases="" @@ -472,10 +477,21 @@ function run_translate() go() { + # Before we generate and test cases verify that all files exist. It is nice + # to catch this early. + for test_case; do + if ! [ -f $test_case ]; then + echo "$test_case: could not find file" >&2 + missing_file=true + + fi + done + + [ "$missing_file" = true ] && exit 1; + for test_case; do run_translate $test_case done } -echo working/* | xargs rm -Rf go "$@" |