# HG changeset patch # User Paul Boddie # Date 1473368763 -7200 # Node ID 95831cd5b78689ef96ebcf070f34f8d4f69da2e0 # Parent da93e5c07c1f80eaa7524c365cca42aa429e93c8 Incorporated deduction output analysis into the test runner, also reorganising. diff -r da93e5c07c1f -r 95831cd5b786 test_all.sh --- a/test_all.sh Thu Sep 08 22:49:00 2016 +0200 +++ b/test_all.sh Thu Sep 08 23:06:03 2016 +0200 @@ -1,5 +1,29 @@ #!/bin/sh +# Expect failure from the "bad" tests. + +expect_failure() { + return `echo "$FILENAME" | grep -q '_bad[._]'` +} + +# Check deduction output for type warnings, indicating that the program contains +# errors. + +check_type_warnings() { + + if [ -e "_deduced/type_warnings" ] && \ + [ `stat -c %s "_deduced/type_warnings"` -ne 0 ] && \ + ! expect_failure ; then + + echo "Type warnings in deduced information." 1>&2 + return 1 + fi + + return 0 +} + +# Main program. + for FILENAME in tests/* ; do # Detect tests in their own subdirectories. @@ -21,14 +45,24 @@ echo " (depends)..." 1>&2 if grep '' -r "_cache" && \ - ! echo "$FILENAME" | grep -q '_bad[._]' ; then + ! expect_failure ; then + + echo "Unresolved names in the cache." 1>&2 exit 1 fi + # Check for type warnings in deduction output. + + echo " (warnings)..." 1>&2 + if ! check_type_warnings ; then exit 1 ; fi + # Run tests with an existing cache. echo " (cached)..." 1>&2 if ! ./lplc "$FILENAME" ; then exit 1 ; fi - echo 1>&2 + echo " (warnings)..." 1>&2 + if ! check_type_warnings ; then exit 1 ; fi + + echo 1>&2 done