Commit 110d0732 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Add a vsl_catchup varnishtest function

This enables waiting for the logging thread to idle to make sure all
generated log is caught.
parent 744e55dc
......@@ -82,6 +82,7 @@ struct varnish {
unsigned vsl_tag_count[256];
volatile int vsl_rec;
volatile int vsl_idle;
};
#define NONSENSE "%XJEIFLH|)Xspa8P"
......@@ -182,6 +183,16 @@ wait_running(const struct varnish *v)
* Varnishlog gatherer thread
*/
static void
vsl_catchup(const struct varnish *v)
{
int vsl_idle;
vsl_idle = v->vsl_idle;
while (vsl_idle == v->vsl_idle)
VTIM_sleep(0.1);
}
static void *
varnishlog_thread(void *priv)
{
......@@ -249,6 +260,7 @@ varnishlog_thread(void *priv)
}
if (i == 0) {
/* Nothing to do but wait */
v->vsl_idle++;
VTIM_sleep(0.1);
} else if (i == -2) {
/* Abandoned - try reconnect */
......@@ -1054,6 +1066,10 @@ varnish_expect(const struct varnish *v, char * const *av)
* style pattern (ie: fnmatch(3)) as used in shell filename expansion.
* To see all counters use pattern "*", to see all counters about
* requests use "*req*".
*
* \-vsl_catchup
* Wait until the logging thread has idled to make sure that all
* the generated log is flushed
*/
void
......@@ -1209,6 +1225,10 @@ cmd_varnish(CMD_ARGS)
varnish_wait(v);
continue;
}
if (!strcmp(*av, "-vsl_catchup")) {
vsl_catchup(v);
continue;
}
vtc_fatal(v->vl, "Unknown varnish argument: %s", *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