test_run_all_tutorials.sh 844 B

12345678910111213141516171819202122232425262728
  1. #!/bin/bash
  2. # Bazel should pass the location of tutorials on the command line. We convert
  3. # these into absolute paths so we can 'cd' into a temporary directory.
  4. #
  5. # Also note that while modern versions of `readlink` support multiple arguments,
  6. # old versions don't seem to.
  7. tutorials=($(for i in "$@"; do readlink -f "$i"; done))
  8. set -e
  9. # Note: This doesn't normally exist, and in fact no environment variables seem
  10. # to provide a substitute, but it may still be useful to provide as an override,
  11. # just in case /tmp is inacessible.
  12. mkdir -p "${TEST_TMPDIR:-/tmp/test-tutorials}"
  13. cd "${TEST_TMPDIR:-/tmp/test-tutorials}"
  14. rm -f *.html
  15. for tutorial in "${tutorials[@]}"; do
  16. "$tutorial"
  17. done
  18. for i in 1 2; do
  19. if ! [[ -f "dragnn_tutorial_$i.html" ]]; then
  20. echo "Expected dragnn_tutorial_$i.html to be written." >&2
  21. exit 1
  22. fi
  23. done