Commit 0887a4f9 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Try to firm up v00010 even more, by explicitly waiting for the

crashing child to do so, and then explicitly start it again.
parent 91280b2a
...@@ -27,9 +27,6 @@ varnish v1 -cliok "param.set diag_bitmap 0x00001000" ...@@ -27,9 +27,6 @@ varnish v1 -cliok "param.set diag_bitmap 0x00001000"
# Force the (random) port selected to be used again after restart. # Force the (random) port selected to be used again after restart.
varnish v1 -cliok "param.set listen_address ${v1_addr}:${v1_port}" 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 { client c1 {
txreq -url "/" txreq -url "/"
rxresp rxresp
...@@ -37,6 +34,11 @@ client c1 { ...@@ -37,6 +34,11 @@ client c1 {
# Don't expect answer, the server crashed. # Don't expect answer, the server crashed.
} -run } -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 varnish v1 -wait-running
sema r1 sync 2 sema r1 sync 2
...@@ -45,7 +47,3 @@ client c1 { ...@@ -45,7 +47,3 @@ client c1 {
rxresp rxresp
expect resp.http.foo == "foo" expect resp.http.foo == "foo"
} -run } -run
varnish v1 -cliok "panic.show"
varnish v1 -cliok "panic.clear"
varnish v1 -clierr 300 "panic.clear"
...@@ -119,6 +119,30 @@ varnish_ask_cli(const struct varnish *v, const char *cmd, char **repl) ...@@ -119,6 +119,30 @@ varnish_ask_cli(const struct varnish *v, const char *cmd, char **repl)
return ((enum VCLI_status_e)retval); return ((enum VCLI_status_e)retval);
} }
/**********************************************************************
*
*/
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);
}
}
/********************************************************************** /**********************************************************************
* *
*/ */
...@@ -130,6 +154,7 @@ wait_running(const struct varnish *v) ...@@ -130,6 +154,7 @@ wait_running(const struct varnish *v)
enum VCLI_status_e st; enum VCLI_status_e st;
while (1) { while (1) {
vtc_log(v->vl, 3, "wait-running");
st = varnish_ask_cli(v, "status", &r); st = varnish_ask_cli(v, "status", &r);
if (st != CLIS_OK) if (st != CLIS_OK)
vtc_log(v->vl, 0, vtc_log(v->vl, 0,
...@@ -848,6 +873,10 @@ cmd_varnish(CMD_ARGS) ...@@ -848,6 +873,10 @@ cmd_varnish(CMD_ARGS)
varnish_stop(v); varnish_stop(v);
continue; continue;
} }
if (!strcmp(*av, "-wait-stopped")) {
wait_stopped(v);
continue;
}
if (!strcmp(*av, "-wait-running")) { if (!strcmp(*av, "-wait-running")) {
wait_running(v); wait_running(v);
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment