testsuite --dump-logs works on servers started before the test (#13500)

so far ./runtest --dump-logs used work for servers started within the
test proc.
now it'll also work on servers started outside the test proc scope.
the downside is that these logs can be huge if they served many tests
and not just the failing one.
but for some rare failures, we rather have that than nothing.
this feature isn't enabled y default, but is used by our GH actions.
This commit is contained in:
Oran Agra 2024-08-29 07:27:23 +01:00 committed by GitHub
parent 3c9f5954b5
commit 3fcddfb61f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 0 deletions

View File

@ -217,6 +217,7 @@ proc test {name code {okpattern undefined} {tags {}}} {
send_data_packet $::test_server_fd testing $name send_data_packet $::test_server_fd testing $name
set failed false
set test_start_time [clock milliseconds] set test_start_time [clock milliseconds]
if {[catch {set retval [uplevel 1 $code]} error]} { if {[catch {set retval [uplevel 1 $code]} error]} {
set assertion [string match "assertion:*" $error] set assertion [string match "assertion:*" $error]
@ -231,6 +232,7 @@ proc test {name code {okpattern undefined} {tags {}}} {
lappend ::tests_failed $details lappend ::tests_failed $details
incr ::num_failed incr ::num_failed
set failed true
send_data_packet $::test_server_fd err [join $details "\n"] send_data_packet $::test_server_fd err [join $details "\n"]
if {$::stop_on_failure} { if {$::stop_on_failure} {
@ -253,10 +255,17 @@ proc test {name code {okpattern undefined} {tags {}}} {
lappend ::tests_failed $details lappend ::tests_failed $details
incr ::num_failed incr ::num_failed
set failed true
send_data_packet $::test_server_fd err [join $details "\n"] send_data_packet $::test_server_fd err [join $details "\n"]
} }
} }
if {$::dump_logs && $failed} {
foreach srv $::servers {
dump_server_log $srv
}
}
if {$::traceleaks} { if {$::traceleaks} {
set output [exec leaks redis-server] set output [exec leaks redis-server]
if {![string match {*0 leaks*} $output]} { if {![string match {*0 leaks*} $output]} {