1 #!/bin/bash 2 3 total=0 4 pass=0 5 6 echo "====== Testing optimization passes ======" 7 for test in `find . -iname '*.opt_test'`; do 8 echo -n "Testing $test..." 9 (cd `dirname "$test"`; ./`basename "$test"`) > "$test.out" 2>&1 10 total=$((total+1)) 11 if $PYTHON2 $PYTHON_FLAGS ./compare_ir "$test.expected" "$test.out" >/dev/null 2>&1; then 12 echo "PASS" 13 pass=$((pass+1)) 14 else 15 echo "FAIL" 16 $PYTHON2 $PYTHON_FLAGS ./compare_ir "$test.expected" "$test.out" 17 fi 18 done 19 20 echo "" 21 echo "$pass/$total tests returned correct results" 22 echo "" 23 24 if [[ $pass == $total ]]; then 25 exit 0 26 else 27 exit 1 28 fi 29