From 611959eee55a1fe0fa532a5f878ab5ba2b6b79c4 Mon Sep 17 00:00:00 2001 From: Oran Agra Date: Sun, 25 Apr 2021 13:08:46 +0300 Subject: fuzz tester, try to print hung command (#8837) --- tests/integration/corrupt-dump-fuzzer.tcl | 9 +++++++++ tests/support/util.tcl | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/integration/corrupt-dump-fuzzer.tcl b/tests/integration/corrupt-dump-fuzzer.tcl index 4fb503b8e..025b1291c 100644 --- a/tests/integration/corrupt-dump-fuzzer.tcl +++ b/tests/integration/corrupt-dump-fuzzer.tcl @@ -2,6 +2,15 @@ tags {"dump" "corruption"} { +# catch sigterm so that in case one of the random command hangs the test, +# usually due to redis not putting a response in the output buffers, +# we'll know which command it was +if { ! [ catch { + package require Tclx +} err ] } { + signal error SIGTERM +} + proc generate_collections {suffix elements} { set rd [redis_deferring_client] for {set j 0} {$j < $elements} {incr j} { diff --git a/tests/support/util.tcl b/tests/support/util.tcl index b00aa159a..0eaee1ad0 100644 --- a/tests/support/util.tcl +++ b/tests/support/util.tcl @@ -641,6 +641,12 @@ proc generate_fuzzy_traffic_on_key {key duration} { r {*}$cmd } err ] } { incr succeeded + } else { + set err [format "%s" $err] ;# convert to string for pattern matching + if {[string match "*SIGTERM*" $err]} { + puts "command caused test to hang? $cmd" + exit 1 + } } } @@ -761,4 +767,4 @@ proc psubscribe {client channels} { proc punsubscribe {client {channels {}}} { $client punsubscribe {*}$channels consume_subscribe_messages $client punsubscribe $channels -} \ No newline at end of file +} -- cgit v1.2.1