[4.1] 9699d82 Add a vsl_catchup varnishtest function
PÃ¥l Hermunn Johansen
hermunn at varnish-software.com
Thu Jun 15 15:59:10 CEST 2017
commit 9699d82d97bb78c6307339d3b8443f72e4b34d9b
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Wed Mar 22 18:09:12 2017 +0100
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
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 1774b78..98c15cc 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -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);
}
}
More information about the varnish-commit
mailing list