mirror of https://mirror.osredm.com/root/redis.git
Tests (cluster / sentinel): add --stop and--loop options (#11070)
--stop: Blocks once the first test fails. --loop: Execute the specified set of tests forever. It is useful when we debug some test failures.
This commit is contained in:
parent
2029976dc3
commit
e13b681874
|
@ -34,6 +34,8 @@ set ::leaked_fds_file [file normalize "tmp/leaked_fds.txt"]
|
||||||
set ::pids {} ; # We kill everything at exit
|
set ::pids {} ; # We kill everything at exit
|
||||||
set ::dirs {} ; # We remove all the temp dirs at exit
|
set ::dirs {} ; # We remove all the temp dirs at exit
|
||||||
set ::run_matching {} ; # If non empty, only tests matching pattern are run.
|
set ::run_matching {} ; # If non empty, only tests matching pattern are run.
|
||||||
|
set ::stop_on_failure 0
|
||||||
|
set ::loop 0
|
||||||
|
|
||||||
if {[catch {cd tmp}]} {
|
if {[catch {cd tmp}]} {
|
||||||
puts "tmp directory not found."
|
puts "tmp directory not found."
|
||||||
|
@ -280,6 +282,10 @@ proc parse_options {} {
|
||||||
set val2 [lindex $::argv [expr $j+2]]
|
set val2 [lindex $::argv [expr $j+2]]
|
||||||
dict set ::global_config $val $val2
|
dict set ::global_config $val $val2
|
||||||
incr j 2
|
incr j 2
|
||||||
|
} elseif {$opt eq {--stop}} {
|
||||||
|
set ::stop_on_failure 1
|
||||||
|
} elseif {$opt eq {--loop}} {
|
||||||
|
set ::loop 1
|
||||||
} elseif {$opt eq "--help"} {
|
} elseif {$opt eq "--help"} {
|
||||||
puts "--single <pattern> Only runs tests specified by pattern."
|
puts "--single <pattern> Only runs tests specified by pattern."
|
||||||
puts "--dont-clean Keep log files on exit."
|
puts "--dont-clean Keep log files on exit."
|
||||||
|
@ -289,6 +295,8 @@ proc parse_options {} {
|
||||||
puts "--tls Run tests in TLS mode."
|
puts "--tls Run tests in TLS mode."
|
||||||
puts "--host <host> Use hostname instead of 127.0.0.1."
|
puts "--host <host> Use hostname instead of 127.0.0.1."
|
||||||
puts "--config <k> <v> Extra config argument(s)."
|
puts "--config <k> <v> Extra config argument(s)."
|
||||||
|
puts "--stop Blocks once the first test fails."
|
||||||
|
puts "--loop Execute the specified set of tests forever."
|
||||||
puts "--help Shows this help."
|
puts "--help Shows this help."
|
||||||
exit 0
|
exit 0
|
||||||
} else {
|
} else {
|
||||||
|
@ -435,6 +443,8 @@ proc check_leaks instance_types {
|
||||||
# Execute all the units inside the 'tests' directory.
|
# Execute all the units inside the 'tests' directory.
|
||||||
proc run_tests {} {
|
proc run_tests {} {
|
||||||
set tests [lsort [glob ../tests/*]]
|
set tests [lsort [glob ../tests/*]]
|
||||||
|
|
||||||
|
while 1 {
|
||||||
foreach test $tests {
|
foreach test $tests {
|
||||||
# Remove leaked_fds file before starting
|
# Remove leaked_fds file before starting
|
||||||
if {$::leaked_fds_file != "" && [file exists $::leaked_fds_file]} {
|
if {$::leaked_fds_file != "" && [file exists $::leaked_fds_file]} {
|
||||||
|
@ -451,6 +461,12 @@ proc run_tests {} {
|
||||||
puts $::errorInfo
|
puts $::errorInfo
|
||||||
incr ::failed
|
incr ::failed
|
||||||
# letting the tests resume, so we'll eventually reach the cleanup and report crashes
|
# letting the tests resume, so we'll eventually reach the cleanup and report crashes
|
||||||
|
|
||||||
|
if {$::stop_on_failure} {
|
||||||
|
puts -nonewline "(Test stopped, press enter to resume the tests)"
|
||||||
|
flush stdout
|
||||||
|
gets stdin
|
||||||
|
}
|
||||||
}
|
}
|
||||||
check_leaks {redis sentinel}
|
check_leaks {redis sentinel}
|
||||||
|
|
||||||
|
@ -462,6 +478,9 @@ proc run_tests {} {
|
||||||
incr ::failed
|
incr ::failed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if {$::loop == 0} { break }
|
||||||
|
} ;# while 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print a message and exists with 0 / 1 according to zero or more failures.
|
# Print a message and exists with 0 / 1 according to zero or more failures.
|
||||||
|
|
Loading…
Reference in New Issue