Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
c6954de3
Commit
c6954de3
authored
Feb 21, 2020
by
antirez
Browse files
Test engine: better tracking of what workers are doing.
parent
8a14fff5
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/support/server.tcl
View file @
c6954de3
...
...
@@ -53,6 +53,7 @@ proc kill_server config {
}
# kill server and wait for the process to be totally exited
send_data_packet $::test_server_fd server-killing $pid
catch
{
exec kill $pid
}
if
{
$::valgrind
}
{
set max_wait 60000
...
...
@@ -231,6 +232,8 @@ proc start_server {options {code undefined}} {
set stdout
[
format
"%s/%s"
[
dict get $config
"dir"
]
"stdout"
]
set stderr
[
format
"%s/%s"
[
dict get $config
"dir"
]
"stderr"
]
send_data_packet $::test_server_fd
"server-spawning"
"port
$::port
"
if
{
$::valgrind
}
{
set pid
[
exec valgrind --track-origins=yes --suppressions=src/valgrind.sup --show-reachable=no --show-possibly-lost=no --leak-check=full src/redis-server $config_file > $stdout 2> $stderr &
]
}
elseif
(
$::stack
_logging
)
{
...
...
tests/test_helper.tcl
View file @
c6954de3
...
...
@@ -289,7 +289,7 @@ proc read_from_test_client fd {
puts
"
\[
$completed
_tests_count/
$all
_tests_count
[
colorstr yellow $status
]
\]
:
$data
(
$elapsed
seconds)"
lappend ::clients_time_history $elapsed $data
signal_idle_client $fd
set ::active_clients_task
(
$fd
)
DONE
set ::active_clients_task
(
$fd
)
"(
DONE
)
$data
"
}
elseif
{
$status
eq
{
ok
}}
{
if
{
!$::quiet
}
{
puts
"
\[
[
colorstr green $status
]
\]
:
$data
"
...
...
@@ -320,10 +320,16 @@ proc read_from_test_client fd {
exit 1
}
elseif
{
$status
eq
{
testing
}}
{
set ::active_clients_task
(
$fd
)
"(IN PROGRESS)
$data
"
}
elseif
{
$status
eq
{
server-spawning
}}
{
set ::active_clients_task
(
$fd
)
"(SPAWNING SERVER)
$data
"
}
elseif
{
$status
eq
{
server-spawned
}}
{
lappend ::active_servers $data
set ::active_clients_task
(
$fd
)
"(SPAWNED SERVER) pid:
$data
"
}
elseif
{
$status
eq
{
server-killing
}}
{
set ::active_clients_task
(
$fd
)
"(KILLING SERVER) pid:
$data
"
}
elseif
{
$status
eq
{
server-killed
}}
{
set ::active_servers
[
lsearch -all -inline -not -exact $::active_servers $data
]
set ::active_clients_task
(
$fd
)
"(KILLED SERVER) pid:
$data
"
}
else
{
if
{
!$::quiet
}
{
puts
"
\[
$status
\]
:
$data
"
...
...
@@ -333,7 +339,7 @@ proc read_from_test_client fd {
proc show_clients_state
{}
{
# The following loop is only useful for debugging tests that may
# enter an infinite loop.
Commented out normally.
# enter an infinite loop.
foreach x $::active_clients
{
if
{[
info exist ::active_clients_task
(
$x
)]}
{
puts
"
$x
=>
$::active
_clients_task(
$x
)"
...
...
@@ -363,8 +369,6 @@ proc signal_idle_client fd {
set ::active_clients
\
[
lsearch -all -inline -not -exact $::active_clients $fd
]
if 0
{
show_clients_state
}
# New unit to process?
if
{
$::next
_test !=
[
llength $::all_tests
]}
{
if
{
!$::quiet
}
{
...
...
@@ -380,6 +384,7 @@ proc signal_idle_client fd {
}
}
else
{
lappend ::idle_clients $fd
set ::active_clients_task
(
$fd
)
"SLEEPING, no more units to assign"
if
{[
llength $::active_clients
]
== 0
}
{
the_end
}
...
...
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