]> err.no Git - varnish/commitdiff
Add
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 1 Aug 2008 08:23:30 +0000 (08:23 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 1 Aug 2008 08:23:30 +0000 (08:23 +0000)
-cliok <cli_cmd>
and
-clierr <expected_status> <cli_cmd>

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3051 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishtest/vtc_varnish.c

index b725339ddde8acbc3b0eefc9a5fe084017010c99..3a65b5200dd365dcf5449d59921dc34d086dc1e2 100644 (file)
@@ -301,7 +301,7 @@ varnish_wait(struct varnish *v)
  */
 
 static void
-varnish_cli(struct varnish *v, const char *cli)
+varnish_cli(struct varnish *v, const char *cli, unsigned exp)
 {
        enum cli_status_e u;
 
@@ -309,6 +309,8 @@ varnish_cli(struct varnish *v, const char *cli)
                varnish_launch(v);
        u = varnish_ask_cli(v, cli, NULL);
        vtc_log(v->vl, 2, "CLI %03u <%s>", u, cli);
+       if (exp != 0 && exp != u)
+               vtc_log(v->vl, 0, "FAIL CLI response %u expected %u", u, exp);
 }
 
 /**********************************************************************
@@ -470,25 +472,42 @@ cmd_varnish(CMD_ARGS)
 
        for (; *av != NULL; av++) {
                if (!strcmp(*av, "-telnet")) {
+                       AN(av[1]);
                        v->telnet = av[1];
                        av++;
                        continue;
                }
                if (!strcmp(*av, "-accept")) {
+                       AN(av[1]);
                        v->accept = av[1];
                        av++;
                        continue;
                }
                if (!strcmp(*av, "-arg")) {
+                       AN(av[1]);
                        v->args = av[1];
                        av++;
                        continue;
                }
                if (!strcmp(*av, "-cli")) {
-                       varnish_cli(v, av[1]);
+                       AN(av[1]);
+                       varnish_cli(v, av[1], 0);
                        av++;
                        continue;
                }
+               if (!strcmp(*av, "-cliok")) {
+                       AN(av[1]);
+                       varnish_cli(v, av[1], CLIS_OK);
+                       av++;
+                       continue;
+               }
+               if (!strcmp(*av, "-clierr")) {
+                       AN(av[1]);
+                       AN(av[2]);
+                       varnish_cli(v, av[2], atoi(av[1]));
+                       av += 2;
+                       continue;
+               }
                if (!strcmp(*av, "-launch")) {
                        varnish_launch(v);
                        continue;
@@ -498,16 +517,19 @@ cmd_varnish(CMD_ARGS)
                        continue;
                }
                if (!strcmp(*av, "-vcl+backend")) {
+                       AN(av[1]);
                        varnish_vclbackend(v, av[1]);
                        av++;
                        continue;
                }
                if (!strcmp(*av, "-badvcl")) {
+                       AN(av[1]);
                        varnish_vcl(v, av[1], CLIS_PARAM);
                        av++;
                        continue;
                }
                if (!strcmp(*av, "-vcl")) {
+                       AN(av[1]);
                        varnish_vcl(v, av[1], CLIS_OK);
                        av++;
                        continue;