Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
cab6b85b
Commit
cab6b85b
authored
Mar 18, 2011
by
Martin Blix Grydeland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add -D macro option to varnishtest
parent
7058d471
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
1 deletion
+52
-1
vtc.c
bin/varnishtest/vtc.c
+7
-0
vtc.h
bin/varnishtest/vtc.h
+10
-0
vtc_main.c
bin/varnishtest/vtc_main.c
+35
-1
No files found.
bin/varnishtest/vtc.c
View file @
cab6b85b
...
...
@@ -76,6 +76,8 @@ struct macro {
static
VTAILQ_HEAD
(,
macro
)
macro_list
=
VTAILQ_HEAD_INITIALIZER
(
macro_list
);
struct
_extmacro_list
extmacro_list
=
VTAILQ_HEAD_INITIALIZER
(
extmacro_list
);
static
pthread_mutex_t
macro_mtx
;
static
void
...
...
@@ -479,6 +481,7 @@ exec_file(const char *fn, const char *script, const char *tmpdir,
char
*
cwd
,
*
p
;
char
topbuild
[
BUFSIZ
];
FILE
*
f
;
struct
extmacro
*
m
;
vtc_loginit
(
logbuf
,
loglen
);
vltop
=
vtc_logopen
(
"top"
);
...
...
@@ -501,6 +504,10 @@ exec_file(const char *fn, const char *script, const char *tmpdir,
AZ
(
chdir
(
tmpdir
));
macro_def
(
vltop
,
NULL
,
"tmpdir"
,
tmpdir
);
/* Apply extmacro definitions */
VTAILQ_FOREACH
(
m
,
&
extmacro_list
,
list
)
macro_def
(
vltop
,
NULL
,
m
->
name
,
m
->
val
);
/* Drop file to tell what was going on here */
f
=
fopen
(
"INFO"
,
"w"
);
AN
(
f
);
...
...
bin/varnishtest/vtc.h
View file @
cab6b85b
...
...
@@ -34,6 +34,7 @@
#ifdef HAVE_PTHREAD_NP_H
#include <pthread_np.h>
#endif
#include "vqueue.h"
struct
vsb
;
struct
vtclog
;
...
...
@@ -49,6 +50,15 @@ struct cmds {
cmd_f
*
cmd
;
};
struct
extmacro
{
VTAILQ_ENTRY
(
extmacro
)
list
;
char
*
name
;
char
*
val
;
};
VTAILQ_HEAD
(
_extmacro_list
,
extmacro
);
extern
struct
_extmacro_list
extmacro_list
;
void
parse_string
(
char
*
buf
,
const
struct
cmds
*
cmd
,
void
*
priv
,
struct
vtclog
*
vl
);
...
...
bin/varnishtest/vtc_main.c
View file @
cab6b85b
...
...
@@ -91,6 +91,32 @@ static int vtc_good;
static
int
vtc_fail
;
static
int
leave_temp
;
/**********************************************************************
* Parse a -D option argument into a name/val pair, and insert
* into extmacro list
*/
int
parse_D_opt
(
char
*
arg
)
{
int
i
;
char
*
p
,
*
q
;
struct
extmacro
*
m
;
p
=
arg
;
q
=
strchr
(
p
,
'='
);
if
(
!
q
)
return
(
0
);
*
q
++
=
'\0'
;
m
=
calloc
(
sizeof
*
m
,
1
);
AN
(
m
);
REPLACE
(
m
->
name
,
p
);
REPLACE
(
m
->
val
,
q
);
VTAILQ_INSERT_TAIL
(
&
extmacro_list
,
m
,
list
);
return
(
1
);
}
/**********************************************************************
* Read a file into memory
*/
...
...
@@ -130,6 +156,7 @@ usage(void)
{
fprintf
(
stderr
,
"usage: varnishtest [options] file ...
\n
"
);
#define FMT " %-28s # %s\n"
fprintf
(
stderr
,
FMT
,
"-D name=val"
,
"Define macro for use in scripts"
);
fprintf
(
stderr
,
FMT
,
"-j jobs"
,
"Run this many tests in parallel"
);
fprintf
(
stderr
,
FMT
,
"-k"
,
"Continue on test failure"
);
fprintf
(
stderr
,
FMT
,
"-l"
,
"Leave /tmp/vtc.* if test fails"
);
...
...
@@ -310,8 +337,15 @@ main(int argc, char * const *argv)
setbuf
(
stdout
,
NULL
);
setbuf
(
stderr
,
NULL
);
while
((
ch
=
getopt
(
argc
,
argv
,
"j:klLn:qt:v"
))
!=
-
1
)
{
while
((
ch
=
getopt
(
argc
,
argv
,
"
D:
j:klLn:qt:v"
))
!=
-
1
)
{
switch
(
ch
)
{
case
'D'
:
if
(
!
parse_D_opt
(
optarg
))
{
fprintf
(
stderr
,
"Cannot parse D opt '%s'
\n
"
,
optarg
);
exit
(
2
);
}
break
;
case
'j'
:
npar
=
strtoul
(
optarg
,
NULL
,
0
);
break
;
...
...
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