diff options
| author | schmonz <schmonz@NetBSD.org> | 2016-12-27 12:09:19 +0000 |
|---|---|---|
| committer | schmonz <schmonz@NetBSD.org> | 2016-12-27 12:09:19 +0000 |
| commit | 79f3b1ea5e1a296861574e329ab0640c3afcd22b (patch) | |
| tree | 0d1451674b4ed0201d69d4fcd79a36351aceb07d /libexec/httpd | |
| parent | fbd610b72d54c52649cd22c1f4eafc1b24379d0e (diff) | |
When testing non-verbosely, show diff on failure. ok mrg@
Diffstat (limited to 'libexec/httpd')
| -rwxr-xr-x | libexec/httpd/testsuite/html_cmp | 24 | ||||
| -rwxr-xr-x | libexec/httpd/testsuite/test-simple | 6 |
2 files changed, 19 insertions, 11 deletions
diff --git a/libexec/httpd/testsuite/html_cmp b/libexec/httpd/testsuite/html_cmp index 15931b0177d..5ec871d54d2 100755 --- a/libexec/httpd/testsuite/html_cmp +++ b/libexec/httpd/testsuite/html_cmp @@ -2,12 +2,20 @@ # # $eterna: html_cmp,v 1.9 2011/11/17 22:18:02 mrg Exp $ # -# like cmp(1) but compares to files after making their `Date: ' headers -# the same, to allow `now' and `then' to work properly. it also tries -# to find servername's that might be the local host and converts those -# as well.. +# like cmp(1)/diff(1) but compares to files after making their +# `Date: ' headers the same, to allow `now' and `then' to work properly. +# it also tries to find servername's that might be the local host and +# converts those as well.. # -# it must be called like `cmp file1 file1' *only*. +# it must be called like `html_cmp cmp|diff file1 file1' *only*. + +if [ "cmp" = "$1" ]; then + cmd="cmp -s" +elif [ "diff" = "$1" ]; then + cmd="diff -u" +else + exit 77 +fi h=`hostname || uname -n` @@ -17,10 +25,10 @@ sedcmd="s/^Date: .*/Date: nowish/; s/^Server: .*/^Server: bozotic HTTP server version 5.08/; s/^Content-Length: .*/Content-Length: 223/;" -sed -e "$sedcmd" < "$1" > "f1.tmp.$$" -sed -e "$sedcmd" < "$2" > "f2.tmp.$$" +sed -e "$sedcmd" < "$2" > "f1.tmp.$$" +sed -e "$sedcmd" < "$3" > "f2.tmp.$$" -cmp -s "f1.tmp.$$" "f2.tmp.$$" +${cmd} "f1.tmp.$$" "f2.tmp.$$" rv=$? rm -f "f1.tmp.$$" "f2.tmp.$$" diff --git a/libexec/httpd/testsuite/test-simple b/libexec/httpd/testsuite/test-simple index 73bced0c10a..58965a5e57a 100755 --- a/libexec/httpd/testsuite/test-simple +++ b/libexec/httpd/testsuite/test-simple @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: test-simple,v 1.2 2016/09/26 00:21:22 schmonz Exp $ +# $NetBSD: test-simple,v 1.3 2016/12/27 12:09:19 schmonz Exp $ test="$1" bozohttpd="$2" @@ -15,9 +15,9 @@ fi bozotestport=11111 ${bozohttpd} ${datadir} < $test.in > tmp.$test.out -if ./html_cmp $test.out tmp.$test.out; then +if ./html_cmp cmp $test.out tmp.$test.out; then exit 0 else - [ "yes" = "$verbose" ] || echo "Failed test $test: `cat tmp.$test.err; echo; cat $test.out`" + [ "yes" = "$verbose" ] || echo "Failed test $test: `cat tmp.$test.err; echo; ./html_cmp diff $test.out tmp.$test.out`" exit 1 fi |
