[master] b3f8a26 Stabilize position output for ESI_xmlerror & more e8.vtc coverage
Nils Goroll
nils.goroll at uplex.de
Sat Nov 4 17:55:11 UTC 2017
commit b3f8a26e8582f9582f3d2ad33956d245da4c2a46
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Sat Nov 4 15:06:58 2017 +0100
Stabilize position output for ESI_xmlerror & more e8.vtc coverage
ver_p depends on the amount of data we have read ahead, so it is not
suitable to get predictable results for ESI testing
diff --git a/bin/varnishd/cache/cache_esi_parse.c b/bin/varnishd/cache/cache_esi_parse.c
index f02a6df..0cef4dd 100644
--- a/bin/varnishd/cache/cache_esi_parse.c
+++ b/bin/varnishd/cache/cache_esi_parse.c
@@ -196,12 +196,9 @@ static struct vep_match vep_match_bom[] = {
static void
vep_error(const struct vep_state *vep, const char *p)
{
- intmax_t l;
-
VSC_C_main->esi_errors++;
- l = (intmax_t)(vep->ver_p - vep->hack_p);
- VSLb(vep->vc->wrk->vsl, SLT_ESI_xmlerror, "ERR at %jd %s", l, p);
-
+ VSLb(vep->vc->wrk->vsl, SLT_ESI_xmlerror, "ERR after %zd %s",
+ vep->o_last, p);
}
/*--------------------------------------------------------------------
@@ -211,12 +208,9 @@ vep_error(const struct vep_state *vep, const char *p)
static void
vep_warn(const struct vep_state *vep, const char *p)
{
- intmax_t l;
-
VSC_C_main->esi_warnings++;
- l = (intmax_t)(vep->ver_p - vep->hack_p);
- VSLb(vep->vc->wrk->vsl, SLT_ESI_xmlerror, "WARN at %jd %s", l, p);
-
+ VSLb(vep->vc->wrk->vsl, SLT_ESI_xmlerror, "WARN after %zd %s",
+ vep->o_last, p);
}
/*---------------------------------------------------------------------
diff --git a/bin/varnishtest/tests/e00006.vtc b/bin/varnishtest/tests/e00006.vtc
index 6c9b5fd..95dd08d 100644
--- a/bin/varnishtest/tests/e00006.vtc
+++ b/bin/varnishtest/tests/e00006.vtc
@@ -68,9 +68,11 @@ varnish v1 -vcl+backend {
varnish v1 -cliok "param.set feature +esi_ignore_https"
logexpect l1 -v v1 -g raw {
- expect * * ESI_xmlerror "ERR at 35 ESI 1.0 <esi:include> invalid src= URL"
- expect * * ESI_xmlerror "WARN at 36 ESI 1.0 <esi:include> https:// treated as http://"
- expect * * ESI_xmlerror "ERR at 36 ESI 1.0 <esi:include> invalid src= URL"
+ expect * * ESI_xmlerror "ERR after 0 ESI 1.0 <esi:include> invalid src= URL"
+ expect * * ESI_xmlerror "WARN after 0 ESI 1.0 <esi:include> https:// treated as http://"
+ expect * * ESI_xmlerror "ERR after 0 ESI 1.0 <esi:include> invalid src= URL"
+
+
} -start
client c1 {
diff --git a/bin/varnishtest/tests/e00008.vtc b/bin/varnishtest/tests/e00008.vtc
index 51c8c88..8767b73 100644
--- a/bin/varnishtest/tests/e00008.vtc
+++ b/bin/varnishtest/tests/e00008.vtc
@@ -64,6 +64,25 @@ varnish v1 -vcl+backend {
}
} -start
+logexpect l1 -v v1 -g vxid {
+ expect * * BereqURL {^/$}
+ expect * * ESI_xmlerror {^ERR after 134 ESI 1.0 <esi:bogus> element$}
+ expect 0 = ESI_xmlerror {^ERR after 157 ESI 1.0 <esi:comment> needs final '/'$}
+ expect 0 = ESI_xmlerror {^ERR after 192 ESI 1.0 </esi:comment> illegal end-tag$}
+ expect 0 = ESI_xmlerror {^ERR after 251 ESI 1.0 <esi:comment> element nested in <esi:remove>$}
+ expect 0 = ESI_xmlerror {^ERR after 330 ESI 1.0 <esi:remove> already open$}
+ expect 0 = ESI_xmlerror {^ERR after 407 ESI 1.0 <esi:remove> not open$}
+ expect 0 = ESI_xmlerror {^ERR after 442 ESI 1.0 <esi:remove/> not legal$}
+ expect 0 = ESI_xmlerror {^ERR after 474 XML 1.0 Illegal attribute start char$}
+ expect 0 = ESI_xmlerror {^ERR after 525 ESI 1.0 <esi:include> lacks src attr$}
+ expect 0 = ESI_xmlerror {^ERR after 553 XML 1.0 Illegal attr char$}
+ expect 0 = ESI_xmlerror {^ERR after 581 ESI 1.0 <esi:include> lacks src attr$}
+ expect 0 = ESI_xmlerror {^ERR after 608 XML 1.0 Missing end attribute delimiter$}
+ expect 0 = ESI_xmlerror {^ERR after 636 XML 1.0 Illegal attribute delimiter$}
+ expect 0 = ESI_xmlerror {^ERR after 665 ESI 1.0 </esi:include> illegal end-tag$}
+ expect 0 = ESI_xmlerror {^ERR after 767 XML 1.0 Missing end attribute delimiter$}
+}
+
varnish v1 -cliok "param.set debug +esi_chop"
varnish v1 -cliok "param.set debug +syncvsl"
@@ -75,5 +94,7 @@ client c1 {
expect resp.bodylen == 464
}
+logexpect l1 -start
client c1 -run
+logexpect l1 -wait
varnish v1 -expect esi_errors == 15
More information about the varnish-commit
mailing list