Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/httpd/testsuite Add a VERBOSE knob to the testsuite ...



details:   https://anonhg.NetBSD.org/src/rev/44e2a468b7ed
branches:  trunk
changeset: 347928:44e2a468b7ed
user:      schmonz <schmonz%NetBSD.org@localhost>
date:      Fri Sep 23 16:55:56 2016 +0000

description:
Add a VERBOSE knob to the testsuite ("yes" by default, producing
basically the same output as before). When turned off, tests run
silently except when there's a failure.

Reviewed by mrg@.

diffstat:

 libexec/httpd/testsuite/Makefile     |  19 ++++++++++++-------
 libexec/httpd/testsuite/test-bigfile |   9 +++++++++
 libexec/httpd/testsuite/test-simple  |  22 ++++++++++++++++++++++
 3 files changed, 43 insertions(+), 7 deletions(-)

diffs (96 lines):

diff -r 35e0d04bb07d -r 44e2a468b7ed libexec/httpd/testsuite/Makefile
--- a/libexec/httpd/testsuite/Makefile  Fri Sep 23 14:16:32 2016 +0000
+++ b/libexec/httpd/testsuite/Makefile  Fri Sep 23 16:55:56 2016 +0000
@@ -7,26 +7,31 @@
 BOZOHTTPD?=    ../debug/bozohttpd-debug
 WGET?=         wget
 DATA?=         $(.CURDIR)/data 
+VERBOSE?=      yes
+
+.if ${VERBOSE} != "yes"
+SILENT=                @
+.else
+SILENT=
+.endif
+
 all:
 
 clean:
-       for a in $(SIMPLETESTS); do \
-               rm -f tmp.$$a.out; \
+       for a in $(SIMPLETESTS) $(BIGFILETESTS); do \
+               rm -f tmp.$$a.out tmp.$$a.err; \
        done
 
 check: check-simple check-bigfile
 
 check-simple:
 .for a in $(SIMPLETESTS)
-       echo "Running test $a"
-       $(BOZOHTTPD) "$(DATA)" < $(.CURDIR)/$a.in > tmp.$a.out || true
-       $(.CURDIR)/html_cmp $(.CURDIR)/$a.out tmp.$a.out
+       ${SILENT}$(.CURDIR)/test-simple "$a" "${BOZOHTTPD}" "${DATA}" "${VERBOSE}"
 .endfor
 
 check-bigfile:
 .for a in $(BIGFILETESTS)
-       echo "Running test $a"
-       $(.CURDIR)/test-bigfile "$a" "${BOZOHTTPD}" "${WGET}" "$(DATA)"
+       ${SILENT}$(.CURDIR)/test-bigfile "$a" "${BOZOHTTPD}" "${WGET}" "${DATA}" "${VERBOSE}"
 .endfor
 
 .include <bsd.obj.mk>
diff -r 35e0d04bb07d -r 44e2a468b7ed libexec/httpd/testsuite/test-bigfile
--- a/libexec/httpd/testsuite/test-bigfile      Fri Sep 23 14:16:32 2016 +0000
+++ b/libexec/httpd/testsuite/test-bigfile      Fri Sep 23 16:55:56 2016 +0000
@@ -1,9 +1,17 @@
 #! /bin/sh
+# $NetBSD: test-bigfile,v 1.3 2016/09/23 16:55:56 schmonz Exp $
 
 test="$1"      # partial4000 or partial8000
 bozohttpd="$2"
 wget="$3"
 datadir="$4"
+verbose="$5"
+
+if [ "yes" = "$verbose" ]; then
+       echo "Running test $test"
+else
+       exec 2>tmp.$test.err
+fi
 
 bozotestport=11111
 
@@ -23,5 +31,6 @@
        exit 0
 else
        rm -f ./bigfile
+       [ "yes" = "$verbose" ] || echo "Failed test $test: `cat tmp.$test.err`"
        exit 1
 fi
diff -r 35e0d04bb07d -r 44e2a468b7ed libexec/httpd/testsuite/test-simple
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/libexec/httpd/testsuite/test-simple       Fri Sep 23 16:55:56 2016 +0000
@@ -0,0 +1,22 @@
+#! /bin/sh
+# $NetBSD: test-simple,v 1.1 2016/09/23 16:55:56 schmonz Exp $
+
+test="$1"
+bozohttpd="$2"
+datadir="$3"
+verbose="$4"
+
+if [ "yes" = "$verbose" ]; then
+       echo "Running test $test"
+else
+       exec 2>tmp.$test.err
+fi
+
+bozotestport=11111
+
+${bozohttpd} ${datadir} < $test.in > tmp.$test.out
+if ./html_cmp $test.out tmp.$test.out; then
+       exit 0
+else
+       [ "yes" = "$verbose" ] || echo "Failed test $test: `cat tmp.$test.err; echo; cat $test.out`"
+fi



Home | Main Index | Thread Index | Old Index