[master] b62d92ebf varnishtest logexpect: remove implicit fail list clear

Nils Goroll nils.goroll at uplex.de
Thu Jan 14 15:24:07 UTC 2021


commit b62d92ebf282c3cd1dd1d6d929d28d90c78552b1
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Jan 14 16:22:00 2021 +0100

    varnishtest logexpect: remove implicit fail list clear
    
    Dridi noticed that my reasoning about this was flawed: One transaction
    ending does not imply no other transactions coming.

diff --git a/bin/varnishtest/tests/b00074.vtc b/bin/varnishtest/tests/b00074.vtc
index ebacf9260..8a0d0f0ae 100644
--- a/bin/varnishtest/tests/b00074.vtc
+++ b/bin/varnishtest/tests/b00074.vtc
@@ -27,6 +27,8 @@ varnish v1 -vcl {
 logexpect l1 -v v1 -g vxid -q "vxid == 1001" {
 	fail add *	Error		"out of workspace"
 	fail add *	VCL_Error	"Workspace overflow"
+	expect * 1001	End
+	fail clear
 } -start
 
 logexpect l2 -v v1 -err -g vxid -q "vxid == 1001" {
@@ -46,8 +48,6 @@ client c1 {
 	rxresp
 } -run
 
-# -g raw needs an explicit expect and "fail clear" at the end
-# because the raw transaction never ends
 logexpect l4 -v v1 -d 1 -g raw {
 	fail add *	VCL_Log	^i2
 	expect * 0	VCL_Log	^i0
diff --git a/bin/varnishtest/vtc_logexp.c b/bin/varnishtest/vtc_logexp.c
index 9ffd4a92b..d1af7d733 100644
--- a/bin/varnishtest/vtc_logexp.c
+++ b/bin/varnishtest/vtc_logexp.c
@@ -132,13 +132,13 @@
  * a logexpect. All active fail specifications are matched against every
  * log line and, if any match, the logexpect fails immediately.
  *
- * For transactional vsls (-g <session|request|vxid>), a fail list can be used
- * without limitation: When the transaction ends, the logexpect ends
- * successfully if no specification from the fail list matched.
+ * For a logexpect to end successfully, there must be no specs on the fail list,
+ * so logexpects should always end with
  *
- * For raw mode (-g raw), however, the log never ends, so for a logexpect to
- * finish successfully, a "fail clear" is required after some match which
- * determines that no further negative matching is required.
+ *      expect <skip> <vxid> <tag> <termination-condition>
+ *      fail clear
+ *
+ * XXX can we come up with a better solution which is still safe?
  */
 
 #include "config.h"
@@ -526,10 +526,6 @@ logexp_dispatch(struct VSL_data *vsl, struct VSL_transaction * const pt[],
 				return (1);
 		}
 	}
-	// transaction end
-	if (le->g_arg != VSL_g_raw)
-		VTAILQ_INIT(&le->fail);
-
 	return (0);
 }
 


More information about the varnish-commit mailing list