diff options
author | Björn Persson <Bjorn@Rombobjörn.se> | 2013-12-19 09:29:59 +0100 |
---|---|---|
committer | Björn Persson <Bjorn@Rombobjörn.se> | 2013-12-19 09:29:59 +0100 |
commit | f06e5dc1665c288071ade1d403f7e7eb4275ae64 (patch) | |
tree | ed3d859170f3e2ccc1b8903b2af23b103b927410 | |
parent | cfde013bbd87fb30ced9c2c9fc4f0d1122c9c569 (diff) |
better failure reporting
-rwxr-xr-x | testsuite/run_tests | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/testsuite/run_tests b/testsuite/run_tests index 38d6562..35fcc23 100755 --- a/testsuite/run_tests +++ b/testsuite/run_tests @@ -37,6 +37,27 @@ export srcdir # testcase's source directory relative to testrundir export builddir # testcase's build directory relative to testrundir export relative_builddir # testcase's build directory relative to srcdir + +pass () { + # Report the current testcase as passed. + echo "${test_name}: PASSED" + passed=$((passed + 1)) +} + + +fail () { + # Report the current testcase as failed. + # Parameters: + # 1: a message about what went wrong + # 2: the name of a file with details about the error + echo "${test_name}: FAILED" + echo "$1" + cat "$2" + echo + failed=$((failed + 1)) +} + + # Clean out any old test results. rm -Rf "${outer_builddir}"/testruns @@ -82,24 +103,17 @@ for source_directory in "${outer_srcdir}"/testsuite/sources/* ; do fi done if [ -s "${testrundir}"/changed_sources ] ; then - verdict=FAILED + fail "Changed soure files:" "${testrundir}"/changed_sources else - verdict=PASSED + pass fi else - verdict=FAILED + fail "Difference from the list of expected files:" files.diff fi else - # The test returned an error code. - verdict=FAILED + fail "Error code: $?" output fi - if [ ${verdict} = PASSED ] ; then - passed=$((passed + 1)) - else - failed=$((failed + 1)) - fi - echo "${test_name}: ${verdict}" done done done |