From eba14f11a3b88029ecd5f2b1c2208c755c8a3ee2 Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 7 Jul 2008 17:16:50 +0000 Subject: [PATCH] Add -badvcl for VCL code we expect the compiler to whine about. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2879 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishtest/vtc_varnish.c | 25 +++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/varnish-cache/bin/varnishtest/vtc_varnish.c b/varnish-cache/bin/varnishtest/vtc_varnish.c index e2d41305..d77dc2b0 100644 --- a/varnish-cache/bin/varnishtest/vtc_varnish.c +++ b/varnish-cache/bin/varnishtest/vtc_varnish.c @@ -310,7 +310,7 @@ varnish_cli(struct varnish *v, const char *cli) */ static void -varnish_vcl(struct varnish *v, const char *vcl) +varnish_vcl(struct varnish *v, const char *vcl, enum cli_status_e expect) { struct vsb *vsb; enum cli_status_e u; @@ -343,13 +343,15 @@ varnish_vcl(struct varnish *v, const char *vcl) AZ(vsb_overflowed(vsb)); u = varnish_ask_cli(v, vsb_data(vsb), NULL); - assert(u == CLIS_OK); - vsb_clear(vsb); - vsb_printf(vsb, "vcl.use vcl%d", v->vcl_nbr); - vsb_finish(vsb); - AZ(vsb_overflowed(vsb)); - u = varnish_ask_cli(v, vsb_data(vsb), NULL); - assert(u == CLIS_OK); + assert(u == expect); + if (u == CLIS_OK) { + vsb_clear(vsb); + vsb_printf(vsb, "vcl.use vcl%d", v->vcl_nbr); + vsb_finish(vsb); + AZ(vsb_overflowed(vsb)); + u = varnish_ask_cli(v, vsb_data(vsb), NULL); + assert(u == CLIS_OK); + } vsb_delete(vsb); } @@ -466,8 +468,13 @@ cmd_varnish(CMD_ARGS) av++; continue; } + if (!strcmp(*av, "-badvcl")) { + varnish_vcl(v, av[1], CLIS_PARAM); + av++; + continue; + } if (!strcmp(*av, "-vcl")) { - varnish_vcl(v, av[1]); + varnish_vcl(v, av[1], CLIS_OK); av++; continue; } -- 2.39.5