[master] 9813d08 varnishtest -i builds vmod_path instead of macros
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Mon Feb 22 16:26:52 CET 2016
commit 9813d08597b72df14a9f0a2242326ec748b49dd3
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Sun Feb 21 19:31:55 2016 +0100
varnishtest -i builds vmod_path instead of macros
The macros are still here but ${vmod_std} is now expanded to std and so
on.
diff --git a/bin/varnishtest/tests/m00008.vtc b/bin/varnishtest/tests/m00008.vtc
index 9386ae9..8e93d58 100644
--- a/bin/varnishtest/tests/m00008.vtc
+++ b/bin/varnishtest/tests/m00008.vtc
@@ -15,7 +15,7 @@ varnish v1 -cliok "param.set vcc_unsafe_path off"
varnish v1 -errvcl {'import ... from path ...' is unsafe.} {
backend default { .host = "${s1_sock}"; }
- import ${vmod_std};
+ import std from "${topbuild}/lib/libvmod_std/.libs/";
}
varnish v1 \
diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index 69b9c0a..03ced80 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -94,6 +94,7 @@ static int vtc_good;
static int vtc_fail;
static char *tmppath;
static char *cwd = NULL;
+char *vmod_path = NULL;
int leave_temp;
int vtc_witness = 0;
int feature_dns;
@@ -130,7 +131,7 @@ usage(void)
fprintf(stderr, FMT, "-b size",
"Set internal buffer size (default: 512K)");
fprintf(stderr, FMT, "-D name=val", "Define macro");
- fprintf(stderr, FMT, "-i", "Find varnishd in build tree");
+ fprintf(stderr, FMT, "-i", "Find varnish binaries in build tree");
fprintf(stderr, FMT, "-j jobs", "Run this many tests in parallel");
fprintf(stderr, FMT, "-k", "Continue on test failure");
fprintf(stderr, FMT, "-L", "Always leave temporary vtc.*");
@@ -376,19 +377,22 @@ i_mode(void)
AZ(putenv(strdup(VSB_data(vsb))));
/*
- * Redefine VMOD macros
+ * Build vmod_path which can find all VMODs in the build tree
*/
+ VSB_clear(vsb);
+ sep = "";
#define VTC_VMOD(l) \
do { \
- VSB_clear(vsb); \
- VSB_printf(vsb, \
- "%s from \"%s/lib/libvmod_%s/.libs/libvmod_%s.so\"", \
- #l, topbuild, #l, #l); \
- AZ(VSB_finish(vsb)); \
- extmacro_def("vmod_" #l, "%s", VSB_data(vsb)); \
+ VSB_printf(vsb, "%s%s/lib/libvmod_" #l "/.libs", \
+ sep, topbuild); \
+ sep = ":"; \
+ extmacro_def("vmod_" #l, #l); \
} while (0);
#include "vmods.h"
#undef VTC_VMOD
+ AZ(VSB_finish(vsb));
+ vmod_path = strdup(VSB_data(vsb));
+ AN(vmod_path);
free(topbuild);
VSB_delete(vsb);
}
@@ -487,6 +491,8 @@ main(int argc, char * const *argv)
cwd = getcwd(NULL, PATH_MAX);
extmacro_def("pwd", "%s", cwd);
+ vmod_path = NULL;
+
setbuf(stdout, NULL);
setbuf(stderr, NULL);
while ((ch = getopt(argc, argv, "b:D:hij:kLln:qt:vW")) != -1) {
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index e81fe17..1757722 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -54,6 +54,7 @@
#include "vtim.h"
extern int leave_temp;
+extern char *vmod_path;
struct varnish {
unsigned magic;
@@ -419,6 +420,8 @@ varnish_launch(struct varnish *v)
VSB_printf(vsb, ",%s", v->proto);
VSB_printf(vsb, " -M '%s %s'", abuf, pbuf);
VSB_printf(vsb, " -P %s/varnishd.pid", v->workdir);
+ if (vmod_path != NULL)
+ VSB_printf(vsb, " -p vmod_path=%s", vmod_path);
VSB_printf(vsb, " %s", VSB_data(v->args));
AZ(VSB_finish(vsb));
vtc_log(v->vl, 3, "CMD: %s", VSB_data(vsb));
diff --git a/doc/sphinx/reference/varnishtest.rst b/doc/sphinx/reference/varnishtest.rst
index 057542e..d689929 100644
--- a/doc/sphinx/reference/varnishtest.rst
+++ b/doc/sphinx/reference/varnishtest.rst
@@ -36,7 +36,7 @@ The following options are available:
-h Show help
--i Set PATH to find varnish binaries in build tree
+-i Set PATH and vmod_path to find varnish binaries in build tree
-j jobs Run this many tests in parallel
More information about the varnish-commit
mailing list