[4.1] ab0977d allow whitespace and comments before the varnishtest marker
Lasse Karstensen
lkarsten at varnish-software.com
Tue Jun 14 11:42:10 CEST 2016
commit ab0977dc3660dc52238442e029775d8cb8a1c871
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 1db058c..ee87d09 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)
@@ -530,6 +531,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