diff --git a/tools/regression/README b/tools/regression/README index 94ecb62a85dd..bb2a2796803a 100644 --- a/tools/regression/README +++ b/tools/regression/README @@ -5,7 +5,13 @@ This directory is for regression test programs. A regression test program is one that will exercise a particular bit of the system to check that we have not reintroduced an old bug. -Please make a subdir per program, and add a brief description to this file. +Tests that are for parts of the base system should go into a directory here +which is the same as their path relative to src/, for example the uuencode(1) +utility resides in src/usr.bin/uuencode so its regression test resides in +src/tools/regression/usr.bin/uuencode. + +Please make a subdir per other regression test, and add a brief description to +this file. nfsmmap Some tests to exercise some tricky cases in NFS and mmap p1003_1b Exercise 1003.1B scheduler diff --git a/tools/regression/usr.bin/Makefile b/tools/regression/usr.bin/Makefile new file mode 100644 index 000000000000..cf08fbae94e0 --- /dev/null +++ b/tools/regression/usr.bin/Makefile @@ -0,0 +1,5 @@ +# $FreeBSD$ + +SUBDIR= uudecode uuencode + +.include diff --git a/tools/regression/usr.bin/uudecode/Makefile b/tools/regression/usr.bin/uudecode/Makefile new file mode 100644 index 000000000000..99036706a818 --- /dev/null +++ b/tools/regression/usr.bin/uudecode/Makefile @@ -0,0 +1,4 @@ +# $FreeBSD$ + +all: + @sh ${.CURDIR}/regress.sh ${.CURDIR} diff --git a/tools/regression/usr.bin/uudecode/regress.sh b/tools/regression/usr.bin/uudecode/regress.sh new file mode 100644 index 000000000000..36e224a9d185 --- /dev/null +++ b/tools/regression/usr.bin/uudecode/regress.sh @@ -0,0 +1,19 @@ +# $FreeBSD$ + +# Go into the regression test directory, handed to us by make(1) +TESTDIR=$1 +if [ -z "$TESTDIR" ]; then + TESTDIR=. +fi +cd $TESTDIR + +for test in traditional base64; do + echo "Running test $test" + uudecode -p < regress.$test.in | cmp regress.out - + if [ $? -eq 0 ]; then + echo "Test $test detected no regression, output matches." + else + echo "Test $test failed: regression detected. See above." + exit 1 + fi +done diff --git a/tools/regression/usr.bin/uuencode/Makefile b/tools/regression/usr.bin/uuencode/Makefile new file mode 100644 index 000000000000..99036706a818 --- /dev/null +++ b/tools/regression/usr.bin/uuencode/Makefile @@ -0,0 +1,4 @@ +# $FreeBSD$ + +all: + @sh ${.CURDIR}/regress.sh ${.CURDIR} diff --git a/tools/regression/usr.bin/uuencode/regress.sh b/tools/regression/usr.bin/uuencode/regress.sh new file mode 100644 index 000000000000..bf5b563f6e47 --- /dev/null +++ b/tools/regression/usr.bin/uuencode/regress.sh @@ -0,0 +1,26 @@ +# $FreeBSD$ + +# Go into the regression test directory, handed to us by make(1) +TESTDIR=$1 +if [ -z "$TESTDIR" ]; then + TESTDIR=. +fi +cd $TESTDIR + +for test in traditional base64; do + echo "Running test $test" + case "$test" in + traditional) + uuencode regress.in regress.in | diff -u regress.$test.out - + ;; + base64) + uuencode -m regress.in regress.in | diff -u regress.$test.out - + ;; + esac + if [ $? -eq 0 ]; then + echo "Test $test detected no regression, output matches." + else + echo "Test $test failed: regression detected. See above." + exit 1 + fi +done