test-guild-compile 731 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. #
  3. # This -*- sh -*- script tests whether 'guild compile' leaves traces
  4. # behind it upon SIGINT.
  5. source="t-guild-compile-$$"
  6. target="$source.go"
  7. trap 'rm -f "$source" "$target"' EXIT
  8. cat > "$source"<<EOF
  9. (eval-when (expand load eval)
  10. (sleep 100))
  11. (define chbouib 42)
  12. EOF
  13. guild compile -o "$target" "$source" &
  14. pid="$!"
  15. # Send SIGINT.
  16. sleep 2 && kill -INT "$pid"
  17. # Wait for 'guild compile' to terminate.
  18. sleep 2
  19. # Check whether there are any leftovers.
  20. for file in "$target"*
  21. do
  22. if test "$file" != "${target}*"
  23. then
  24. echo "error: 'guild compile' failed to remove '$file'" >&2
  25. rm "$target"*
  26. kill "$pid"
  27. exit 1
  28. fi
  29. done
  30. if test -f "$target"
  31. then
  32. echo "error: '$target' produced" >&2
  33. exit 1
  34. fi