Commit 7d04fc75 authored by antirez's avatar antirez
Browse files

allow running the test suite against an external Redis instance, without auto spawning

parent 3042fb05
...@@ -25,6 +25,9 @@ proc check_valgrind_errors stderr { ...@@ -25,6 +25,9 @@ proc check_valgrind_errors stderr {
} }
proc kill_server config { proc kill_server config {
# nothing to kill when running against external server
if {$::external} return
# nevermind if its already dead # nevermind if its already dead
if {![is_alive $config]} { return } if {![is_alive $config]} { return }
set pid [dict get $config pid] set pid [dict get $config pid]
...@@ -93,6 +96,24 @@ proc tags {tags code} { ...@@ -93,6 +96,24 @@ proc tags {tags code} {
} }
proc start_server {options {code undefined}} { proc start_server {options {code undefined}} {
# If we are runnign against an external server, we just push the
# host/port pair in the stack the first time
if {$::external} {
if {[llength $::servers] == 0} {
set srv {}
dict set srv "host" $::host
dict set srv "port" $::port
set client [redis $::host $::port]
dict set srv "client" $client
$client select 9
# append the server to the stack
lappend ::servers $srv
}
uplevel 1 $code
return
}
# setup defaults # setup defaults
set baseconfig "default.conf" set baseconfig "default.conf"
set overrides {} set overrides {}
......
...@@ -15,6 +15,7 @@ set ::traceleaks 0 ...@@ -15,6 +15,7 @@ set ::traceleaks 0
set ::valgrind 0 set ::valgrind 0
set ::denytags {} set ::denytags {}
set ::allowtags {} set ::allowtags {}
set ::external 0; # If "1" this means, we are running against external instance
proc execute_tests name { proc execute_tests name {
source "tests/$name.tcl" source "tests/$name.tcl"
...@@ -106,6 +107,13 @@ for {set j 0} {$j < [llength $argv]} {incr j} { ...@@ -106,6 +107,13 @@ for {set j 0} {$j < [llength $argv]} {incr j} {
} }
} }
incr j incr j
} elseif {$opt eq {--host}} {
set ::external 1
set ::host $arg
incr j
} elseif {$opt eq {--port}} {
set ::port $arg
incr j
} else { } else {
puts "Wrong argument: $opt" puts "Wrong argument: $opt"
exit 1 exit 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment