[master] 0887a4f Try to firm up v00010 even more, by explicitly waiting for the crashing child to do so, and then explicitly start it again.

Poul-Henning Kamp phk at varnish-cache.org
Thu Oct 6 13:02:51 CEST 2011


commit 0887a4f9891e13c2249558041e743ddc6f6e0e8a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Oct 6 10:48:57 2011 +0000

    Try to firm up v00010 even more, by explicitly waiting for the
    crashing child to do so, and then explicitly start it again.

diff --git a/bin/varnishtest/tests/v00010.vtc b/bin/varnishtest/tests/v00010.vtc
index 0421956..45dbc79 100644
--- a/bin/varnishtest/tests/v00010.vtc
+++ b/bin/varnishtest/tests/v00010.vtc
@@ -27,9 +27,6 @@ varnish v1 -cliok "param.set diag_bitmap 0x00001000"
 # Force the (random) port selected to be used again after restart.
 varnish v1 -cliok "param.set listen_address ${v1_addr}:${v1_port}"
 
-# varnishtest defaults to auto_restart off, to avoid masking bugs.
-varnish v1 -cliok "param.set auto_restart on" 
-
 client c1 {
 	txreq -url "/"
 	rxresp
@@ -37,6 +34,11 @@ client c1 {
 	# Don't expect answer, the server crashed.
 } -run
 
+varnish v1 -wait-stopped
+varnish v1 -cliok "panic.show"
+varnish v1 -cliok "panic.clear"
+varnish v1 -clierr 300 "panic.clear"
+varnish v1 -cliok "start"
 varnish v1 -wait-running
 sema r1 sync 2
 
@@ -45,7 +47,3 @@ client c1 {
 	rxresp
 	expect resp.http.foo == "foo"
 } -run
-
-varnish v1 -cliok "panic.show"
-varnish v1 -cliok "panic.clear"
-varnish v1 -clierr 300 "panic.clear"
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 9ba34a7..9690a23 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -124,12 +124,37 @@ varnish_ask_cli(const struct varnish *v, const char *cmd, char **repl)
  */
 
 static void
+wait_stopped(const struct varnish *v)
+{
+	char *r;
+	enum VCLI_status_e st;
+
+	while (1) {
+		vtc_log(v->vl, 3, "wait-stopped");
+		st = varnish_ask_cli(v, "status", &r);
+		if (st != CLIS_OK)
+			vtc_log(v->vl, 0,
+			    "CLI status command failed: %u %s", st, r);
+		if (!strcmp(r, "Child in state stopped")) {
+			free(r);
+			break;
+		}
+		free(r);
+		(void)usleep(200000);
+	}
+}
+/**********************************************************************
+ *
+ */
+
+static void
 wait_running(const struct varnish *v)
 {
 	char *r;
 	enum VCLI_status_e st;
 
 	while (1) {
+		vtc_log(v->vl, 3, "wait-running");
 		st = varnish_ask_cli(v, "status", &r);
 		if (st != CLIS_OK)
 			vtc_log(v->vl, 0,
@@ -848,6 +873,10 @@ cmd_varnish(CMD_ARGS)
 			varnish_stop(v);
 			continue;
 		}
+		if (!strcmp(*av, "-wait-stopped")) {
+			wait_stopped(v);
+			continue;
+		}
 		if (!strcmp(*av, "-wait-running")) {
 			wait_running(v);
 			continue;



More information about the varnish-commit mailing list