From 9fe63bdc803b8f1698e28287f8a5df2ba21e8be3 Mon Sep 17 00:00:00 2001 From: Binbin Date: Wed, 27 Sep 2023 01:08:18 -0500 Subject: [PATCH] Dump server logs when corrupt fuzzer reports crash (#12612) Recently we found some signal crashes, but unable to reproduce them. It is a good idea to dump the server logs when a failure happens. --- tests/integration/corrupt-dump-fuzzer.tcl | 5 +++++ tests/test_helper.tcl | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/tests/integration/corrupt-dump-fuzzer.tcl b/tests/integration/corrupt-dump-fuzzer.tcl index 9cd4ff913..45705745e 100644 --- a/tests/integration/corrupt-dump-fuzzer.tcl +++ b/tests/integration/corrupt-dump-fuzzer.tcl @@ -169,6 +169,11 @@ foreach sanitize_dump {no yes} { incr stat_terminated_by_signal $by_signal if {$by_signal != 0 || $sanitize_dump == yes} { + if {$::dump_logs} { + set srv [get_srv 0] + dump_server_log $srv + } + puts "Server crashed (by signal: $by_signal), with payload: $printable_dump" set print_commands true } diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl index 21fa35d4d..6c3714e9a 100644 --- a/tests/test_helper.tcl +++ b/tests/test_helper.tcl @@ -197,6 +197,12 @@ proc srv {args} { dict get $srv $property } +# Take an index to get a srv. +proc get_srv {level} { + set srv [lindex $::servers end+$level] + return $srv +} + # Provide easy access to the client for the inner server. It's possible to # prepend the argument list with a negative level to access clients for # servers running in outer blocks.