Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
08f55b78
Commit
08f55b78
authored
Aug 31, 2010
by
antirez
Browse files
faster server starting in Redis tests
parent
1eb13e49
Changes
3
Show whitespace changes
Inline
Side-by-side
tests/support/server.tcl
View file @
08f55b78
...
@@ -83,7 +83,9 @@ proc ping_server {host port} {
...
@@ -83,7 +83,9 @@ proc ping_server {host port} {
}
}
close $fd
close $fd
}
e
]}
{
}
e
]}
{
puts
"Can't PING server at
$host:$port...
$e
"
puts -nonewline
"."
}
else
{
puts -nonewline
"ok"
}
}
return $retval
return $retval
}
}
...
@@ -170,14 +172,33 @@ proc start_server {options {code undefined}} {
...
@@ -170,14 +172,33 @@ proc start_server {options {code undefined}} {
if
{
$::valgrind
}
{
if
{
$::valgrind
}
{
exec valgrind src/redis-server $config_file > $stdout 2> $stderr &
exec valgrind src/redis-server $config_file > $stdout 2> $stderr &
after 2000
}
else
{
}
else
{
exec src/redis-server $config_file > $stdout 2> $stderr &
exec src/redis-server $config_file > $stdout 2> $stderr &
after 500
}
}
# check that the server actually started
# check that the server actually started
if
{
$code
ne
"undefined"
&& !
[
ping_server $::host $::port
]}
{
# ugly but tries to be as fast as possible...
set retrynum 20
set serverisup 0
puts -nonewline
"=== (
$tags
) Starting server
${::host}
:
${::port}
"
after 10
if
{
$code
ne
"undefined"
}
{
while
{[
incr retrynum -1
]}
{
catch
{
if
{[
ping_server $::host $::port
]}
{
set serverisup 1
}
}
if
{
$serverisup
}
break
after 50
}
}
else
{
set serverisup 1
}
puts
{}
if
{
!$serverisup
}
{
error_and_quit $config_file
[
exec cat $stderr
]
error_and_quit $config_file
[
exec cat $stderr
]
}
}
...
...
tests/unit/other.tcl
View file @
08f55b78
start_server
{}
{
start_server
{
tags
{
"other"
}
}
{
test
{
SAVE - make sure there are all the types as values
}
{
test
{
SAVE - make sure there are all the types as values
}
{
# Wait for a background saving in progress to terminate
# Wait for a background saving in progress to terminate
waitForBgsave r
waitForBgsave r
...
...
tests/unit/protocol.tcl
View file @
08f55b78
start_server
{}
{
start_server
{
tags
{
"protocol"
}
}
{
test
{
Handle an empty query well
}
{
test
{
Handle an empty query well
}
{
set fd
[
r channel
]
set fd
[
r channel
]
puts -nonewline $fd
"
\r\n
"
puts -nonewline $fd
"
\r\n
"
...
...
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