gdb_pretty_printer_test_run.sh 794 B

12345678910111213141516
  1. #!/usr/bin/env bash
  2. # Exit if anything fails
  3. set -e
  4. #!/usr/bin/env bash
  5. # Compile the test project with fresh debug information.
  6. nim c --debugger:native gdb_pretty_printer_test_program.nim &> /dev/null
  7. # 2>&1 redirects stderr to stdout (all output in stdout)
  8. # <(...) is a bash feature that makes the output of a command into a
  9. # file handle.
  10. # diff compares the two files, the expected output, and the file
  11. # handle that is created by the execution of gdb.
  12. diff ./gdb_pretty_printer_test_output.txt <(gdb -x gdb_pretty_printer_test.py --batch-silent --args gdb_pretty_printer_test_program 2>&1)
  13. # The exit code of diff is forwarded as the exit code of this
  14. # script. So when the comparison fails, the exit code of this script
  15. # won't be 0. So this script should be embeddable in a test suite.