[master] c11240d Add a '-syntax' to set the desired VCL syntax version
Poul-Henning Kamp
phk at FreeBSD.org
Mon Jun 20 12:31:07 CEST 2016
commit c11240df6a81ace06e89dc64b34f14508de1c440
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Jun 20 09:28:56 2016 +0000
Add a '-syntax' to set the desired VCL syntax version
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index a4c4c15..8dfc938 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -68,6 +68,8 @@ struct varnish {
int fds[4];
pid_t pid;
+ float syntax;
+
pthread_t tp;
pthread_t tp_vsl;
@@ -288,6 +290,8 @@ varnish_new(const char *name)
REPLACE(v->jail, "");
+ v->syntax = 4.0;
+
v->vl = vtc_logopen(name);
AN(v->vl);
@@ -714,8 +718,8 @@ varnish_vcl(struct varnish *v, const char *vcl, enum VCLI_status_e expect,
vsb = VSB_new_auto();
AN(vsb);
- VSB_printf(vsb, "vcl.inline vcl%d << %s\nvcl 4.0;\n%s\n%s\n",
- ++v->vcl_nbr, NONSENSE, vcl, NONSENSE);
+ VSB_printf(vsb, "vcl.inline vcl%d << %s\nvcl %.1f;\n%s\n%s\n",
+ ++v->vcl_nbr, NONSENSE, v->syntax, vcl, NONSENSE);
AZ(VSB_finish(vsb));
u = varnish_ask_cli(v, VSB_data(vsb), resp);
@@ -758,7 +762,7 @@ varnish_vclbackend(struct varnish *v, const char *vcl)
vsb2 = VSB_new_auto();
AN(vsb2);
- VSB_printf(vsb2, "vcl 4.0;\n");
+ VSB_printf(vsb2, "vcl %.1f;\n", v->syntax);
cmd_server_genvcl(vsb2);
@@ -963,6 +967,9 @@ varnish_expect(const struct varnish *v, char * const *av)
* \-stop
* Stop the child process.
*
+ * \-syntax
+ * Set the VCL syntax level (default: 4.0)
+ *
* \-wait
* Wait for that instance to terminate.
*
@@ -1104,6 +1111,12 @@ cmd_varnish(CMD_ARGS)
varnish_stop(v);
continue;
}
+ if (!strcmp(*av, "-syntax")) {
+ AN(av[1]);
+ v->syntax = strtod(av[1], NULL);
+ av++;
+ continue;
+ }
if (!strcmp(*av, "-vcl")) {
AN(av[1]);
varnish_vcl(v, av[1], CLIS_OK, NULL);
More information about the varnish-commit
mailing list