[master] 530cb4c Report testfiles without "varnishtest" as skipped.

Poul-Henning Kamp phk at FreeBSD.org
Thu Jan 19 18:30:06 CET 2017


commit 530cb4c00c1e0282d6867dacdc0faa977b239ebe
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Jan 19 17:29:19 2017 +0000

    Report testfiles without "varnishtest" as skipped.
    
    Have varnishtest test varnishtest (don't look!)

diff --git a/bin/varnishtest/programs.h b/bin/varnishtest/programs.h
index 1bc85c8..4849005 100644
--- a/bin/varnishtest/programs.h
+++ b/bin/varnishtest/programs.h
@@ -33,5 +33,6 @@ VTC_PROG(varnishhist)
 VTC_PROG(varnishlog)
 VTC_PROG(varnishncsa)
 VTC_PROG(varnishstat)
+VTC_PROG(varnishtest)
 VTC_PROG(varnishtop)
 #undef VTC_PROG
diff --git a/bin/varnishtest/tests/a00000.vtc b/bin/varnishtest/tests/a00000.vtc
index eb42f48..8c3c17c 100644
--- a/bin/varnishtest/tests/a00000.vtc
+++ b/bin/varnishtest/tests/a00000.vtc
@@ -1,21 +1,27 @@
-# the first token in a varnishtest file must be "varnishtest",
-    # but whitespace (SP)
-	# and (TAB) and comments are fine
+varnishtest "Test varnishtest itself"
 
-varnishtest "basic default HTTP transactions"
+shell -exit 1 -expect {usage: varnishtest} {varnishtest -h}
 
-server s1 {
-	rxreq
-	txresp
+shell {
+	pwd
+	echo 'notvarnishtest foo bar' > _.vtc
+	echo 'shell "exit 9"' >> _.vtc
 }
 
-server s1 -start
+shell -exit 2 -expect {doesn't start with 'varnishtest'} {
+	varnishtest -v _.vtc
+}
 
-client c1 -connect ${s1_sock} {
-	txreq
-	rxresp
+shell -exit 77 -expect {0 tests failed, 1 tests skipped, 0 tests passed} {
+	unset TMPDIR
+	varnishtest -k _.vtc
 }
 
-client c1 -run
+# Test external macro-def with a a two-turtle test
+shell -expect {__=barf} {
+	echo varnishtest foo > _.vtc
+	printf 'shell {echo %c{foobar} > ${tmpdir}/__}' '$'  >> _.vtc
+	varnishtest -q -Dfoobar=barf _.vtc
+	echo __=`cat __`
+}
 
-server s1 -wait
diff --git a/bin/varnishtest/tests/a00001.vtc b/bin/varnishtest/tests/a00001.vtc
index fd2ea9c..e15969e 100644
--- a/bin/varnishtest/tests/a00001.vtc
+++ b/bin/varnishtest/tests/a00001.vtc
@@ -1,3 +1,6 @@
+# the first token in a varnishtest file must be "varnishtest",
+    # but whitespace (SP)
+	# and (TAB) and comments are fine
 varnishtest "basic default HTTP transactions with expect"
 
 server s1 {
diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index 7cdf3fc..c18f355 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -544,6 +544,7 @@ read_file(const char *fn, int ntest)
 		fprintf(stderr,
 		    "File \"%s\" doesn't start with 'varnishtest'\n", fn);
 		free(p);
+		vtc_skip++;
 		return(2);
 	}
 	ALLOC_OBJ(tp, TST_MAGIC);



More information about the varnish-commit mailing list