[master] a063045 Fix the symbol pattern for probe definitions
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Thu Sep 8 23:26:11 CEST 2016
commit a063045dc337f0252e47fc6b7701df1fa8d2ce36
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Thu Sep 8 23:20:48 2016 +0200
Fix the symbol pattern for probe definitions
To avoid another regression, a test case now passes a probe to the debug
VMOD. This problem was discovered while working on #2068.
diff --git a/bin/varnishtest/tests/m00025.vtc b/bin/varnishtest/tests/m00025.vtc
new file mode 100644
index 0000000..cdd6a8e
--- /dev/null
+++ b/bin/varnishtest/tests/m00025.vtc
@@ -0,0 +1,13 @@
+varnishtest "Pass probe definitions to VMODs"
+
+varnish v1 -vcl {
+ import debug;
+
+ backend be { .host = "${bad_ip}"; }
+ probe pb { }
+
+ sub vcl_init {
+ debug.test_probe(pb);
+ debug.test_probe(pb, pb);
+ }
+}
diff --git a/lib/libvcc/vcc_backend.c b/lib/libvcc/vcc_backend.c
index 5847e72..a5b5b5e 100644
--- a/lib/libvcc/vcc_backend.c
+++ b/lib/libvcc/vcc_backend.c
@@ -258,7 +258,8 @@ vcc_ParseProbe(struct vcc *tl)
t_probe = tl->t;
vcc_NextToken(tl);
- (void)VCC_HandleSymbol(tl, t_probe, PROBE, "%.s", PF(t_probe));
+ (void)VCC_HandleSymbol(tl, t_probe, PROBE, "&vgc_probe_%.*s",
+ PF(t_probe));
ERRCHK(tl);
vcc_ParseProbeSpec(tl, t_probe, &p);
diff --git a/lib/libvmod_debug/vmod.vcc b/lib/libvmod_debug/vmod.vcc
index 973337d..cbe9de8 100644
--- a/lib/libvmod_debug/vmod.vcc
+++ b/lib/libvmod_debug/vmod.vcc
@@ -168,3 +168,7 @@ Perform an IP match against a named ACL.
$Function BOOL barrier_sync(STRING)
Synchronize with a varnishtest shared barrier.
+
+$Function VOID test_probe(PROBE probe, PROBE same = 0)
+
+Only here to make sure probe definitions are passed properly.
diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c
index d58856a..dc9e347 100644
--- a/lib/libvmod_debug/vmod_debug.c
+++ b/lib/libvmod_debug/vmod_debug.c
@@ -515,3 +515,13 @@ vmod_barrier_sync(VRT_CTX, VCL_STRING addr)
VSLb(ctx->vsl, SLT_Error, "Barrier unexpected data (%zdB)", sz);
return (0);
}
+
+VCL_VOID
+vmod_test_probe(VRT_CTX, VCL_PROBE probe, VCL_PROBE same)
+{
+
+ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
+ CHECK_OBJ_NOTNULL(probe, VRT_BACKEND_PROBE_MAGIC);
+ CHECK_OBJ_ORNULL(same, VRT_BACKEND_PROBE_MAGIC);
+ AZ(same == NULL || probe == same);
+}
More information about the varnish-commit
mailing list