[master] f5ffd65 Fail the test if we panic when stopping the child

Federico G. Schwindt fgsch at lodoss.net
Sun Sep 10 23:56:04 UTC 2017


commit f5ffd65d7250fc9457bf2c82371d3034e9498469
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Mon Sep 11 01:53:10 2017 +0200

    Fail the test if we panic when stopping the child

diff --git a/bin/varnishtest/tests/c00057.vtc b/bin/varnishtest/tests/c00057.vtc
index c7ee3c6..5853b70 100644
--- a/bin/varnishtest/tests/c00057.vtc
+++ b/bin/varnishtest/tests/c00057.vtc
@@ -38,4 +38,4 @@ client c1 {
 	expect_close
 } -run
 
-varnish v1 -cliok "panic.show"
+varnish v1 -cliok "panic.clear"
diff --git a/bin/varnishtest/tests/p00007.vtc b/bin/varnishtest/tests/p00007.vtc
index 7cb0743..559f170 100644
--- a/bin/varnishtest/tests/p00007.vtc
+++ b/bin/varnishtest/tests/p00007.vtc
@@ -56,6 +56,8 @@ varnish v1 -cliok "debug.persistent s0 dump"
 # Panic worker so second segment does not get closed
 varnish v1 -clierr 400 "debug.panic.worker"
 
+varnish v1 -cliok "panic.clear"
+
 delay 0.5
 
 # start again
diff --git a/bin/varnishtest/tests/t02004.vtc b/bin/varnishtest/tests/t02004.vtc
index 58e8743..24610d1 100644
--- a/bin/varnishtest/tests/t02004.vtc
+++ b/bin/varnishtest/tests/t02004.vtc
@@ -24,4 +24,4 @@ client c1 {
 	expect_close
 } -run
 
-varnish v1 -wait-stopped
+varnish v1 -cliok "panic.clear"
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 6dfaae7..33cfcb9 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -137,8 +137,8 @@ wait_stopped(const struct varnish *v)
 	char *r = NULL;
 	enum VCLI_status_e st;
 
+	vtc_log(v->vl, 3, "wait-stopped");
 	while (1) {
-		vtc_log(v->vl, 3, "wait-stopped");
 		st = varnish_ask_cli(v, "status", &r);
 		if (st != CLIS_OK)
 			vtc_fatal(v->vl,
@@ -600,26 +600,13 @@ varnish_start(struct varnish *v)
 static void
 varnish_stop(struct varnish *v)
 {
-	char *r = NULL;
-
 	if (v->cli_fd < 0)
 		varnish_launch(v);
 	if (vtc_error)
 		return;
 	vtc_log(v->vl, 2, "Stop");
 	(void)varnish_ask_cli(v, "stop", NULL);
-	while (1) {
-		(void)varnish_ask_cli(v, "status", &r);
-		AN(r);
-		if (!strcmp(r, "Child in state stopped")) {
-			free(r);
-			break;
-		}
-		free(r);
-		r = NULL;
-		(void)sleep (1);
-		/* XXX: should fail eventually */
-	}
+	wait_stopped(v);
 }
 
 /**********************************************************************
@@ -685,6 +672,9 @@ varnish_wait(struct varnish *v)
 	/* Then stop it */
 	varnish_stop(v);
 
+	if (varnish_ask_cli(v, "panic.clear", NULL) != CLIS_CANT)
+		vtc_fatal(v->vl, "Unexpected panic");
+
 	varnish_cleanup(v);
 }
 


More information about the varnish-commit mailing list