]> err.no Git - varnish/commitdiff
Add -badvcl for VCL code we expect the compiler to whine about.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 7 Jul 2008 17:16:50 +0000 (17:16 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 7 Jul 2008 17:16:50 +0000 (17:16 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2879 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishtest/vtc_varnish.c

index e2d41305e82e0b6937daea41cbd7a4f860767e9e..d77dc2b07bfcc446e4a3a26543acbd0e9dd4e199 100644 (file)
@@ -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;
                }