run.bash 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/usr/bin/env bash
  2. CIVAS=${CIVAS-../bin32/civas}
  3. CIVVM=${CIVVM-../bin32/civvm}
  4. CIVCC=${CIVCC-../civicc}
  5. REAL_CFLAGS="-v 1"
  6. TESTSUITE_CFLAGS=
  7. total_tests=0
  8. failed_tests=0
  9. # The real tests: compile a file, run it and compare the output to the
  10. # output of the reference compiler.
  11. for f in *.cvc
  12. do
  13. total_tests=$((total_tests+1))
  14. echo -n $f:" "
  15. if $CIVCC $REAL_CFLAGS -o tmp.s $f > tmp.out 2>&1 &&
  16. $CIVAS tmp.s -o tmp.o > tmp.out 2>&1 &&
  17. $CIVVM tmp.o > tmp.out 2>&1 &&
  18. mv tmp.out tmp.res &&
  19. diff tmp.res ${f%.*}.out --side-by-side --ignore-space-change > tmp.out 2>&1
  20. then
  21. echo success
  22. else
  23. echo failed
  24. echo -------------------------------
  25. cat tmp.out
  26. echo -------------------------------
  27. echo
  28. failed_tests=$((failed_tests+1))
  29. fi
  30. rm -f tmp.res tmp.s tmp.o tmp.out
  31. done
  32. # Tests from the testsuite. Only check if exit code of compiler equals 0.
  33. for f in testsuite/assignment/*.cvc testsuite/easy_test/*.cvc testsuite/functional_test/*.cvc
  34. do
  35. total_tests=$((total_tests+1))
  36. echo -n $f:" "
  37. if $CIVCC $TESTSUITE_CFLAGS $f -o tmp.s > /dev/null 2>&1
  38. then
  39. echo success
  40. else
  41. echo failed
  42. failed_tests=$((failed_tests+1))
  43. fi
  44. rm -f tmp.s
  45. done
  46. # Tests from the testsuite that must fail. Only check if exit code
  47. # of compiler does not equal 0.
  48. for f in testsuite/error_test/*.cvc
  49. do
  50. total_tests=$((total_tests+1))
  51. echo -n $f:" "
  52. if $CIVCC $TESTSUITE_CFLAGS $f -o tmp.s > /dev/null 2>&1
  53. then
  54. echo failed
  55. failed_tests=$((failed_tests+1))
  56. else
  57. echo success
  58. fi
  59. rm -f tmp.s
  60. done
  61. echo
  62. echo $total_tests tests, $failed_tests failures