[master] 0d63862 Include vcl.use in varnish -vcl failure detection
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Fri Feb 3 17:39:05 CET 2017
commit 0d6386265d2e7bdc4259d793fa6692983a5a5da8
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Fri Feb 3 17:18:42 2017 +0100
Include vcl.use in varnish -vcl failure detection
Instead of crashing the varnishtest sub-process with an assert,
check that both `vcl.load` and `vcl.use` pass or fail when running
the varnish command for `-vcl` and `-errvcl`. `vcl.use` may fail
the warmup step.
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 7a2e710..745312e 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -732,21 +732,19 @@ varnish_vcl(struct varnish *v, const char *vcl, int fail, char **resp)
AZ(VSB_finish(vsb));
u = varnish_ask_cli(v, VSB_data(vsb), resp);
- if (u == CLIS_OK && fail) {
- VSB_destroy(&vsb);
- vtc_fatal(v->vl,
- "VCL compilation succeeded expected failure");
- } else if (u == CLIS_OK) {
+ if (u == CLIS_OK) {
VSB_clear(vsb);
VSB_printf(vsb, "vcl.use vcl%d", v->vcl_nbr);
AZ(VSB_finish(vsb));
u = varnish_ask_cli(v, VSB_data(vsb), NULL);
- assert(u == CLIS_OK);
- } else if (!fail) {
+ }
+ if (u == CLIS_OK && fail) {
VSB_destroy(&vsb);
- vtc_fatal(v->vl,
- "VCL compilation failed expected success");
- } else {
+ vtc_fatal(v->vl, "VCL compilation succeeded expected failure");
+ } else if (u != CLIS_OK && !fail) {
+ VSB_destroy(&vsb);
+ vtc_fatal(v->vl, "VCL compilation failed expected success");
+ } else if (fail) {
vtc_log(v->vl, 2, "VCL compilation failed (as expected)");
}
VSB_destroy(&vsb);
More information about the varnish-commit
mailing list