[master] b9839ab Make it possible to expect a non-zero varnishd exit code

Poul-Henning Kamp phk at FreeBSD.org
Sun Nov 19 16:30:11 UTC 2017


commit b9839abc1605335be2091efdb16bf9a5985159be
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Sun Nov 19 16:01:44 2017 +0000

    Make it possible to expect a non-zero varnishd exit code

diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index afc346c..569ad7b 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -70,6 +70,8 @@ struct varnish {
 	pthread_t		tp;
 	pthread_t		tp_vsl;
 
+	int			expect_exit;
+
 	int			cli_fd;
 	int			vcl_nbr;
 	char			*workdir;
@@ -645,7 +647,7 @@ varnish_cleanup(struct varnish *v)
 	/* Pick up the VSL thread */
 	AZ(pthread_join(v->tp_vsl, &p));
 
-	if (WIFEXITED(status) && (WEXITSTATUS(status) == 0))
+	if (WIFEXITED(status) && (WEXITSTATUS(status) == v->expect_exit))
 		return;
 #ifdef WCOREDUMP
 	vtc_fatal(v->vl, "Bad exit code: %04x sig %x exit %x core %x",
@@ -1048,6 +1050,8 @@ varnish_expect(const struct varnish *v, char * const *av)
  *         example::
  *
  *                 varnish v1 -expect SM?.s1.g_space > 1000000
+ * \-expectexit NUMBER
+ *	   Expect varnishd to exit(3) with this value
  *
  * \-vsc PATTERN
  *         Dump VSC counters matching PATTERN.
@@ -1154,6 +1158,11 @@ cmd_varnish(CMD_ARGS)
 			av += 2;
 			continue;
 		}
+		if (!strcmp(*av, "-expectexit")) {
+			v->expect_exit = strtoul(av[1], NULL, 0);
+			av++;
+			continue;
+		}
 		if (!strcmp(*av, "-jail")) {
 			AN(av[1]);
 			AZ(v->pid);


More information about the varnish-commit mailing list