From 3fcddfb61f903d7112da186cba8b1c93a99dc87f Mon Sep 17 00:00:00 2001 From: Oran Agra Date: Thu, 29 Aug 2024 07:27:23 +0100 Subject: [PATCH] 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. --- tests/support/test.tcl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/support/test.tcl b/tests/support/test.tcl index b7cd38b382..d85f31e0b1 100644 --- a/tests/support/test.tcl +++ b/tests/support/test.tcl @@ -217,6 +217,7 @@ proc test {name code {okpattern undefined} {tags {}}} { send_data_packet $::test_server_fd testing $name + set failed false set test_start_time [clock milliseconds] if {[catch {set retval [uplevel 1 $code]} error]} { set assertion [string match "assertion:*" $error] @@ -231,6 +232,7 @@ proc test {name code {okpattern undefined} {tags {}}} { lappend ::tests_failed $details incr ::num_failed + set failed true send_data_packet $::test_server_fd err [join $details "\n"] if {$::stop_on_failure} { @@ -253,10 +255,17 @@ proc test {name code {okpattern undefined} {tags {}}} { lappend ::tests_failed $details incr ::num_failed + set failed true send_data_packet $::test_server_fd err [join $details "\n"] } } + if {$::dump_logs && $failed} { + foreach srv $::servers { + dump_server_log $srv + } + } + if {$::traceleaks} { set output [exec leaks redis-server] if {![string match {*0 leaks*} $output]} {