Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
1e09758e
Commit
1e09758e
authored
Jul 05, 2017
by
Geoff Simmons
Committed by
Pål Hermunn Johansen
Aug 08, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the vtc feature ignore_unknown_macro.
Closes: #2357
parent
07271b8f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
6 deletions
+50
-6
a00018.vtc
bin/varnishtest/tests/a00018.vtc
+35
-0
vtc.c
bin/varnishtest/vtc.c
+15
-6
No files found.
bin/varnishtest/tests/a00018.vtc
0 → 100644
View file @
1e09758e
varnishtest "feature ignore_unknown_macro"
feature ignore_unknown_macro
server s1 {
rxreq
expect req.http.Foo == "${foo}"
txresp -hdr "Bar: ${bar}"
} -start
varnish v1 -vcl {
backend default {
.host = "${s1_addr}";
.port = "${s1_port}";
}
sub vcl_deliver {
if (resp.http.Bar == "${bar}") {
set resp.http.Baz = "${baz}";
}
}
} -start
client c1 {
txreq -hdr "Foo: ${foo}"
rxresp
expect resp.status == 200
expect resp.http.Bar == "${bar}"
expect resp.http.Baz == "${baz}"
} -run
shell {
touch ${tmpdir}/tst
rm ${tmpdir}/tst
}
bin/varnishtest/vtc.c
View file @
1e09758e
...
@@ -56,6 +56,7 @@ volatile sig_atomic_t vtc_error; /* Error encountered */
...
@@ -56,6 +56,7 @@ volatile sig_atomic_t vtc_error; /* Error encountered */
int
vtc_stop
;
/* Stops current test without error */
int
vtc_stop
;
/* Stops current test without error */
pthread_t
vtc_thread
;
pthread_t
vtc_thread
;
static
struct
vtclog
*
vltop
;
static
struct
vtclog
*
vltop
;
static
int
ign_unknown_macro
=
0
;
/**********************************************************************
/**********************************************************************
* Macro facility
* Macro facility
...
@@ -197,13 +198,18 @@ macro_expand(struct vtclog *vl, const char *text)
...
@@ -197,13 +198,18 @@ macro_expand(struct vtclog *vl, const char *text)
p
+=
2
;
p
+=
2
;
m
=
macro_get
(
p
,
q
);
m
=
macro_get
(
p
,
q
);
if
(
m
==
NULL
)
{
if
(
m
==
NULL
)
{
if
(
!
ign_unknown_macro
)
{
VSB_delete
(
vsb
);
VSB_delete
(
vsb
);
vtc_log
(
vl
,
0
,
"Macro ${%.*s} not found"
,
(
int
)(
q
-
p
)
,
vtc_log
(
vl
,
0
,
"Macro ${%.*s} not found"
,
p
);
(
int
)(
q
-
p
),
p
);
return
(
NULL
);
return
(
NULL
);
}
}
VSB_printf
(
vsb
,
"${%.*s}"
,
(
int
)(
q
-
p
),
p
);
}
else
{
VSB_printf
(
vsb
,
"%s"
,
m
);
VSB_printf
(
vsb
,
"%s"
,
m
);
free
(
m
);
free
(
m
);
}
text
=
q
+
1
;
text
=
q
+
1
;
}
}
AZ
(
VSB_finish
(
vsb
));
AZ
(
VSB_finish
(
vsb
));
...
@@ -744,6 +750,9 @@ cmd_feature(CMD_ARGS)
...
@@ -744,6 +750,9 @@ cmd_feature(CMD_ARGS)
good
=
1
;
good
=
1
;
else
else
vtc_stop
=
1
;
vtc_stop
=
1
;
}
else
if
(
!
strcmp
(
*
av
,
"ignore_unknown_macro"
))
{
ign_unknown_macro
=
1
;
good
=
1
;
}
}
if
(
good
)
if
(
good
)
continue
;
continue
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment