Commit 687c340d authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

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.
parent f2bccc2b
...@@ -28,3 +28,5 @@ ...@@ -28,3 +28,5 @@
-e786 // String concatenation within initializer -e786 // String concatenation within initializer
-e788 // enum value not used in defaulted switch -e788 // enum value not used in defaulted switch
-efile(451, vmods.h)
-efile(451, programs.h)
...@@ -21,7 +21,7 @@ client c1 { ...@@ -21,7 +21,7 @@ client c1 {
} -run } -run
varnish v1 -vcl { varnish v1 -vcl {
import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ; import ${vmod_directors};
backend b1 { backend b1 {
.host = "${bad_ip}"; .port = "9080"; .host = "${bad_ip}"; .port = "9080";
...@@ -48,7 +48,7 @@ client c1 { ...@@ -48,7 +48,7 @@ client c1 {
} -run } -run
varnish v1 -vcl { varnish v1 -vcl {
import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ; import ${vmod_directors};
backend b1 { backend b1 {
.host = "${bad_ip}"; .port = "9080"; .host = "${bad_ip}"; .port = "9080";
} }
......
...@@ -21,7 +21,7 @@ varnish v1 \ ...@@ -21,7 +21,7 @@ varnish v1 \
-arg "-smalloc,1m" \ -arg "-smalloc,1m" \
-arg "-smalloc,1m" \ -arg "-smalloc,1m" \
-arg "-smalloc,1m" \ -arg "-smalloc,1m" \
-vcl+backend { -vcl+backend {
sub vcl_backend_response { sub vcl_backend_response {
set beresp.do_stream = false; set beresp.do_stream = false;
set beresp.storage = "invalid"; set beresp.storage = "invalid";
......
...@@ -6,8 +6,8 @@ server s1 { ...@@ -6,8 +6,8 @@ server s1 {
} -start } -start
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ; import ${vmod_std};
import debug from "${topbuild}/lib/libvmod_debug/.libs/libvmod_debug.so" ; import ${vmod_debug};
sub vcl_deliver { sub vcl_deliver {
set resp.http.foo = std.toupper(resp.http.foo); set resp.http.foo = std.toupper(resp.http.foo);
...@@ -30,14 +30,14 @@ client c1 { ...@@ -30,14 +30,14 @@ client c1 {
} -run } -run
varnish v1 -errvcl {Wrong enum value. Expected one of:} { 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 { sub vcl_deliver {
set resp.http.who = debug.author(jfk); set resp.http.who = debug.author(jfk);
} }
} }
varnish v1 -errvcl {Wrong argument type. Expected REAL. Got STRING.} { 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 { sub vcl_deliver {
set resp.http.who = std.random("foo", "bar"); set resp.http.who = std.random("foo", "bar");
} }
......
...@@ -6,7 +6,7 @@ server s1 { ...@@ -6,7 +6,7 @@ server s1 {
} -start } -start
varnish v1 -arg "-pthread_pools=1" -vcl+backend { 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 { sub vcl_deliver {
set resp.http.foo = std.toupper(resp.http.foo); set resp.http.foo = std.toupper(resp.http.foo);
...@@ -48,12 +48,12 @@ varnish v1 -cliok "vcl.list" ...@@ -48,12 +48,12 @@ varnish v1 -cliok "vcl.list"
varnish v1 -cliok "debug.vmod" varnish v1 -cliok "debug.vmod"
varnish v1 -errvcl {Module std already imported.} { varnish v1 -errvcl {Module std already imported.} {
import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ; import ${vmod_std};
import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ; import ${vmod_std};
} }
varnish v1 -errvcl {Symbol not found: 'std' (expected type BOOL):} { 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 { sub vcl_recv {
if (std == 2) { if (std == 2) {
......
...@@ -9,7 +9,7 @@ server s1 { ...@@ -9,7 +9,7 @@ server s1 {
} -start } -start
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ; import ${vmod_std};
sub vcl_backend_response { sub vcl_backend_response {
set beresp.http.rnd1 = std.random(0,1); set beresp.http.rnd1 = std.random(0,1);
......
varnishtest "Test vmod_dir param" varnishtest "Test vmod_dir param"
feature topbuild
server s1 { server s1 {
rxreq rxreq
txresp -hdr "foo: bAr" -hdr "bar: fOo" -bodylen 4 txresp -hdr "foo: bAr" -hdr "bar: fOo" -bodylen 4
......
...@@ -14,10 +14,9 @@ server s1 { ...@@ -14,10 +14,9 @@ server s1 {
} -start } -start
varnish v1 \ varnish v1 \
-arg "-pvmod_dir=${topbuild}/lib/libvmod_std/.libs/" \
-arg "-pthread_pools=1" \ -arg "-pthread_pools=1" \
-vcl+backend { -vcl+backend {
import std; import ${vmod_std};
sub vcl_deliver { sub vcl_deliver {
if (req.url == "/one") { if (req.url == "/one") {
...@@ -54,7 +53,7 @@ client c1 { ...@@ -54,7 +53,7 @@ client c1 {
} -run } -run
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import std; import ${vmod_std};
sub vcl_deliver { sub vcl_deliver {
if (req.url == "/one") { if (req.url == "/one") {
......
...@@ -8,7 +8,7 @@ server s1 { ...@@ -8,7 +8,7 @@ server s1 {
} -start } -start
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ; import ${vmod_std};
sub vcl_recv { sub vcl_recv {
set req.ttl = 1000000s + std.duration(req.http.ttl, 1s); set req.ttl = 1000000s + std.duration(req.http.ttl, 1s);
......
...@@ -13,7 +13,7 @@ server s1 { ...@@ -13,7 +13,7 @@ server s1 {
} -start } -start
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ; import ${vmod_std};
sub vcl_recv { sub vcl_recv {
std.collect(req.http.foo); std.collect(req.http.foo);
...@@ -44,7 +44,7 @@ client c1 { ...@@ -44,7 +44,7 @@ client c1 {
} -run } -run
varnish v1 -errvcl {'beresp.http.bar': Not available in method 'vcl_recv'} { 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"; } backend b { .host = "127.0.0.1"; }
......
...@@ -8,7 +8,7 @@ server s1 { ...@@ -8,7 +8,7 @@ server s1 {
} -start } -start
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ; import ${vmod_std};
sub vcl_deliver { sub vcl_deliver {
set resp.http.biggerthanzero = (std.integer(req.http.foo,0) > 0); set resp.http.biggerthanzero = (std.integer(req.http.foo,0) > 0);
......
varnishtest "Test std vmod vs. unsafe_path" varnishtest "Test std vmod vs. unsafe_path"
feature topbuild
server s1 { server s1 {
rxreq rxreq
txresp -hdr "foo: bAr" -hdr "bar: fOo" -bodylen 4 txresp -hdr "foo: bAr" -hdr "bar: fOo" -bodylen 4
} -start } -start
varnish v1 -vcl+backend { 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 -cliok "param.set vcc_unsafe_path off"
varnish v1 -errvcl {'import ... from path ...' not allowed.} { varnish v1 -errvcl {'import ... from path ...' not allowed.} {
backend default { .host = "${s1_sock}"; } 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/" varnish v1 -cliok "param.set vmod_dir ${topbuild}/lib/libvmod_std/.libs/"
......
...@@ -25,7 +25,7 @@ server s4 { ...@@ -25,7 +25,7 @@ server s4 {
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ; import ${vmod_directors};
sub vcl_init { sub vcl_init {
new rr = directors.round_robin(); new rr = directors.round_robin();
rr.add_backend(s1); rr.add_backend(s1);
......
...@@ -23,7 +23,7 @@ server s4 { ...@@ -23,7 +23,7 @@ server s4 {
} -start } -start
varnish v1 -errvcl {Names of VCL objects cannot contain '-'} { 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";} backend b1 { .host = "127.0.0.1"; .port = "8080";}
sub vcl_init { sub vcl_init {
new rr1-xx = directors.round_robin(); new rr1-xx = directors.round_robin();
...@@ -32,7 +32,7 @@ varnish v1 -errvcl {Names of VCL objects cannot contain '-'} { ...@@ -32,7 +32,7 @@ varnish v1 -errvcl {Names of VCL objects cannot contain '-'} {
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ; import ${vmod_directors};
sub vcl_init { sub vcl_init {
new rr1 = directors.round_robin(); new rr1 = directors.round_robin();
rr1.add_backend(s1); rr1.add_backend(s1);
......
...@@ -9,7 +9,7 @@ server s1 { ...@@ -9,7 +9,7 @@ server s1 {
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ; import ${vmod_std};
sub vcl_deliver { sub vcl_deliver {
set resp.http.foo0 = std.ip("8.8.8.*", client.ip); set resp.http.foo0 = std.ip("8.8.8.*", client.ip);
set resp.http.foo1 = std.ip("9.9.9.*", server.ip); set resp.http.foo1 = std.ip("9.9.9.*", server.ip);
......
...@@ -3,7 +3,7 @@ varnishtest "Test refcounting backends from director" ...@@ -3,7 +3,7 @@ varnishtest "Test refcounting backends from director"
# XXX: This test is probably not relevant with VMOD.directors # XXX: This test is probably not relevant with VMOD.directors
varnish v1 -vcl { 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 node1 { .host = "10.0.0.1"; .port = "80"; }
backend node2 { .host = "10.0.0.2"; .port = "80"; } backend node2 { .host = "10.0.0.2"; .port = "80"; }
......
...@@ -19,7 +19,7 @@ server s2 { ...@@ -19,7 +19,7 @@ server s2 {
varnish v1 -vcl { varnish v1 -vcl {
import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ; import ${vmod_directors};
backend s1 { backend s1 {
.host = "${s1_addr}"; .port = "${s1_port}"; .host = "${s1_addr}"; .port = "${s1_port}";
......
...@@ -6,7 +6,7 @@ server s1 { ...@@ -6,7 +6,7 @@ server s1 {
} -start } -start
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ; import ${vmod_directors};
backend b2 { backend b2 {
.host = "${s1_addr}"; .port = "${s1_port}"; .host = "${s1_addr}"; .port = "${s1_port}";
......
...@@ -6,7 +6,7 @@ server s1 { ...@@ -6,7 +6,7 @@ server s1 {
} -start } -start
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import debug from "${topbuild}/lib/libvmod_debug/.libs/libvmod_debug.so" ; import ${vmod_debug};
sub vcl_deliver { sub vcl_deliver {
set resp.http.who = debug.author(phk); set resp.http.who = debug.author(phk);
} }
...@@ -18,7 +18,7 @@ client c1 { ...@@ -18,7 +18,7 @@ client c1 {
rxresp rxresp
} -run } -run
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import debug from "${topbuild}/lib/libvmod_debug/.libs/libvmod_debug.so" ; import ${vmod_debug};
sub vcl_deliver { sub vcl_deliver {
set resp.http.who = debug.author(des); set resp.http.who = debug.author(des);
} }
...@@ -30,7 +30,7 @@ client c1 { ...@@ -30,7 +30,7 @@ client c1 {
} -run } -run
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import debug from "${topbuild}/lib/libvmod_debug/.libs/libvmod_debug.so" ; import ${vmod_debug};
sub vcl_deliver { sub vcl_deliver {
set resp.http.who = debug.author(kristian); set resp.http.who = debug.author(kristian);
} }
......
varnishtest "Real relational comparisons" varnishtest "Real relational comparisons"
varnish v1 -vcl { varnish v1 -vcl {
import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ; import ${vmod_std};
backend foo { .host = "${bad_ip}"; } backend foo { .host = "${bad_ip}"; }
sub vcl_recv { sub vcl_recv {
......
...@@ -15,7 +15,7 @@ server s1 { ...@@ -15,7 +15,7 @@ server s1 {
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ; import ${vmod_std};
sub vcl_deliver { sub vcl_deliver {
set resp.http.foo = std.fileread("${tmpdir}" + req.url); set resp.http.foo = std.fileread("${tmpdir}" + req.url);
......
varnishtest "#1212 - Vmod with HEADER argument given a STRING asserts the VCL compiler" varnishtest "#1212 - Vmod with HEADER argument given a STRING asserts the VCL compiler"
varnish v1 -errvcl {Wrong argument type. Expected HEADER. Got STRING.} { 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"; } backend b { .host = "127.0.0.1"; }
sub vcl_recv { sub vcl_recv {
std.collect("foo"); std.collect("foo");
......
...@@ -6,7 +6,7 @@ server s1 { ...@@ -6,7 +6,7 @@ server s1 {
} -start } -start
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import debug from "${topbuild}/lib/libvmod_debug/.libs/libvmod_debug.so"; import ${vmod_debug};
sub vcl_init { sub vcl_init {
new obj = debug.obj("don't care"); new obj = debug.obj("don't care");
......
...@@ -8,7 +8,7 @@ server s1 { ...@@ -8,7 +8,7 @@ server s1 {
} -start } -start
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so"; import ${vmod_directors};
sub vcl_init { sub vcl_init {
new foo = directors.random(); new foo = directors.random();
......
...@@ -23,7 +23,7 @@ server s4 { ...@@ -23,7 +23,7 @@ server s4 {
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ; import ${vmod_directors};
sub vcl_init { sub vcl_init {
new batman = directors.round_robin(); new batman = directors.round_robin();
......
...@@ -23,7 +23,7 @@ server s1 { ...@@ -23,7 +23,7 @@ server s1 {
varnish v1 -arg "-smalloc,1m" -vcl+backend { 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 { sub vcl_backend_response {
if (beresp.http.panic == "fetch") { if (beresp.http.panic == "fetch") {
......
...@@ -32,7 +32,7 @@ server s4 { ...@@ -32,7 +32,7 @@ server s4 {
} -start } -start
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ; import ${vmod_directors};
sub vcl_init { sub vcl_init {
new foo = directors.random(); new foo = directors.random();
......
...@@ -16,7 +16,7 @@ server s2 { ...@@ -16,7 +16,7 @@ server s2 {
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ; import ${vmod_directors};
sub vcl_init { sub vcl_init {
new h1 = directors.hash(); new h1 = directors.hash();
......
...@@ -16,7 +16,7 @@ server s3 { ...@@ -16,7 +16,7 @@ server s3 {
} -start } -start
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ; import ${vmod_directors};
sub vcl_init { sub vcl_init {
new fb1 = directors.fallback(); new fb1 = directors.fallback();
......
/*-
* Copyright (c) 2013 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@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)
...@@ -515,6 +515,8 @@ cmd_feature(CMD_ARGS) ...@@ -515,6 +515,8 @@ cmd_feature(CMD_ARGS)
continue; continue;
#endif #endif
} }
if (!strcmp(av[i], "topbuild") && iflg)
continue;
vtc_log(vl, 1, "SKIPPING test, missing feature: %s", av[i]); vtc_log(vl, 1, "SKIPPING test, missing feature: %s", av[i]);
vtc_stop = 1; vtc_stop = 1;
......
...@@ -68,6 +68,7 @@ cmd_f cmd_logexp; ...@@ -68,6 +68,7 @@ cmd_f cmd_logexp;
extern volatile sig_atomic_t vtc_error; /* Error, bail out */ extern volatile sig_atomic_t vtc_error; /* Error, bail out */
extern int vtc_stop; /* Abandon current test, no error */ extern int vtc_stop; /* Abandon current test, no error */
extern pthread_t vtc_thread; extern pthread_t vtc_thread;
extern int iflg;
void init_sema(void); void init_sema(void);
......
...@@ -75,6 +75,8 @@ struct vtc_job { ...@@ -75,6 +75,8 @@ struct vtc_job {
double t0; double t0;
}; };
int iflg = 0;
static VTAILQ_HEAD(, vtc_tst) tst_head = VTAILQ_HEAD_INITIALIZER(tst_head); static VTAILQ_HEAD(, vtc_tst) tst_head = VTAILQ_HEAD_INITIALIZER(tst_head);
static struct vev_base *vb; static struct vev_base *vb;
static int njob = 0; static int njob = 0;
...@@ -363,7 +365,7 @@ i_mode(void) ...@@ -363,7 +365,7 @@ i_mode(void)
*topbuild = '\0'; *topbuild = '\0';
topbuild = strchr(p, '/'); topbuild = strchr(p, '/');
if (topbuild == NULL) { if (topbuild == NULL) {
fprintf(stderr, fprintf(stderr,
"No '/' after 'abs_top_builddir' in Makefile\n"); "No '/' after 'abs_top_builddir' in Makefile\n");
exit(2); exit(2);
} }
...@@ -377,10 +379,10 @@ i_mode(void) ...@@ -377,10 +379,10 @@ i_mode(void)
AN(vsb); AN(vsb);
VSB_printf(vsb, "PATH="); VSB_printf(vsb, "PATH=");
sep = ""; sep = "";
#define VTC_PROG(l) \ #define VTC_PROG(l) \
do { \ do { \
VSB_printf(vsb, "%s%s/bin/%s/", sep, topbuild, #l); \ VSB_printf(vsb, "%s%s/bin/%s/", sep, topbuild, #l); \
sep = ":"; \ sep = ":"; \
} while (0); } while (0);
#include "programs.h" #include "programs.h"
#undef VTC_PROG #undef VTC_PROG
...@@ -388,6 +390,21 @@ i_mode(void) ...@@ -388,6 +390,21 @@ i_mode(void)
AZ(VSB_finish(vsb)); AZ(VSB_finish(vsb));
AZ(putenv(strdup(VSB_data(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); VSB_delete(vsb);
} }
...@@ -402,13 +419,17 @@ main(int argc, char * const *argv) ...@@ -402,13 +419,17 @@ main(int argc, char * const *argv)
int ntest = 1; /* Run tests this many times */ int ntest = 1; /* Run tests this many times */
struct vtc_tst *tp; struct vtc_tst *tp;
char *p; char *p;
int iflg = 0;
/* Default names of programs */ /* Default names of programs */
#define VTC_PROG(l) extmacro_def(#l, #l); #define VTC_PROG(l) extmacro_def(#l, #l);
#include "programs.h" #include "programs.h"
#undef VTC_PROG #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) if (getenv("TMPDIR") != NULL)
tmppath = strdup(getenv("TMPDIR")); tmppath = strdup(getenv("TMPDIR"));
else else
......
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