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
f0dc9964
Commit
f0dc9964
authored
Feb 07, 2024
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement "include file ..." command
Submitted by: @AlveElde in Vtest repo on github
parent
1e03c7b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
cmds.h
bin/varnishtest/cmds.h
+1
-0
vtc_misc.c
bin/varnishtest/vtc_misc.c
+35
-0
No files found.
bin/varnishtest/cmds.h
View file @
f0dc9964
...
...
@@ -37,6 +37,7 @@
CMD_GLOBAL
(
barrier
)
CMD_GLOBAL
(
delay
)
CMD_GLOBAL
(
shell
)
CMD_GLOBAL
(
include
)
#undef CMD_GLOBAL
#ifndef CMD_TOP
...
...
bin/varnishtest/vtc_misc.c
View file @
f0dc9964
...
...
@@ -48,6 +48,7 @@
#include "vtc.h"
#include "vfil.h"
#include "vnum.h"
#include "vre.h"
#include "vtcp.h"
...
...
@@ -349,6 +350,40 @@ cmd_delay(CMD_ARGS)
VTIM_sleep
(
f
);
}
/* SECTION: include include
*
* Executes a vtc fragment::
*
* include FILE [...]
*
* Open a file and execute it as a VTC fragment. This command is available
* everywhere commands are given.
*
*/
void
cmd_include
(
CMD_ARGS
)
{
char
*
spec
;
unsigned
i
;
if
(
av
==
NULL
)
return
;
if
(
av
[
1
]
==
NULL
)
vtc_fatal
(
vl
,
"CMD include: At least 1 argument required"
);
for
(
i
=
1
;
av
[
i
]
!=
NULL
;
i
++
)
{
spec
=
VFIL_readfile
(
NULL
,
av
[
i
],
NULL
);
if
(
spec
==
NULL
)
vtc_fatal
(
vl
,
"CMD include: Unable to read file '%s' "
"(%s)"
,
av
[
i
],
strerror
(
errno
));
vtc_log
(
vl
,
2
,
"Begin include '%s'"
,
av
[
i
]);
parse_string
(
vl
,
priv
,
spec
);
vtc_log
(
vl
,
2
,
"End include '%s'"
,
av
[
i
]);
free
(
spec
);
}
}
/**********************************************************************
* Most test-cases use only numeric IP#'s but a few requires non-demented
* DNS services. This is a basic sanity check for those.
...
...
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