[master] 687c340 Define a "vmod_xxx" macro for each vmod and redefine it suitably when -i is given.
Poul-Henning Kamp
phk at varnish-cache.org
Mon Nov 11 23:15:01 CET 2013
commit 687c340d554813ade74a75da227235b893942caf
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Nov 11 22:12:35 2013 +0000
Define a "vmod_xxx" macro for each vmod and redefine it suitably
when -i is given.
This allows the testcases to be written:
import ${vmod_directors};
Add a feature for ${topbuild} and test it in the remaining to tests
which use ${topbuild}. I don't see any obvious way to write those
two cases without needing ${topbuild}.
I belive we are now very close to being able to run our testcases
out of tree.
diff --git a/bin/varnishtest/flint.lnt b/bin/varnishtest/flint.lnt
index 3b39af7..8f22c47 100644
--- a/bin/varnishtest/flint.lnt
+++ b/bin/varnishtest/flint.lnt
@@ -28,3 +28,5 @@
-e786 // String concatenation within initializer
-e788 // enum value not used in defaulted switch
+-efile(451, vmods.h)
+-efile(451, programs.h)
diff --git a/bin/varnishtest/tests/b00016.vtc b/bin/varnishtest/tests/b00016.vtc
index 17fef23..fc2478e 100644
--- a/bin/varnishtest/tests/b00016.vtc
+++ b/bin/varnishtest/tests/b00016.vtc
@@ -21,7 +21,7 @@ client c1 {
} -run
varnish v1 -vcl {
- import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ;
+ import ${vmod_directors};
backend b1 {
.host = "${bad_ip}"; .port = "9080";
@@ -48,7 +48,7 @@ client c1 {
} -run
varnish v1 -vcl {
- import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ;
+ import ${vmod_directors};
backend b1 {
.host = "${bad_ip}"; .port = "9080";
}
diff --git a/bin/varnishtest/tests/c00044.vtc b/bin/varnishtest/tests/c00044.vtc
index f7b4f38..fb415eb 100644
--- a/bin/varnishtest/tests/c00044.vtc
+++ b/bin/varnishtest/tests/c00044.vtc
@@ -21,7 +21,7 @@ varnish v1 \
-arg "-smalloc,1m" \
-arg "-smalloc,1m" \
-arg "-smalloc,1m" \
- -vcl+backend {
+ -vcl+backend {
sub vcl_backend_response {
set beresp.do_stream = false;
set beresp.storage = "invalid";
diff --git a/bin/varnishtest/tests/m00000.vtc b/bin/varnishtest/tests/m00000.vtc
index c4f1286..5704a1f 100644
--- a/bin/varnishtest/tests/m00000.vtc
+++ b/bin/varnishtest/tests/m00000.vtc
@@ -6,8 +6,8 @@ server s1 {
} -start
varnish v1 -vcl+backend {
- import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
- import debug from "${topbuild}/lib/libvmod_debug/.libs/libvmod_debug.so" ;
+ import ${vmod_std};
+ import ${vmod_debug};
sub vcl_deliver {
set resp.http.foo = std.toupper(resp.http.foo);
@@ -30,14 +30,14 @@ client c1 {
} -run
varnish v1 -errvcl {Wrong enum value. Expected one of:} {
- import debug from "${topbuild}/lib/libvmod_debug/.libs/libvmod_debug.so" ;
+ import ${vmod_debug};
sub vcl_deliver {
set resp.http.who = debug.author(jfk);
}
}
varnish v1 -errvcl {Wrong argument type. Expected REAL. Got STRING.} {
- import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
+ import ${vmod_std};
sub vcl_deliver {
set resp.http.who = std.random("foo", "bar");
}
diff --git a/bin/varnishtest/tests/m00001.vtc b/bin/varnishtest/tests/m00001.vtc
index 59b8e0b..1e0b45f 100644
--- a/bin/varnishtest/tests/m00001.vtc
+++ b/bin/varnishtest/tests/m00001.vtc
@@ -6,7 +6,7 @@ server s1 {
} -start
varnish v1 -arg "-pthread_pools=1" -vcl+backend {
- import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
+ import ${vmod_std};
sub vcl_deliver {
set resp.http.foo = std.toupper(resp.http.foo);
@@ -48,12 +48,12 @@ varnish v1 -cliok "vcl.list"
varnish v1 -cliok "debug.vmod"
varnish v1 -errvcl {Module std already imported.} {
- import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
- import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
+ import ${vmod_std};
+ import ${vmod_std};
}
varnish v1 -errvcl {Symbol not found: 'std' (expected type BOOL):} {
- import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
+ import ${vmod_std};
sub vcl_recv {
if (std == 2) {
diff --git a/bin/varnishtest/tests/m00002.vtc b/bin/varnishtest/tests/m00002.vtc
index 09b5c78..b0c3ebe 100644
--- a/bin/varnishtest/tests/m00002.vtc
+++ b/bin/varnishtest/tests/m00002.vtc
@@ -9,7 +9,7 @@ server s1 {
} -start
varnish v1 -vcl+backend {
- import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
+ import ${vmod_std};
sub vcl_backend_response {
set beresp.http.rnd1 = std.random(0,1);
diff --git a/bin/varnishtest/tests/m00003.vtc b/bin/varnishtest/tests/m00003.vtc
index 9e93f6e..c0a5aeb 100644
--- a/bin/varnishtest/tests/m00003.vtc
+++ b/bin/varnishtest/tests/m00003.vtc
@@ -1,5 +1,7 @@
varnishtest "Test vmod_dir param"
+feature topbuild
+
server s1 {
rxreq
txresp -hdr "foo: bAr" -hdr "bar: fOo" -bodylen 4
diff --git a/bin/varnishtest/tests/m00004.vtc b/bin/varnishtest/tests/m00004.vtc
index 6a23bde..80300ff 100644
--- a/bin/varnishtest/tests/m00004.vtc
+++ b/bin/varnishtest/tests/m00004.vtc
@@ -14,10 +14,9 @@ server s1 {
} -start
varnish v1 \
- -arg "-pvmod_dir=${topbuild}/lib/libvmod_std/.libs/" \
-arg "-pthread_pools=1" \
-vcl+backend {
- import std;
+ import ${vmod_std};
sub vcl_deliver {
if (req.url == "/one") {
@@ -54,7 +53,7 @@ client c1 {
} -run
varnish v1 -vcl+backend {
- import std;
+ import ${vmod_std};
sub vcl_deliver {
if (req.url == "/one") {
diff --git a/bin/varnishtest/tests/m00005.vtc b/bin/varnishtest/tests/m00005.vtc
index ec04a3f..2ea397a 100644
--- a/bin/varnishtest/tests/m00005.vtc
+++ b/bin/varnishtest/tests/m00005.vtc
@@ -8,7 +8,7 @@ server s1 {
} -start
varnish v1 -vcl+backend {
- import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
+ import ${vmod_std};
sub vcl_recv {
set req.ttl = 1000000s + std.duration(req.http.ttl, 1s);
diff --git a/bin/varnishtest/tests/m00006.vtc b/bin/varnishtest/tests/m00006.vtc
index f9ce764..0d33e73 100644
--- a/bin/varnishtest/tests/m00006.vtc
+++ b/bin/varnishtest/tests/m00006.vtc
@@ -13,7 +13,7 @@ server s1 {
} -start
varnish v1 -vcl+backend {
- import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
+ import ${vmod_std};
sub vcl_recv {
std.collect(req.http.foo);
@@ -44,7 +44,7 @@ client c1 {
} -run
varnish v1 -errvcl {'beresp.http.bar': Not available in method 'vcl_recv'} {
- import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
+ import ${vmod_std};
backend b { .host = "127.0.0.1"; }
diff --git a/bin/varnishtest/tests/m00007.vtc b/bin/varnishtest/tests/m00007.vtc
index 2b1c43a..a99ac10 100644
--- a/bin/varnishtest/tests/m00007.vtc
+++ b/bin/varnishtest/tests/m00007.vtc
@@ -8,7 +8,7 @@ server s1 {
} -start
varnish v1 -vcl+backend {
- import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
+ import ${vmod_std};
sub vcl_deliver {
set resp.http.biggerthanzero = (std.integer(req.http.foo,0) > 0);
diff --git a/bin/varnishtest/tests/m00008.vtc b/bin/varnishtest/tests/m00008.vtc
index c1bdd6b..232d3c0 100644
--- a/bin/varnishtest/tests/m00008.vtc
+++ b/bin/varnishtest/tests/m00008.vtc
@@ -1,19 +1,21 @@
varnishtest "Test std vmod vs. unsafe_path"
+feature topbuild
+
server s1 {
rxreq
txresp -hdr "foo: bAr" -hdr "bar: fOo" -bodylen 4
} -start
varnish v1 -vcl+backend {
- import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
+ import ${vmod_std};
}
varnish v1 -cliok "param.set vcc_unsafe_path off"
varnish v1 -errvcl {'import ... from path ...' not allowed.} {
backend default { .host = "${s1_sock}"; }
- import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
+ import ${vmod_std};
}
varnish v1 -cliok "param.set vmod_dir ${topbuild}/lib/libvmod_std/.libs/"
diff --git a/bin/varnishtest/tests/m00009.vtc b/bin/varnishtest/tests/m00009.vtc
index cad9b96..4e97863 100644
--- a/bin/varnishtest/tests/m00009.vtc
+++ b/bin/varnishtest/tests/m00009.vtc
@@ -25,7 +25,7 @@ server s4 {
varnish v1 -vcl+backend {
- import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ;
+ import ${vmod_directors};
sub vcl_init {
new rr = directors.round_robin();
rr.add_backend(s1);
diff --git a/bin/varnishtest/tests/m00010.vtc b/bin/varnishtest/tests/m00010.vtc
index c4c1b3d..db2a07f 100644
--- a/bin/varnishtest/tests/m00010.vtc
+++ b/bin/varnishtest/tests/m00010.vtc
@@ -23,7 +23,7 @@ server s4 {
} -start
varnish v1 -errvcl {Names of VCL objects cannot contain '-'} {
- import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ;
+ import ${vmod_directors};
backend b1 { .host = "127.0.0.1"; .port = "8080";}
sub vcl_init {
new rr1-xx = directors.round_robin();
@@ -32,7 +32,7 @@ varnish v1 -errvcl {Names of VCL objects cannot contain '-'} {
varnish v1 -vcl+backend {
- import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ;
+ import ${vmod_directors};
sub vcl_init {
new rr1 = directors.round_robin();
rr1.add_backend(s1);
diff --git a/bin/varnishtest/tests/m00011.vtc b/bin/varnishtest/tests/m00011.vtc
index 0a7e517..9f17dfe 100644
--- a/bin/varnishtest/tests/m00011.vtc
+++ b/bin/varnishtest/tests/m00011.vtc
@@ -9,7 +9,7 @@ server s1 {
varnish v1 -vcl+backend {
- import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
+ import ${vmod_std};
sub vcl_deliver {
set resp.http.foo0 = std.ip("8.8.8.*", client.ip);
set resp.http.foo1 = std.ip("9.9.9.*", server.ip);
diff --git a/bin/varnishtest/tests/r00263.vtc b/bin/varnishtest/tests/r00263.vtc
index aad4784..39f1ef5 100644
--- a/bin/varnishtest/tests/r00263.vtc
+++ b/bin/varnishtest/tests/r00263.vtc
@@ -3,7 +3,7 @@ varnishtest "Test refcounting backends from director"
# XXX: This test is probably not relevant with VMOD.directors
varnish v1 -vcl {
- import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ;
+ import ${vmod_directors};
backend node1 { .host = "10.0.0.1"; .port = "80"; }
backend node2 { .host = "10.0.0.2"; .port = "80"; }
diff --git a/bin/varnishtest/tests/r00306.vtc b/bin/varnishtest/tests/r00306.vtc
index c00badb..9e85b25 100644
--- a/bin/varnishtest/tests/r00306.vtc
+++ b/bin/varnishtest/tests/r00306.vtc
@@ -19,7 +19,7 @@ server s2 {
varnish v1 -vcl {
- import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ;
+ import ${vmod_directors};
backend s1 {
.host = "${s1_addr}"; .port = "${s1_port}";
diff --git a/bin/varnishtest/tests/r00722.vtc b/bin/varnishtest/tests/r00722.vtc
index 2e41814..ef7268c 100644
--- a/bin/varnishtest/tests/r00722.vtc
+++ b/bin/varnishtest/tests/r00722.vtc
@@ -6,7 +6,7 @@ server s1 {
} -start
varnish v1 -vcl+backend {
- import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ;
+ import ${vmod_directors};
backend b2 {
.host = "${s1_addr}"; .port = "${s1_port}";
diff --git a/bin/varnishtest/tests/r00878.vtc b/bin/varnishtest/tests/r00878.vtc
index a7ed048..8df049a 100644
--- a/bin/varnishtest/tests/r00878.vtc
+++ b/bin/varnishtest/tests/r00878.vtc
@@ -6,7 +6,7 @@ server s1 {
} -start
varnish v1 -vcl+backend {
- import debug from "${topbuild}/lib/libvmod_debug/.libs/libvmod_debug.so" ;
+ import ${vmod_debug};
sub vcl_deliver {
set resp.http.who = debug.author(phk);
}
@@ -18,7 +18,7 @@ client c1 {
rxresp
} -run
varnish v1 -vcl+backend {
- import debug from "${topbuild}/lib/libvmod_debug/.libs/libvmod_debug.so" ;
+ import ${vmod_debug};
sub vcl_deliver {
set resp.http.who = debug.author(des);
}
@@ -30,7 +30,7 @@ client c1 {
} -run
varnish v1 -vcl+backend {
- import debug from "${topbuild}/lib/libvmod_debug/.libs/libvmod_debug.so" ;
+ import ${vmod_debug};
sub vcl_deliver {
set resp.http.who = debug.author(kristian);
}
diff --git a/bin/varnishtest/tests/r01002.vtc b/bin/varnishtest/tests/r01002.vtc
index 12eb636..2697d77 100644
--- a/bin/varnishtest/tests/r01002.vtc
+++ b/bin/varnishtest/tests/r01002.vtc
@@ -1,7 +1,7 @@
varnishtest "Real relational comparisons"
varnish v1 -vcl {
- import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
+ import ${vmod_std};
backend foo { .host = "${bad_ip}"; }
sub vcl_recv {
diff --git a/bin/varnishtest/tests/r01145.vtc b/bin/varnishtest/tests/r01145.vtc
index 2a2502e..f87238d 100644
--- a/bin/varnishtest/tests/r01145.vtc
+++ b/bin/varnishtest/tests/r01145.vtc
@@ -15,7 +15,7 @@ server s1 {
varnish v1 -vcl+backend {
- import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
+ import ${vmod_std};
sub vcl_deliver {
set resp.http.foo = std.fileread("${tmpdir}" + req.url);
diff --git a/bin/varnishtest/tests/r01212.vtc b/bin/varnishtest/tests/r01212.vtc
index ca8d5379..a1e91ee 100644
--- a/bin/varnishtest/tests/r01212.vtc
+++ b/bin/varnishtest/tests/r01212.vtc
@@ -1,7 +1,7 @@
varnishtest "#1212 - Vmod with HEADER argument given a STRING asserts the VCL compiler"
varnish v1 -errvcl {Wrong argument type. Expected HEADER. Got STRING.} {
- import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so";
+ import ${vmod_std};
backend b { .host = "127.0.0.1"; }
sub vcl_recv {
std.collect("foo");
diff --git a/bin/varnishtest/tests/r01332.vtc b/bin/varnishtest/tests/r01332.vtc
index 062e334..518c558 100644
--- a/bin/varnishtest/tests/r01332.vtc
+++ b/bin/varnishtest/tests/r01332.vtc
@@ -6,7 +6,7 @@ server s1 {
} -start
varnish v1 -vcl+backend {
- import debug from "${topbuild}/lib/libvmod_debug/.libs/libvmod_debug.so";
+ import ${vmod_debug};
sub vcl_init {
new obj = debug.obj("don't care");
diff --git a/bin/varnishtest/tests/v00007.vtc b/bin/varnishtest/tests/v00007.vtc
index d0c37f8..313d970 100644
--- a/bin/varnishtest/tests/v00007.vtc
+++ b/bin/varnishtest/tests/v00007.vtc
@@ -8,7 +8,7 @@ server s1 {
} -start
varnish v1 -vcl+backend {
- import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so";
+ import ${vmod_directors};
sub vcl_init {
new foo = directors.random();
diff --git a/bin/varnishtest/tests/v00009.vtc b/bin/varnishtest/tests/v00009.vtc
index 53e569b..a356a51 100644
--- a/bin/varnishtest/tests/v00009.vtc
+++ b/bin/varnishtest/tests/v00009.vtc
@@ -23,7 +23,7 @@ server s4 {
varnish v1 -vcl+backend {
- import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ;
+ import ${vmod_directors};
sub vcl_init {
new batman = directors.round_robin();
diff --git a/bin/varnishtest/tests/v00010.vtc b/bin/varnishtest/tests/v00010.vtc
index 58afdac..30bae3a 100644
--- a/bin/varnishtest/tests/v00010.vtc
+++ b/bin/varnishtest/tests/v00010.vtc
@@ -23,7 +23,7 @@ server s1 {
varnish v1 -arg "-smalloc,1m" -vcl+backend {
- import debug from "${topbuild}/lib/libvmod_debug/.libs/libvmod_debug.so";
+ import ${vmod_debug};
sub vcl_backend_response {
if (beresp.http.panic == "fetch") {
diff --git a/bin/varnishtest/tests/v00022.vtc b/bin/varnishtest/tests/v00022.vtc
index e6c2c0b..10f4c9f 100644
--- a/bin/varnishtest/tests/v00022.vtc
+++ b/bin/varnishtest/tests/v00022.vtc
@@ -32,7 +32,7 @@ server s4 {
} -start
varnish v1 -vcl+backend {
- import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ;
+ import ${vmod_directors};
sub vcl_init {
new foo = directors.random();
diff --git a/bin/varnishtest/tests/v00026.vtc b/bin/varnishtest/tests/v00026.vtc
index d859658..40d3b33 100644
--- a/bin/varnishtest/tests/v00026.vtc
+++ b/bin/varnishtest/tests/v00026.vtc
@@ -16,7 +16,7 @@ server s2 {
varnish v1 -vcl+backend {
- import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ;
+ import ${vmod_directors};
sub vcl_init {
new h1 = directors.hash();
diff --git a/bin/varnishtest/tests/v00036.vtc b/bin/varnishtest/tests/v00036.vtc
index 6bf1f1b..42e9123 100644
--- a/bin/varnishtest/tests/v00036.vtc
+++ b/bin/varnishtest/tests/v00036.vtc
@@ -16,7 +16,7 @@ server s3 {
} -start
varnish v1 -vcl+backend {
- import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ;
+ import ${vmod_directors};
sub vcl_init {
new fb1 = directors.fallback();
diff --git a/bin/varnishtest/vmods.h b/bin/varnishtest/vmods.h
new file mode 100644
index 0000000..f951b22
--- /dev/null
+++ b/bin/varnishtest/vmods.h
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (c) 2013 Varnish Software AS
+ * All rights reserved.
+ *
+ * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+VTC_VMOD(std)
+VTC_VMOD(debug)
+VTC_VMOD(directors)
diff --git a/bin/varnishtest/vtc.c b/bin/varnishtest/vtc.c
index 687e52f..bedd463 100644
--- a/bin/varnishtest/vtc.c
+++ b/bin/varnishtest/vtc.c
@@ -515,6 +515,8 @@ cmd_feature(CMD_ARGS)
continue;
#endif
}
+ if (!strcmp(av[i], "topbuild") && iflg)
+ continue;
vtc_log(vl, 1, "SKIPPING test, missing feature: %s", av[i]);
vtc_stop = 1;
diff --git a/bin/varnishtest/vtc.h b/bin/varnishtest/vtc.h
index 85763df..6c56926 100644
--- a/bin/varnishtest/vtc.h
+++ b/bin/varnishtest/vtc.h
@@ -68,6 +68,7 @@ cmd_f cmd_logexp;
extern volatile sig_atomic_t vtc_error; /* Error, bail out */
extern int vtc_stop; /* Abandon current test, no error */
extern pthread_t vtc_thread;
+extern int iflg;
void init_sema(void);
diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index ff3cae1..951dc17 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -75,6 +75,8 @@ struct vtc_job {
double t0;
};
+int iflg = 0;
+
static VTAILQ_HEAD(, vtc_tst) tst_head = VTAILQ_HEAD_INITIALIZER(tst_head);
static struct vev_base *vb;
static int njob = 0;
@@ -363,7 +365,7 @@ i_mode(void)
*topbuild = '\0';
topbuild = strchr(p, '/');
if (topbuild == NULL) {
- fprintf(stderr,
+ fprintf(stderr,
"No '/' after 'abs_top_builddir' in Makefile\n");
exit(2);
}
@@ -377,10 +379,10 @@ i_mode(void)
AN(vsb);
VSB_printf(vsb, "PATH=");
sep = "";
-#define VTC_PROG(l) \
+#define VTC_PROG(l) \
do { \
- VSB_printf(vsb, "%s%s/bin/%s/", sep, topbuild, #l); \
- sep = ":"; \
+ VSB_printf(vsb, "%s%s/bin/%s/", sep, topbuild, #l); \
+ sep = ":"; \
} while (0);
#include "programs.h"
#undef VTC_PROG
@@ -388,6 +390,21 @@ i_mode(void)
AZ(VSB_finish(vsb));
AZ(putenv(strdup(VSB_data(vsb))));
+
+ /*
+ * Redefine VMOD macros
+ */
+#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)); \
+ } while (0);
+#include "vmods.h"
+#undef VTC_VMOD
VSB_delete(vsb);
}
@@ -402,13 +419,17 @@ main(int argc, char * const *argv)
int ntest = 1; /* Run tests this many times */
struct vtc_tst *tp;
char *p;
- int iflg = 0;
/* Default names of programs */
#define VTC_PROG(l) extmacro_def(#l, #l);
#include "programs.h"
#undef VTC_PROG
+ /* Default import spec of vmods */
+#define VTC_VMOD(l) extmacro_def("vmod_" #l, #l);
+#include "vmods.h"
+#undef VTC_VMOD
+
if (getenv("TMPDIR") != NULL)
tmppath = strdup(getenv("TMPDIR"));
else
More information about the varnish-commit
mailing list