Commit 9699d82d authored by Martin Blix Grydeland's avatar Martin Blix Grydeland Committed by Pål Hermunn Johansen

Add a vsl_catchup varnishtest function

This enables waiting for the logging thread to idle to make sure all
generated log is caught.

Conflicts:
	bin/varnishtest/vtc_varnish.c
parent 89c13d39
......@@ -79,6 +79,7 @@ struct varnish {
unsigned vsl_tag_count[256];
volatile int vsl_rec;
volatile int vsl_idle;
};
......@@ -186,6 +187,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)
{
......@@ -231,6 +242,7 @@ varnishlog_thread(void *priv)
if (i == 0) {
v->vsl_idle++;
/* Nothing to do but wait */
v->vsl_idle++;
VTIM_sleep(0.1);
continue;
} else if (i == -2) {
......@@ -994,6 +1006,10 @@ varnish_expect(const struct varnish *v, char * const *av)
* a correct value. OP can be ==, >, >=, <, <=. For example::
*
* varnish v1 -expect SMA.s1.g_space > 1000000
*
* \-vsl_catchup
* Wait until the logging thread has idled to make sure that all
* the generated log is flushed
*/
void
......@@ -1130,6 +1146,10 @@ cmd_varnish(CMD_ARGS)
varnish_wait(v);
continue;
}
if (!strcmp(*av, "-vsl_catchup")) {
vsl_catchup(v);
continue;
}
vtc_log(v->vl, 0, "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