| 1 | #!/bin/bash |
| 2 | |
| 3 | bad= |
| 4 | |
| 5 | set -o pipefail |
| 6 | if ! valgrind --error-exitcode=1 --leak-check=full \ |
| 7 | ./testsuite 2>&1 >testsuite.out | tee testsuite.err; then |
| 8 | echo >&2 'Memory errors!' |
| 9 | bad=1 |
| 10 | fi |
| 11 | |
| 12 | if grep 'LEAK SUMMARY' testsuite.err >/dev/null; then |
| 13 | echo >&2 'Memory leaks!' |
| 14 | bad=1 |
| 15 | fi |
| 16 | |
| 17 | if ! diff -u testsuite.expected testsuite.out; then |
| 18 | echo >&2 'Output is incorrect!' |
| 19 | bad=1 |
| 20 | fi |
| 21 | |
| 22 | if [ $bad ]; then |
| 23 | echo >&2 'Test suite failed!' |
| 24 | exit 1 |
| 25 | else |
| 26 | echo 'Test suite succeeded.' |
| 27 | fi |