Module Name: src
Committed By: schmonz
Date: Fri Sep 23 16:55:56 UTC 2016
Modified Files:
src/libexec/httpd/testsuite: Makefile test-bigfile
Added Files:
src/libexec/httpd/testsuite: test-simple
Log Message:
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@.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/libexec/httpd/testsuite/Makefile
cvs rdiff -u -r1.2 -r1.3 src/libexec/httpd/testsuite/test-bigfile
cvs rdiff -u -r0 -r1.1 src/libexec/httpd/testsuite/test-simple
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/libexec/httpd/testsuite/Makefile
diff -u src/libexec/httpd/testsuite/Makefile:1.5 src/libexec/httpd/testsuite/Makefile:1.6
--- src/libexec/httpd/testsuite/Makefile:1.5 Sun Dec 27 07:43:39 2015
+++ src/libexec/httpd/testsuite/Makefile Fri Sep 23 16:55:56 2016
@@ -7,26 +7,31 @@ BOZOHTTPD?= ../bozohttpd
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>
Index: src/libexec/httpd/testsuite/test-bigfile
diff -u src/libexec/httpd/testsuite/test-bigfile:1.2 src/libexec/httpd/testsuite/test-bigfile:1.3
--- src/libexec/httpd/testsuite/test-bigfile:1.2 Sun Dec 27 07:43:39 2015
+++ src/libexec/httpd/testsuite/test-bigfile Fri Sep 23 16:55:56 2016
@@ -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 @@ if cmp ./bigfile ${datadir}/bigfile; the
exit 0
else
rm -f ./bigfile
+ [ "yes" = "$verbose" ] || echo "Failed test $test: `cat tmp.$test.err`"
exit 1
fi
Added files:
Index: src/libexec/httpd/testsuite/test-simple
diff -u /dev/null src/libexec/httpd/testsuite/test-simple:1.1
--- /dev/null Fri Sep 23 16:55:56 2016
+++ src/libexec/httpd/testsuite/test-simple Fri Sep 23 16:55:56 2016
@@ -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