Commit 2457d882 authored by Geoff Simmons's avatar Geoff Simmons

Fix path.vtc so that it runs under make distcheck.

distcheck does not allow writes into the build directory, so we
can't use ${testdir}.
parent c8930bbe
...@@ -2,16 +2,22 @@ ...@@ -2,16 +2,22 @@
varnishtest "path parameter for the reader constructor" varnishtest "path parameter for the reader constructor"
shell {echo -n "tmpdir" > ${tmpdir}/pathtest} shell {
shell {echo -n "testdir" > ${testdir}/pathtest} mkdir ${tmpdir}/d1
mkdir ${tmpdir}/d2
echo -n "1" > ${tmpdir}/d1/pathtest
echo -n "2" > ${tmpdir}/d2/pathtest
}
varnish v1 -vcl { varnish v1 -vcl {
import ${vmod_file}; import ${vmod_file};
backend b { .host = "${bad_ip}"; } backend b { .host = "${bad_ip}"; }
sub vcl_init { sub vcl_init {
new tmp = file.reader("pathtest", path="${tmpdir}:${testdir}"); new d1 = file.reader("pathtest",
new test = file.reader("pathtest", path="${testdir}:${tmpdir}"); path="${tmpdir}/d1:${tmpdir}/d2");
new d2 = file.reader("pathtest",
path="${tmpdir}/d2:${tmpdir}/d1");
} }
sub vcl_recv { sub vcl_recv {
...@@ -19,8 +25,8 @@ varnish v1 -vcl { ...@@ -19,8 +25,8 @@ varnish v1 -vcl {
} }
sub vcl_synth { sub vcl_synth {
set resp.http.Tmp = tmp.get(); set resp.http.D1 = d1.get();
set resp.http.Test = test.get(); set resp.http.D2 = d2.get();
return (deliver); return (deliver);
} }
} -start } -start
...@@ -29,8 +35,8 @@ client c1 { ...@@ -29,8 +35,8 @@ client c1 {
txreq txreq
rxresp rxresp
expect resp.status == 200 expect resp.status == 200
expect resp.http.Tmp == "tmpdir" expect resp.http.D1 == "1"
expect resp.http.Test == "testdir" expect resp.http.D2 == "2"
} -run } -run
varnish v1 -vcl { varnish v1 -vcl {
...@@ -38,10 +44,10 @@ varnish v1 -vcl { ...@@ -38,10 +44,10 @@ varnish v1 -vcl {
backend b { .host = "${bad_ip}"; } backend b { .host = "${bad_ip}"; }
sub vcl_init { sub vcl_init {
new tmp = file.reader("pathtest", new d1 = file.reader("pathtest",
path="${tmpdir}/:${testdir}/"); path="${tmpdir}/d1/:${tmpdir}/d2/");
new test = file.reader("pathtest", new d2 = file.reader("pathtest",
path="${testdir}/:${tmpdir}/"); path="${tmpdir}/d2/:${tmpdir}/d1/");
} }
sub vcl_recv { sub vcl_recv {
...@@ -49,24 +55,24 @@ varnish v1 -vcl { ...@@ -49,24 +55,24 @@ varnish v1 -vcl {
} }
sub vcl_synth { sub vcl_synth {
set resp.http.Tmp = tmp.get(); set resp.http.D1 = d1.get();
set resp.http.Test = test.get(); set resp.http.D2 = d2.get();
return (deliver); return (deliver);
} }
} }
client c1 -run client c1 -run
shell {echo -n "tmponly" > ${tmpdir}/pathtest} shell {echo -n "1 only" > ${tmpdir}/d1/pathtest}
shell {echo -n "testonly" > ${testdir}/pathtest} shell {echo -n "2 only" > ${tmpdir}/d2/pathtest}
varnish v1 -vcl { varnish v1 -vcl {
import ${vmod_file}; import ${vmod_file};
backend b { .host = "${bad_ip}"; } backend b { .host = "${bad_ip}"; }
sub vcl_init { sub vcl_init {
new tmp = file.reader("pathtest", path="${tmpdir}"); new d1 = file.reader("pathtest", path="${tmpdir}/d1");
new test = file.reader("pathtest", path="${testdir}"); new d2 = file.reader("pathtest", path="${tmpdir}/d2");
} }
sub vcl_recv { sub vcl_recv {
...@@ -74,8 +80,8 @@ varnish v1 -vcl { ...@@ -74,8 +80,8 @@ varnish v1 -vcl {
} }
sub vcl_synth { sub vcl_synth {
set resp.http.Tmp = tmp.get(); set resp.http.D1 = d1.get();
set resp.http.Test = test.get(); set resp.http.D2 = d2.get();
return (deliver); return (deliver);
} }
} }
...@@ -84,8 +90,8 @@ client c1 { ...@@ -84,8 +90,8 @@ client c1 {
txreq txreq
rxresp rxresp
expect resp.status == 200 expect resp.status == 200
expect resp.http.Tmp == "tmponly" expect resp.http.D1 == "1 only"
expect resp.http.Test == "testonly" expect resp.http.D2 == "2 only"
} -run } -run
varnish v1 -vcl { varnish v1 -vcl {
...@@ -93,8 +99,8 @@ varnish v1 -vcl { ...@@ -93,8 +99,8 @@ varnish v1 -vcl {
backend b { .host = "${bad_ip}"; } backend b { .host = "${bad_ip}"; }
sub vcl_init { sub vcl_init {
new tmp1 = file.reader("pathtest", path="${tmpdir}:"); new tmp1 = file.reader("pathtest", path="${tmpdir}/d1:");
new tmp2 = file.reader("pathtest", path=":${tmpdir}"); new tmp2 = file.reader("pathtest", path=":${tmpdir}/d1");
} }
sub vcl_recv { sub vcl_recv {
...@@ -112,8 +118,8 @@ client c1 { ...@@ -112,8 +118,8 @@ client c1 {
txreq txreq
rxresp rxresp
expect resp.status == 200 expect resp.status == 200
expect resp.http.Tmp1 == "tmponly" expect resp.http.Tmp1 == "1 only"
expect resp.http.Tmp2 == "tmponly" expect resp.http.Tmp2 == "1 only"
} -run } -run
shell { shell {
...@@ -130,15 +136,16 @@ varnish v1 -errvcl {new rdr: unreadable not found or not readable on path} { ...@@ -130,15 +136,16 @@ varnish v1 -errvcl {new rdr: unreadable not found or not readable on path} {
} }
} }
shell {rm -f ${tmpdir}/pathtest} shell {rm -f ${tmpdir}/d1/pathtest}
shell {rm -f ${testdir}/pathtest} shell {rm -f ${tmpdir}/d2/pathtest}
varnish v1 -errvcl {new rdr: pathtest not found or not readable on path} { varnish v1 -errvcl {new rdr: pathtest not found or not readable on path} {
import ${vmod_file}; import ${vmod_file};
backend b { .host = "${bad_ip}"; } backend b { .host = "${bad_ip}"; }
sub vcl_init { sub vcl_init {
new rdr = file.reader("pathtest", path="${tmpdir}:${testdir}"); new rdr = file.reader("pathtest",
path="${tmpdir}/d1:${tmpdir}/d2");
} }
} }
......
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