[master] 7dec122 allow whitespace and comments before the varnishtest marker

Nils Goroll nils.goroll at uplex.de
Fri May 13 12:32:06 CEST 2016


commit 7dec1221ebae2e66f7be81c0311491ed0f684912
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri May 13 08:05:31 2016 +0200

    allow whitespace and comments before the varnishtest marker

diff --git a/bin/varnishtest/tests/a00000.vtc b/bin/varnishtest/tests/a00000.vtc
index ca02903..d3fe2fd 100644
--- a/bin/varnishtest/tests/a00000.vtc
+++ b/bin/varnishtest/tests/a00000.vtc
@@ -1,3 +1,6 @@
+# the first token in a varnishtest file must be "varnishtest",
+ 	# but whitespace and comments are fine
+
 varnishtest "basic default HTTP transactions"
 
 server s1 {
diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index 2b32551..be8fabf 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -55,6 +55,7 @@
 #include "vsub.h"
 #include "vtcp.h"
 #include "vtim.h"
+#include "vct.h"
 
 #define		MAX_FILESIZE		(1024 * 1024)
 
@@ -569,6 +570,19 @@ main(int argc, char * const *argv)
 				continue;
 			exit(2);
 		}
+		while (1) {
+			if (vct_islws(*p)) {
+				p++;
+				continue;
+			}
+			if (*p == '#') {
+				if ((p = strchr(p, '\n')))
+					p++;
+				continue;
+			}
+			break;
+		}
+
 		if (strncmp(p, "varnishtest", 11) || !isspace(p[11])) {
 			fprintf(stderr, "File \"%s\" doesn't start with 'varnishtest'\n",
 			    *argv);



More information about the varnish-commit mailing list