run_all.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/bash
  2. # Run every check. Non-zero exit if anything fails.
  3. #
  4. # Four suites, in increasing order of "how much could be lying to me":
  5. #
  6. # 1. compile matrix 27 fixtures, verdict + code size + data size ASSERTED
  7. # from expected.tsv. Fast, no pty.
  8. # 2. .COM linker links every fixture, then re-verifies the bytes with an
  9. # independent checker that restates the layout constants
  10. # instead of asking the compiler.
  11. # 3. UI error path pty: W, C on a bad file, editor opens on the error,
  12. # Ctrl-K D, Q. Covers the shell behaviour that only
  13. # exists interactively.
  14. # 4. UI success path pty: Options -> Destination=COM, C, then the .COM is
  15. # checked ON DISK. This is the end-to-end path from
  16. # keystroke to artifact.
  17. #
  18. # RtProbe dumps the runtime size and its 14 entry offsets, so a
  19. # runtime change that moves an entry is visible here.
  20. #
  21. # rt_exec.py is NOT run: it needs Unicorn, whose 16-bit ModRM decoding is
  22. # wrong on this machine (see SUMMARY.md), so its failures would be the
  23. # emulator's, not the runtime's. Running it by default would be noise.
  24. set -u
  25. D=/home/eric/Projets/Projets-Modula2/MyWork/TP3-comp/shell
  26. GM2=/home/eric/bin/Modula2/Gm2/bin/gm2
  27. cd "$D" || exit 9
  28. fail=0
  29. run () {
  30. name=$1
  31. shift
  32. echo
  33. echo "=============================================================="
  34. echo "== $name"
  35. echo "=============================================================="
  36. if "$@" ; then
  37. echo "-- $name: PASS"
  38. else
  39. echo "-- $name: FAIL (rc=$?)"
  40. fail=1
  41. fi
  42. }
  43. echo "== build =="
  44. make clean >/dev/null 2>&1
  45. if ! make >/tmp/tp_all_mk 2>&1 ; then
  46. echo "BUILD FAIL"
  47. grep -m10 "error:" /tmp/tp_all_mk
  48. exit 1
  49. fi
  50. echo "make rc=0, tpshell $(stat -c%s tpshell) bytes"
  51. # gm2 reports a pass-3 rollup on the compiler during phase 1 of the two-phase
  52. # link; that is expected and is not a build failure (make rc=0 is the check).
  53. run "runtime probe" bash -c '
  54. GM2=/home/eric/bin/Modula2/Gm2/bin/gm2
  55. $GM2 -fiso -o /tmp/tp_rtprobe tests/RtProbe.mod Runtime.o Posix.o \
  56. >/tmp/tp_rt 2>&1 || { grep -m5 error: /tmp/tp_rt; exit 1; }
  57. /tmp/tp_rtprobe'
  58. run "compile matrix" tests/run_compile_tests.sh
  59. run "COM linker" tests/run_com_tests.sh
  60. run "UI error path" python3 tests/uitest.py
  61. run "UI success path" python3 tests/comtest.py
  62. echo
  63. echo "=============================================================="
  64. if [ "$fail" -eq 0 ]; then
  65. echo "OVERALL: ALL PASS"
  66. else
  67. echo "OVERALL: FAILURES PRESENT"
  68. fi
  69. echo "=============================================================="
  70. exit $fail