Skip to content

Commit

Permalink
Make it possible to expect a non-zero varnishd exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
bsdphk committed Nov 19, 2017
1 parent ffcbf13 commit b9839ab
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion bin/varnishtest/vtc_varnish.c
Expand Up @@ -70,6 +70,8 @@ struct varnish {
pthread_t tp;
pthread_t tp_vsl;

int expect_exit;

int cli_fd;
int vcl_nbr;
char *workdir;
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit b9839ab

Please sign in to comment.