summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@colm.net>2019-12-29 15:41:29 +0200
committerAdrian Thurston <thurston@colm.net>2019-12-29 15:50:13 +0200
commit42e180759b47e71df1c292894b360db88a5b0b66 (patch)
treefb572acf8b593348c8d465251fcf4bc0a7f106fc /test
parenta0c5737f8452816c9a2ca2c91f4a3d889334ac97 (diff)
downloadcolm-42e180759b47e71df1c292894b360db88a5b0b66.tar.gz
colm testing: default expected output, report compilation failures
1. If there are no expected output sections then default a section to empty and run at least one pass. 2. If the compilation failed then report this explicitly in the diff. This avoids the case accidentally passing due to an empty expected output. refs #96
Diffstat (limited to 'test')
-rw-r--r--test/colm.d/collect.lm2
-rw-r--r--test/colm.d/gentests.sh16
2 files changed, 12 insertions, 6 deletions
diff --git a/test/colm.d/collect.lm b/test/colm.d/collect.lm
index a0f3b7e8..c07549f7 100644
--- a/test/colm.d/collect.lm
+++ b/test/colm.d/collect.lm
@@ -1,3 +1,5 @@
Stream: stream = new stream()
send Stream "hello"
print [Stream->tree "\n"]
+##### EXP #####
+hello
diff --git a/test/colm.d/gentests.sh b/test/colm.d/gentests.sh
index 61940ec8..9198633b 100644
--- a/test/colm.d/gentests.sh
+++ b/test/colm.d/gentests.sh
@@ -227,9 +227,7 @@ function runtests()
else
# Compilation.
echo $COLM_BIN $COMP $COLM_ADDS $LM '&>' $LOG >> $SH
- #if ! check_compilation $?; then
- # continue
- #fi
+ echo "if [ \$? != 0 ]; then echo \"COMPILATION FAILED (see $LOG)\" >> $DIFF; fi" >> $SH
fi
Nth=0
@@ -240,9 +238,15 @@ function runtests()
section EXP $Nth $TST $EXP
- # Stop when we have no Nth expected output.
+ # Stop when we have no Nth expected output, unless, there were no
+ # expected outputs at all. In that case we continue to run with an
+ # empty expected output.
if [ '!' -f $EXP ]; then
- break;
+ if [ $Nth == 0 ]; then
+ echo -n > $EXP
+ else
+ break;
+ fi
fi
section ARGS $Nth $TST $ARGS
@@ -276,7 +280,7 @@ function runtests()
EOF
# Diff of output
- echo diff -u $EXP $OUT '>' $DIFF >> $SH
+ echo diff -u $EXP $OUT '>>' $DIFF >> $SH
#if [ $? != 0 ]; then
# echo "FAILED: output differs from expected output"
# ERRORS=$(( ERRORS + 1 ))