aboutsummaryrefslogtreecommitdiff
path: root/tools/regression/usr.bin
diff options
context:
space:
mode:
authorJuli Mallett <jmallett@FreeBSD.org>2002-06-25 12:40:04 +0000
committerJuli Mallett <jmallett@FreeBSD.org>2002-06-25 12:40:04 +0000
commit7afbc0985ee71a94950f406d60929b0a479d62c0 (patch)
treee7f4b768fac4497a16fd33cd87f9eaa1e9147d9e /tools/regression/usr.bin
parent8c08ccea2983b64bc9b35d60c0b1f9afb97051ce (diff)
downloadsrc-7afbc0985ee71a94950f406d60929b0a479d62c0.tar.gz
src-7afbc0985ee71a94950f406d60929b0a479d62c0.zip
Reduce internal code duplication, add REGRESSION_PASSFAIL([testname]) to
handle printing of the PASS/FAIL messages. Suffix PASS/FAIL/FATAL with the string (in $directory) where $directory is ${.CURDIR} from make(1), to make it easier to use grep(1) and a bit of sed/awk to do statistics of failure for some utilities over time, etc.
Notes
Notes: svn path=/head/; revision=98812
Diffstat (limited to 'tools/regression/usr.bin')
-rw-r--r--tools/regression/usr.bin/regress.m433
1 files changed, 14 insertions, 19 deletions
diff --git a/tools/regression/usr.bin/regress.m4 b/tools/regression/usr.bin/regress.m4
index 79f0968573f7..8a4551c69607 100644
--- a/tools/regression/usr.bin/regress.m4
+++ b/tools/regression/usr.bin/regress.m4
@@ -14,6 +14,16 @@ cd $TESTDIR
STATUS=0)
+dnl Check $? to see if we passed or failed. The first parameter is the test
+dnl which passed or failed. It may be nil.
+define(`REGRESSION_PASSFAIL',
+if [ $? -eq 0 ]; then
+ echo "PASS: Test $1 detected no regression. (in $TESTDIR)"
+else
+ STATUS=$?
+ echo "FAIL: Test $1 failed: regression detected. See above. (in $TESTDIR)"
+fi)
+
dnl An actual test. The first parameter is the test name. The second is the
dnl command/commands to execute for the actual test. Their exit status is
dnl checked. It is assumed that the test will output to stdout, and that the
@@ -21,22 +31,12 @@ dnl output to be used to check for regression will be in regress.TESTNAME.out.
define(`REGRESSION_TEST',
echo "Running test $1"
$2 | diff -u regress.$1.out -
-if [ $? -eq 0 ]; then
- echo "PASS: Test $1 detected no regression."
-else
- STATUS=$?
- echo "FAIL: Test $1 failed: regression detected. See above."
-fi)
+REGRESSION_PASSFAIL($1))
dnl A freeform regression test. Only exit status is checked.
define(`REGRESSION_TEST_FREEFORM',
$2
-if [ $? -eq 0 ]; then
- echo "PASS: Test $1 detected no regression."
-else
- STATUS=$?
- echo "FAIL: Test $1 failed: regression detected. See above."
-fi)
+REGRESSION_PASSFAIL($1))
dnl A regression test like REGRESSION_TEST, except only regress.out is used
dnl for checking output differences. The first argument is the command, the
@@ -44,18 +44,13 @@ dnl second argument (which may be empty) is the test name.
define(`REGRESSION_TEST_ONE',
echo "Running test $2"
$1 | diff -u regress.out -
-if [ $? -eq 0 ]; then
- echo "PASS: Test $2 detected no regression."
-else
- STATUS=$?
- echo "FAIL: Test $2 failed: regression detected. See above."
-fi)
+REGRESSION_PASSFAIL($2))
dnl A fatal error. This will exit with the given status (first argument) and
dnl print the message (second argument) prefixed with the string "FATAL :" to
dnl the error stream.
define(`REGRESSION_FATAL',
-echo "FATAL: $2" > /dev/stderr
+echo "FATAL: $2 (in $TESTDIR)" > /dev/stderr
exit $1)
dnl Cleanup. Exit with the status code of the last failure. Should probably