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
04277423
Commit
04277423
authored
Jul 05, 2017
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the vtc feature ignore_unknown_macro.
Closes: #2357
parent
fd4a9271
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
8 deletions
+60
-8
a00018.vtc
bin/varnishtest/tests/a00018.vtc
+35
-0
vtc.c
bin/varnishtest/vtc.c
+25
-8
No files found.
bin/varnishtest/tests/a00018.vtc
0 → 100644
View file @
04277423
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 @
04277423
...
...
@@ -58,6 +58,7 @@ volatile sig_atomic_t vtc_error; /* Error encountered */
int
vtc_stop
;
/* Stops current test without error */
pthread_t
vtc_thread
;
static
struct
vtclog
*
vltop
;
static
int
ign_unknown_macro
=
0
;
/**********************************************************************
* Macro facility
...
...
@@ -236,13 +237,18 @@ macro_expand(struct vtclog *vl, const char *text)
p
+=
2
;
m
=
macro_get
(
p
,
q
);
if
(
m
==
NULL
)
{
VSB_destroy
(
&
vsb
);
vtc_fatal
(
vl
,
"Macro ${%.*s} not found"
,
(
int
)(
q
-
p
),
p
);
NEEDLESS
(
return
(
NULL
));
if
(
!
ign_unknown_macro
)
{
VSB_destroy
(
&
vsb
);
vtc_fatal
(
vl
,
"Macro ${%.*s} not found"
,
(
int
)(
q
-
p
),
p
);
NEEDLESS
(
return
(
NULL
));
}
VSB_printf
(
vsb
,
"${%.*s}"
,
(
int
)(
q
-
p
),
p
);
}
else
{
VSB_printf
(
vsb
,
"%s"
,
m
);
free
(
m
);
}
VSB_printf
(
vsb
,
"%s"
,
m
);
free
(
m
);
text
=
q
+
1
;
}
AZ
(
VSB_finish
(
vsb
));
...
...
@@ -662,8 +668,9 @@ cmd_delay(CMD_ARGS)
/* SECTION: feature feature
*
* Test that the required feature(s) for a test are available, and skip the test
* otherwise. feature takes any number of arguments from this list:
* Test that the required feature(s) for a test are available, and skip
* the test otherwise; or change the interpretation of the test, as
* documented below. feature takes any number of arguments from this list:
*
* SO_RCVTIMEO_WORKS
* The SO_RCVTIMEO socket option is working
...
...
@@ -685,6 +692,13 @@ cmd_delay(CMD_ARGS)
* The varnish group is present
* cmd <command-line>
* A command line that should execute with a zero exit status
* ignore_unknown_macro
* Do not fail the test if a string of the form ${...} is not
* recognized as a macro.
*
* Be careful with the last feature, because it may cause a test with a
* misspelled macro to fail silently. You should only need it if you must
* run a test with strings of the form "${...}".
*/
static
void
...
...
@@ -755,6 +769,9 @@ cmd_feature(CMD_ARGS)
good
=
1
;
else
vtc_stop
=
2
;
}
else
if
(
!
strcmp
(
*
av
,
"ignore_unknown_macro"
))
{
ign_unknown_macro
=
1
;
good
=
1
;
}
if
(
good
)
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