[master] 1ccba7210 varnishtest: Teach logexpect to stop with the vtc

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed Jun 23 07:00:10 UTC 2021


commit 1ccba7210d062e856672d443364d4fc4c7cfe9ae
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Wed Jun 23 08:22:31 2021 +0200

    varnishtest: Teach logexpect to stop with the vtc
    
    With a non-deterministic `expect * * ...` the logexpect thread would
    never consider itself to be done if the vtc ends if one entry was not
    seen in the vsl.

diff --git a/bin/varnishtest/vtc_logexp.c b/bin/varnishtest/vtc_logexp.c
index d1af7d733..ba7818555 100644
--- a/bin/varnishtest/vtc_logexp.c
+++ b/bin/varnishtest/vtc_logexp.c
@@ -545,7 +545,7 @@ logexp_thread(void *priv)
 	if (le->query != NULL)
 		vtc_log(le->vl, 4, "qry| %s", le->query);
 	logexp_next(le);
-	while (! logexp_done(le)) {
+	while (!logexp_done(le) && !vtc_stop && !vtc_error) {
 		i = VSLQ_Dispatch(le->vslq, logexp_dispatch, le);
 		if (i == 2 && le->err_arg) {
 			vtc_log(le->vl, 4, "end| failed as expected");
@@ -558,6 +558,8 @@ logexp_thread(void *priv)
 		else if (i == 0 && ! logexp_done(le))
 			VTIM_sleep(0.01);
 	}
+	if (!logexp_done(le))
+		vtc_fatal(le->vl, "bad| outstanding expectations");
 	vtc_log(le->vl, 4, "end|");
 
 	return (NULL);


More information about the varnish-commit mailing list