Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/httpd/testsuite When testing non-verbosely, show dif...
details: https://anonhg.NetBSD.org/src/rev/1a1a1d2ee187
branches: trunk
changeset: 349895:1a1a1d2ee187
user: schmonz <schmonz%NetBSD.org@localhost>
date: Tue Dec 27 12:09:19 2016 +0000
description:
When testing non-verbosely, show diff on failure. ok mrg@
diffstat:
libexec/httpd/testsuite/html_cmp | 24 ++++++++++++++++--------
libexec/httpd/testsuite/test-simple | 6 +++---
2 files changed, 19 insertions(+), 11 deletions(-)
diffs (65 lines):
diff -r 442240632908 -r 1a1a1d2ee187 libexec/httpd/testsuite/html_cmp
--- a/libexec/httpd/testsuite/html_cmp Tue Dec 27 11:59:36 2016 +0000
+++ b/libexec/httpd/testsuite/html_cmp Tue Dec 27 12:09:19 2016 +0000
@@ -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 @@
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 -r 442240632908 -r 1a1a1d2ee187 libexec/httpd/testsuite/test-simple
--- a/libexec/httpd/testsuite/test-simple Tue Dec 27 11:59:36 2016 +0000
+++ b/libexec/httpd/testsuite/test-simple Tue Dec 27 12:09:19 2016 +0000
@@ -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 @@
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
Home |
Main Index |
Thread Index |
Old Index