1.1 --- a/test_all.sh Thu Sep 08 22:49:00 2016 +0200
1.2 +++ b/test_all.sh Thu Sep 08 23:06:03 2016 +0200
1.3 @@ -1,5 +1,29 @@
1.4 #!/bin/sh
1.5
1.6 +# Expect failure from the "bad" tests.
1.7 +
1.8 +expect_failure() {
1.9 + return `echo "$FILENAME" | grep -q '_bad[._]'`
1.10 +}
1.11 +
1.12 +# Check deduction output for type warnings, indicating that the program contains
1.13 +# errors.
1.14 +
1.15 +check_type_warnings() {
1.16 +
1.17 + if [ -e "_deduced/type_warnings" ] && \
1.18 + [ `stat -c %s "_deduced/type_warnings"` -ne 0 ] && \
1.19 + ! expect_failure ; then
1.20 +
1.21 + echo "Type warnings in deduced information." 1>&2
1.22 + return 1
1.23 + fi
1.24 +
1.25 + return 0
1.26 +}
1.27 +
1.28 +# Main program.
1.29 +
1.30 for FILENAME in tests/* ; do
1.31
1.32 # Detect tests in their own subdirectories.
1.33 @@ -21,14 +45,24 @@
1.34
1.35 echo " (depends)..." 1>&2
1.36 if grep '<depends>' -r "_cache" && \
1.37 - ! echo "$FILENAME" | grep -q '_bad[._]' ; then
1.38 + ! expect_failure ; then
1.39 +
1.40 + echo "Unresolved names in the cache." 1>&2
1.41 exit 1
1.42 fi
1.43
1.44 + # Check for type warnings in deduction output.
1.45 +
1.46 + echo " (warnings)..." 1>&2
1.47 + if ! check_type_warnings ; then exit 1 ; fi
1.48 +
1.49 # Run tests with an existing cache.
1.50
1.51 echo " (cached)..." 1>&2
1.52 if ! ./lplc "$FILENAME" ; then exit 1 ; fi
1.53 - echo 1>&2
1.54
1.55 + echo " (warnings)..." 1>&2
1.56 + if ! check_type_warnings ; then exit 1 ; fi
1.57 +
1.58 + echo 1>&2
1.59 done