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
8fc1b2c3
Unverified
Commit
8fc1b2c3
authored
May 28, 2024
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vtest: Add "option timeout" to adjust the timeout per test case
parent
fec25970
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
0 deletions
+53
-0
cmds.h
bin/varnishtest/cmds.h
+1
-0
a00000.vtc
bin/varnishtest/tests/a00000.vtc
+3
-0
vtc_misc.c
bin/varnishtest/vtc_misc.c
+49
-0
No files found.
bin/varnishtest/cmds.h
View file @
8fc1b2c3
...
...
@@ -45,6 +45,7 @@ CMD_GLOBAL(include)
#endif
CMD_TOP
(
client
)
CMD_TOP
(
feature
)
CMD_TOP
(
option
)
CMD_TOP
(
filewrite
)
CMD_TOP
(
haproxy
)
#ifdef VTEST_WITH_VTC_LOGEXPECT
...
...
bin/varnishtest/tests/a00000.vtc
View file @
8fc1b2c3
varnishtest "Test varnishtest itself"
option timeout 60s
option timeout x1.1
shell -exit 1 -expect {varnishtest [options]} {varnishtest -h}
shell -exit 1 -match {-D.*Define macro} {varnishtest -h}
...
...
bin/varnishtest/vtc_misc.c
View file @
8fc1b2c3
...
...
@@ -660,3 +660,52 @@ cmd_feature(CMD_ARGS)
return
;
}
}
static
void
set_timeout
(
struct
vtclog
*
vl
,
const
char
*
val
)
{
double
num
;
char
*
s
=
NULL
;
if
(
val
==
NULL
||
*
val
==
'\0'
)
{
vtc_fatal
(
vl
,
"FAIL test, missing
\"
option timeout
\"
value"
);
return
;
}
if
(
*
val
==
'x'
)
{
num
=
strtod
(
val
+
1
,
&
s
);
num
*=
vtc_maxdur
;
}
else
num
=
VNUM_duration
(
val
);
if
(
isnan
(
num
)
||
(
s
!=
NULL
&&
*
s
!=
'\0'
))
{
vtc_fatal
(
vl
,
"FAIL test, invalid
\"
option timeout
\"
: %s"
,
val
);
return
;
}
vtc_maxdur
=
num
;
vtc_log
(
vl
,
4
,
"new timeout %.2f"
,
vtc_maxdur
);
}
/* SECTION: option <option> <value>
*
* Set varnishtest options
*
* timeout <duration>
* Override -t argument
* timeout x<factor>
* Scale timeout by a <factor>
*/
void
v_matchproto_
(
cmd_f
)
cmd_option
(
CMD_ARGS
)
{
(
void
)
priv
;
if
(
av
==
NULL
)
return
;
av
++
;
if
(
!
strcmp
(
av
[
0
],
"timeout"
))
set_timeout
(
vl
,
av
[
1
]);
else
vtc_fatal
(
vl
,
"FAIL test, unknown option: %s"
,
av
[
0
]);
}
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