mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 08:08:53 -05:00
allow running the test suite against an external Redis instance, without auto spawning
This commit is contained in:
parent
3042fb0537
commit
7d04fc7563
@ -25,6 +25,9 @@ proc check_valgrind_errors stderr {
|
||||
}
|
||||
|
||||
proc kill_server config {
|
||||
# nothing to kill when running against external server
|
||||
if {$::external} return
|
||||
|
||||
# nevermind if its already dead
|
||||
if {![is_alive $config]} { return }
|
||||
set pid [dict get $config pid]
|
||||
@ -93,6 +96,24 @@ proc tags {tags code} {
|
||||
}
|
||||
|
||||
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
|
||||
set baseconfig "default.conf"
|
||||
set overrides {}
|
||||
|
@ -15,6 +15,7 @@ set ::traceleaks 0
|
||||
set ::valgrind 0
|
||||
set ::denytags {}
|
||||
set ::allowtags {}
|
||||
set ::external 0; # If "1" this means, we are running against external instance
|
||||
|
||||
proc execute_tests name {
|
||||
source "tests/$name.tcl"
|
||||
@ -106,6 +107,13 @@ for {set j 0} {$j < [llength $argv]} {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 {
|
||||
puts "Wrong argument: $opt"
|
||||
exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user