Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. #!/usr/bin/env bash
  2.  
  3. if [ ! -z "$srcdir" ]; then
  4.    compare_ir=`pwd`/tests/compare_ir
  5. else
  6.    compare_ir=./compare_ir
  7. fi
  8.  
  9. total=0
  10. pass=0
  11.  
  12. echo "======       Generating tests      ======"
  13. for dir in tests/*/; do
  14.     if [ -e "${dir}create_test_cases.py" ]; then
  15.         cd $dir; $PYTHON2 create_test_cases.py; cd ..
  16.     fi
  17.     echo "$dir"
  18. done
  19.  
  20. echo "====== Testing optimization passes ======"
  21. for test in `find . -iname '*.opt_test'`; do
  22.     echo -n "Testing $test..."
  23.     (cd `dirname "$test"`; ./`basename "$test"`) > "$test.out" 2>&1
  24.     total=$((total+1))
  25.     if $PYTHON2 $PYTHON_FLAGS $compare_ir "$test.expected" "$test.out" >/dev/null 2>&1; then
  26.         echo "PASS"
  27.         pass=$((pass+1))
  28.     else
  29.         echo "FAIL"
  30.         $PYTHON2 $PYTHON_FLAGS $compare_ir "$test.expected" "$test.out"
  31.     fi
  32. done
  33.  
  34. echo ""
  35. echo "$pass/$total tests returned correct results"
  36. echo ""
  37.  
  38. if [[ $pass == $total ]]; then
  39.     exit 0
  40. else
  41.     exit 1
  42. fi
  43.