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
86785741
Commit
86785741
authored
Jan 12, 2018
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add hack to wait for X bytes on stdout.
parent
909ce718
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
17 deletions
+53
-17
u00008.vtc
bin/varnishtest/tests/u00008.vtc
+22
-0
u00009.vtc
bin/varnishtest/tests/u00009.vtc
+2
-6
u00010.vtc
bin/varnishtest/tests/u00010.vtc
+2
-6
u00011.vtc
bin/varnishtest/tests/u00011.vtc
+3
-5
vtc_process.c
bin/varnishtest/vtc_process.c
+24
-0
No files found.
bin/varnishtest/tests/u00008.vtc
0 → 100644
View file @
86785741
varnishtest "trivial run of varnistat in curses mode"
feature term
server s1 {
rxreq
txresp
} -start
varnish v1 -vcl+backend {} -start
process p1 -dump {varnishstat -n ${v1_name}} -start
process p1 -need-bytes 1
client c1 {
txreq
rxresp
} -run
process p1 -need-bytes 2300 -screen_dump -write {q} -wait
bin/varnishtest/tests/u00009.vtc
View file @
86785741
...
...
@@ -11,15 +11,11 @@ varnish v1 -vcl+backend {} -start
process p1 -dump {varnishhist -n ${v1_name}} -start
delay 3
process p1 -need-bytes 1
client c1 {
txreq
rxresp
} -run
delay 10
process p1 -write {q}
process p1 -wait -screen_dump
process p1 -need-bytes 300 -screen_dump -write {q} -wait
bin/varnishtest/tests/u00010.vtc
View file @
86785741
...
...
@@ -11,15 +11,11 @@ varnish v1 -vcl+backend {} -start
process p1 -dump {varnishtop -n ${v1_name}} -start
delay 3
process p1 -need-bytes 1
client c1 {
txreq
rxresp
} -run
delay 10
process p1 -write {q}
process p1 -wait -screen_dump
process p1 -need-bytes 2500 -screen_dump -write {q} -wait
bin/varnishtest/tests/u00011.vtc
View file @
86785741
...
...
@@ -11,19 +11,17 @@ varnish v1 -vcl+backend {} -start
process p1 -dump {varnishadm -n ${v1_name}} -start
delay 2
process p1 -need-bytes 1
client c1 {
txreq
rxresp
} -run
delay 2
process p1 -writeln {panic.show}
process p1 -writeln {quit}
delay 1
0
process p1 -need-bytes 40
0
process p1 -
wait -screen_dump
process p1 -
screen_dump -writeln {quit} -wait
bin/varnishtest/vtc_process.c
View file @
86785741
...
...
@@ -38,6 +38,7 @@
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
...
...
@@ -76,6 +77,9 @@ struct process {
pid_t
pid
;
int
expect_exit
;
uintmax_t
stdout_bytes
;
uintmax_t
stderr_bytes
;
pthread_mutex_t
mtx
;
pthread_t
tp
;
unsigned
hasthread
;
...
...
@@ -198,6 +202,9 @@ process_stdout(const struct vev *ev, int what)
vtc_log
(
p
->
vl
,
4
,
"stdout read %d"
,
i
);
return
(
1
);
}
AZ
(
pthread_mutex_lock
(
&
p
->
mtx
));
p
->
stdout_bytes
+=
i
;
AZ
(
pthread_mutex_unlock
(
&
p
->
mtx
));
if
(
p
->
log
==
1
)
(
void
)
VLU_Feed
(
p
->
vlu_stdout
,
buf
,
i
);
else
if
(
p
->
log
==
2
)
...
...
@@ -223,6 +230,9 @@ process_stderr(const struct vev *ev, int what)
vtc_log
(
p
->
vl
,
4
,
"stderr read %d"
,
i
);
return
(
1
);
}
AZ
(
pthread_mutex_lock
(
&
p
->
mtx
));
p
->
stderr_bytes
+=
i
;
AZ
(
pthread_mutex_unlock
(
&
p
->
mtx
));
vtc_dump
(
p
->
vl
,
4
,
"stderr"
,
buf
,
i
);
(
void
)
write
(
p
->
f_stderr
,
buf
,
i
);
return
(
0
);
...
...
@@ -435,6 +445,8 @@ process_wait(struct process *p)
AZ
(
pthread_join
(
p
->
tp
,
&
v
));
p
->
hasthread
=
0
;
}
vtc_log
(
p
->
vl
,
4
,
"stdout %ju bytes, stderr %ju bytes"
,
p
->
stdout_bytes
,
p
->
stderr_bytes
);
}
/**********************************************************************
...
...
@@ -601,6 +613,7 @@ void
cmd_process
(
CMD_ARGS
)
{
struct
process
*
p
,
*
p2
;
uintmax_t
u
,
v
;
(
void
)
priv
;
(
void
)
cmd
;
...
...
@@ -697,6 +710,17 @@ cmd_process(CMD_ARGS)
av
++
;
continue
;
}
if
(
!
strcmp
(
*
av
,
"-need-bytes"
))
{
u
=
strtoumax
(
av
[
1
],
NULL
,
0
);
av
++
;
do
{
usleep
(
100000
);
AZ
(
pthread_mutex_lock
(
&
p
->
mtx
));
v
=
p
->
stdout_bytes
;
AZ
(
pthread_mutex_unlock
(
&
p
->
mtx
));
}
while
(
v
<
u
);
continue
;
}
if
(
!
strcmp
(
*
av
,
"-screen_dump"
))
{
Term_Dump
(
p
->
term
);
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