r3938 - trunk/varnish-cache/bin/varnishtest

phk at projects.linpro.no phk at projects.linpro.no
Mon Mar 16 14:28:32 CET 2009


Author: phk
Date: 2009-03-16 14:28:32 +0100 (Mon, 16 Mar 2009)
New Revision: 3938

Modified:
   trunk/varnish-cache/bin/varnishtest/vtc_varnish.c
Log:
Allow multiple -arg arguments 



Modified: trunk/varnish-cache/bin/varnishtest/vtc_varnish.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_varnish.c	2009-03-16 12:19:58 UTC (rev 3937)
+++ trunk/varnish-cache/bin/varnishtest/vtc_varnish.c	2009-03-16 13:28:32 UTC (rev 3938)
@@ -66,7 +66,7 @@
 
 	struct varnish_stats	*stats;
 
-	const char		*args;
+	struct vsb 		*args;
 	int			fds[4];
 	pid_t			pid;
 	const char		*telnet;
@@ -155,7 +155,7 @@
 	if (*v->name != 'v')
 		vtc_log(v->vl, 0, "Varnish name must start with 'v'");
 
-	v->args = "";
+	v->args = vsb_newauto();
 	v->telnet = "127.0.0.1:9001";
 	v->accept = "127.0.0.1:9081";
 	v->cli_fd = -1;
@@ -220,6 +220,8 @@
 	struct vsb *vsb;
 	int i;
 
+	vsb_finish(v->args);
+	AZ(vsb_overflowed(v->args));
 	vtc_log(v->vl, 2, "Launch");
 	vsb = vsb_newauto();
 	AN(vsb);
@@ -229,7 +231,7 @@
 	vsb_printf(vsb, " -p auto_restart=off");
 	vsb_printf(vsb, " -a '%s' -T %s", v->accept, v->telnet);
 	vsb_printf(vsb, " -P /tmp/__%s/varnishd.pid", v->name);
-	vsb_printf(vsb, " %s", v->args);
+	vsb_printf(vsb, " %s", vsb_data(v->args));
 	vsb_finish(vsb);
 	AZ(vsb_overflowed(vsb));
 	vtc_log(v->vl, 3, "CMD: %s", vsb_data(vsb));
@@ -340,6 +342,8 @@
 
 	if (v->cli_fd < 0)
 		return;
+	if (vtc_error)
+		sleep(1);	/* give panic messages a chance */
 	varnish_stop(v);
 	vtc_log(v->vl, 2, "Wait");
 	AZ(close(v->cli_fd));
@@ -569,7 +573,8 @@
 		}
 		if (!strcmp(*av, "-arg")) {
 			AN(av[1]);
-			v->args = av[1];
+			vsb_cat(v->args, " ");
+			vsb_cat(v->args, av[1]);
 			av++;
 			continue;
 		}



More information about the varnish-commit mailing list