When testing non-verbosely, show diff on failure. ok mrg@
This commit is contained in:
parent
3b04d6a086
commit
10c3be53a3
|
@ -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.$$"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue