From 96e5489117df5aefa72de229ab08eda82c8b8913 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Sun, 3 Aug 2008 15:13:34 +0000 Subject: [PATCH] Allow tests to indicate that they have been skipped by printing their own message and returning with exit status 120. --- test/README | 9 ++++++++- test/runtest | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/test/README b/test/README index ddfa381..c61647e 100644 --- a/test/README +++ b/test/README @@ -3,7 +3,14 @@ nmh unit test suite. The purpose of these tests is to verify the functionality of the nmh commands. The goal of the suite is to create an environment where testing nmh commands is easy and useful. Each test is a shell script, and is -launched via the 'sh' command. +launched via the 'sh' command. The script should run the test and report +the result by one of: + + * for a test pass: exit with status 0 + * where a test has been skipped (perhaps because it depends on an + external program which can't be found): print "Test $0 SKIP (reason)" + and exit with status 120 + * for a test fail: exit with some status other than 0 or 120 The Suite is arranged as such: diff --git a/test/runtest b/test/runtest index 3d7a92b..21feb73 100755 --- a/test/runtest +++ b/test/runtest @@ -29,6 +29,11 @@ return_value=$? if [ $return_value -eq 0 ] ; then echo Test $1 PASS +elif [ $return_value -eq 120 ]; then + # indicates test was skipped (eg needed program not found) + # test itself should have printed a message about this, + # so print nothing here. + : else echo Test $1 FAIL fi -- 1.7.10.4