From 2535dc388c77019f28700cfb22ff485636dca809 Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 1 Aug 2008 09:50:28 +0000 Subject: [PATCH] Actually wait for the varnish child to stop in "varnish -stop". Update test-case git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3055 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishtest/tests/b00004.vtc | 18 +++++++++--------- varnish-cache/bin/varnishtest/vtc_varnish.c | 8 ++++++++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/varnish-cache/bin/varnishtest/tests/b00004.vtc b/varnish-cache/bin/varnishtest/tests/b00004.vtc index 5817b5af..0839fddd 100644 --- a/varnish-cache/bin/varnishtest/tests/b00004.vtc +++ b/varnish-cache/bin/varnishtest/tests/b00004.vtc @@ -8,6 +8,15 @@ server s1 { varnish v1 -vcl+backend { } +varnish v1 -start +varnish v1 -stop + +varnish v1 -start +varnish v1 -stop + +varnish v1 -start +varnish v1 -stop + varnish v1 -cliok start varnish v1 -clierr 300 start varnish v1 -clierr 300 start @@ -16,13 +25,4 @@ varnish v1 -cliok stop varnish v1 -clierr 300 stop varnish v1 -clierr 300 stop -varnish v1 -cliok start -varnish v1 -cliok stop - -varnish v1 -cliok start -varnish v1 -cliok stop - -varnish v1 -cliok start -varnish v1 -cliok stop - varnish v1 -wait diff --git a/varnish-cache/bin/varnishtest/vtc_varnish.c b/varnish-cache/bin/varnishtest/vtc_varnish.c index bd7fccca..f6fcfcff 100644 --- a/varnish-cache/bin/varnishtest/vtc_varnish.c +++ b/varnish-cache/bin/varnishtest/vtc_varnish.c @@ -268,11 +268,19 @@ varnish_start(struct varnish *v) static void varnish_stop(struct varnish *v) { + char *r; if (v->cli_fd < 0) varnish_launch(v); vtc_log(v->vl, 2, "Stop"); (void)varnish_ask_cli(v, "stop", NULL); + while (1) { + (void)varnish_ask_cli(v, "status", &r); + if (!strcmp(r, "Child in state stopped")) + break; + free(r); + sleep (1); + } } /********************************************************************** -- 2.39.5