Test that VRT_fail from an object constructor works as expected

parent b30af4dd
......@@ -165,6 +165,14 @@ varnish v1 -errvcl {Failed from VCL} {
}
}
varnish v1 -errvcl {Failed initialization} {
import debug;
backend none none;
sub vcl_init {
new fails = debug.obj("fail");
}
}
varnish v1 -cliok "param.set vcc_feature +allow_inline_c"
varnish v1 -vcl {
import vtc;
......@@ -289,7 +297,7 @@ varnish v1 -cliok "vcl.list"
varnish v1 -expect vmods == 3
varnish v1 -cliok "vcl.discard vcl[1-9]"
varnish v1 -cliok "vcl.discard vcl[1-9] vcl10"
varnish v1 -cliok "vcl.list"
varnish v1 -cliok "debug.vmod"
......
......@@ -73,6 +73,8 @@ $Object obj(STRING string="default", ENUM { one, two, three } number=one)
Test object
Fail for string="fail".
.. NOTE: .enum before .foo as part of test r01332.vtc
$Method VOID .enum(ENUM { phk, des, kristian, mithrandir, martin })
......
......@@ -60,6 +60,10 @@ xyzzy_obj__init(VRT_CTX, struct xyzzy_debug_obj **op,
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
AN(op);
AZ(*op);
if (! strcmp(s, "fail")) {
VRT_fail(ctx, "failing as requested");
}
ALLOC_OBJ(o, VMOD_DEBUG_OBJ_MAGIC);
AN(o);
*op = o;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment