2016-10-29 | Paul Boddie | raw annotate files changeset graph | Fixed attribute access numbering, local name assignments, and the generation of contexts in attributes obtained for static objects. Added return statements at the end of functions, avoiding superfluous statements if any return statement already exists. Introduced initial exception code generation and more reasonable boolean tests. Introduced #undef directives to undefine local names at the end of functions. Introduced more attribute access testing functions, making their results usable. Fixed lone access instruction arguments that are static objects, making them references. |
1 #!/bin/sh 2 3 # Expect failure from the "bad" tests. 4 5 expect_failure() { 6 return `echo "$FILENAME" | grep -q '_bad[._]'` 7 } 8 9 # Check deduction output for type warnings, indicating that the program contains 10 # errors. 11 12 check_type_warnings() { 13 14 if [ -e "_deduced/type_warnings" ] && \ 15 [ `stat -c %s "_deduced/type_warnings"` -ne 0 ] && \ 16 ! expect_failure ; then 17 18 echo "Type warnings in deduced information." 1>&2 19 return 1 20 fi 21 22 return 0 23 } 24 25 # Main program. 26 27 for FILENAME in tests/* ; do 28 29 # Detect tests in their own subdirectories. 30 31 if [ -d "$FILENAME" ] ; then 32 if [ -e "$FILENAME/main.py" ] ; then 33 FILENAME="$FILENAME/main.py" 34 else 35 continue 36 fi 37 fi 38 39 # Run tests without an existing cache. 40 41 echo "$FILENAME..." 1>&2 42 if ! ./lplc "$FILENAME" -r ; then exit 1 ; fi 43 44 # Check for unresolved names in the cache. 45 46 echo " (depends)..." 1>&2 47 if grep '<depends>' -r "_cache" && \ 48 ! expect_failure ; then 49 50 echo "Unresolved names in the cache." 1>&2 51 exit 1 52 fi 53 54 # Check for type warnings in deduction output. 55 56 echo " (warnings)..." 1>&2 57 if ! check_type_warnings ; then exit 1 ; fi 58 59 # Run tests with an existing cache. 60 61 echo " (cached)..." 1>&2 62 if ! ./lplc "$FILENAME" ; then exit 1 ; fi 63 64 echo " (warnings)..." 1>&2 65 if ! check_type_warnings ; then exit 1 ; fi 66 67 echo 1>&2 68 done