Commit 0032bfe5 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add a Reset pass after each testfile



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2698 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 2552d36f
......@@ -217,6 +217,18 @@ parse_string(char *buf, const struct cmds *cmd, void *priv)
}
}
/**********************************************************************
* Reset commands (between tests)
*/
static void
reset_cmds(const struct cmds *cmd)
{
for (; cmd->name != NULL; cmd++)
cmd->cmd(NULL, NULL);
}
/**********************************************************************
* Output test description
*/
......@@ -224,7 +236,11 @@ parse_string(char *buf, const struct cmds *cmd, void *priv)
static void
cmd_test(char **av, void *priv)
{
(void)priv;
if (av == NULL)
return;
assert(!strcmp(av[0], "test"));
printf("# TEST %s\n", av[1]);
......@@ -240,6 +256,8 @@ void
cmd_dump(char **av, void *priv)
{
if (av == NULL)
return;
printf("cmd_dump(%p)\n", priv);
while (*av)
printf("\t<%s>\n", *av++);
......@@ -264,6 +282,7 @@ exec_file(const char *fn)
buf = read_file(fn);
parse_string(buf, cmds, NULL);
printf("# TEST %s completed\n", fn);
reset_cmds(cmds);
}
/**********************************************************************
......
......@@ -163,9 +163,20 @@ client_run(struct client *c)
void
cmd_client(char **av, void *priv)
{
struct client *c;
struct client *c, *c2;
(void)priv;
if (av == NULL) {
/* Reset and free */
VTAILQ_FOREACH_SAFE(c, &clients, list, c2) {
VTAILQ_REMOVE(&clients, c, list);
FREE_OBJ(c);
/* XXX: MEMLEAK */
}
return;
}
assert(!strcmp(av[0], "client"));
av++;
......
......@@ -165,6 +165,8 @@ server_wait(struct server *s)
exit (1);
}
s->tp = NULL;
AZ(close(s->sock));
s->sock = -1;
}
/**********************************************************************
......@@ -174,9 +176,20 @@ server_wait(struct server *s)
void
cmd_server(char **av, void *priv)
{
struct server *s;
struct server *s, *s2;
(void)priv;
if (av == NULL) {
/* Reset and free */
VTAILQ_FOREACH_SAFE(s, &servers, list, s2) {
VTAILQ_REMOVE(&servers, s, list);
FREE_OBJ(s);
/* XXX: MEMLEAK */
}
return;
}
assert(!strcmp(av[0], "server"));
av++;
......
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