Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

48 wiersze
1.2 KiB

  1. #!/usr/bin/expect
  2. set SUGAR_EXECUTABLE $::env(SUGAR_EXECUTABLE)
  3. set BUILD_NAME 001
  4. proc abort {reason} {
  5. puts "test failed $reason"
  6. exit 1
  7. }
  8. spawn -noecho $SUGAR_EXECUTABLE tests/001/exit-with-1.mol lex parse
  9. expect {
  10. error { abort "failed to parse" }
  11. eof { abort "cannot find the main" }
  12. main
  13. }
  14. expect eof
  15. lassign [wait] pid spawnid os_error_flag value
  16. if {$value != 0} {
  17. abort "compiler crashed"
  18. }
  19. # -------------------------------------------------------------------
  20. spawn -noecho $SUGAR_EXECUTABLE tests/001/exit-with-1.mol lex parse "/tmp/sugar.generated.$BUILD_NAME" generate assemble
  21. expect {
  22. error { abort "failed to compile" }
  23. eof { abort "didn't run clang" }
  24. clang
  25. }
  26. expect {
  27. error { abort "failed to link" }
  28. eof { abort "didn't run ld" }
  29. ld
  30. }
  31. expect eof
  32. lassign [wait] pid spawnid os_error_flag value
  33. if {$value != 0} {
  34. abort "compiler crashed"
  35. }
  36. # -------------------------------------------------------------------
  37. spawn -noecho /tmp/sugar.generated.$BUILD_NAME
  38. expect eof
  39. lassign [wait] pid spawnid os_error_flag value
  40. if {$value != 1} {
  41. abort "executable didn't return exit code 1 but $value instead"
  42. }