Commit 9813d085 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

varnishtest -i builds vmod_path instead of macros

The macros are still here but ${vmod_std} is now expanded to std and so
on.
parent 0a05e52c
......@@ -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 \
......
......@@ -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) {
......
......@@ -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));
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment