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
87587f1f
Commit
87587f1f
authored
Mar 21, 2011
by
Martin Blix Grydeland
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'varnishtest'
parents
5ec2bb09
55e9e499
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
3 deletions
+54
-3
vtc.c
bin/varnishtest/vtc.c
+7
-0
vtc.h
bin/varnishtest/vtc.h
+10
-0
vtc_main.c
bin/varnishtest/vtc_main.c
+37
-3
No files found.
bin/varnishtest/vtc.c
View file @
87587f1f
...
...
@@ -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"
);
...
...
@@ -487,6 +490,10 @@ exec_file(const char *fn, const char *script, const char *tmpdir,
init_macro
();
init_sema
();
/* Apply extmacro definitions */
VTAILQ_FOREACH
(
m
,
&
extmacro_list
,
list
)
macro_def
(
vltop
,
NULL
,
m
->
name
,
m
->
val
);
/* We are still in bin/varnishtest at this point */
cwd
=
getcwd
(
NULL
,
PATH_MAX
);
bprintf
(
topbuild
,
"%s/%s"
,
cwd
,
TOP_BUILDDIR
);
...
...
bin/varnishtest/vtc.h
View file @
87587f1f
...
...
@@ -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 @
87587f1f
...
...
@@ -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"
);
...
...
@@ -206,7 +233,7 @@ tst_cb(const struct vev *ve, int what)
jp
->
tst
->
filename
,
t
);
if
(
!
vtc_continue
)
{
/* XXX kill -9 other jobs ? */
exit
(
2
);
exit
(
2
);
}
}
else
if
(
vtc_verbosity
)
{
printf
(
"# top TEST %s passed (%.3f)
\n
"
,
...
...
@@ -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
;
...
...
@@ -352,7 +386,7 @@ main(int argc, char * const *argv)
*
argv
,
strerror
(
errno
));
if
(
vtc_continue
)
continue
;
exit
(
2
);
exit
(
2
);
}
ALLOC_OBJ
(
tp
,
TST_MAGIC
);
AN
(
tp
);
...
...
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