2021-06-09 08:13:24 -04:00
|
|
|
tags {"external:skip"} {
|
|
|
|
|
2015-02-10 08:40:27 -05:00
|
|
|
set system_name [string tolower [exec uname -s]]
|
2021-11-11 06:51:33 -05:00
|
|
|
set backtrace_supported 0
|
2015-02-10 08:40:27 -05:00
|
|
|
|
2021-02-23 05:57:45 -05:00
|
|
|
# We only support darwin or Linux with glibc
|
|
|
|
if {$system_name eq {darwin}} {
|
2021-11-11 06:51:33 -05:00
|
|
|
set backtrace_supported 1
|
2021-02-23 05:57:45 -05:00
|
|
|
} elseif {$system_name eq {linux}} {
|
|
|
|
# Avoid the test on libmusl, which does not support backtrace
|
|
|
|
set ldd [exec ldd src/redis-server]
|
|
|
|
if {![string match {*libc.musl*} $ldd]} {
|
2021-11-11 06:51:33 -05:00
|
|
|
set backtrace_supported 1
|
2021-02-23 05:57:45 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-11 06:51:33 -05:00
|
|
|
if {$backtrace_supported} {
|
2020-11-04 06:13:55 -05:00
|
|
|
set server_path [tmpdir server.log]
|
2015-02-10 08:40:27 -05:00
|
|
|
start_server [list overrides [list dir $server_path]] {
|
|
|
|
test "Server is able to generate a stack trace on selected systems" {
|
|
|
|
r config set watchdog-period 200
|
|
|
|
r debug sleep 1
|
|
|
|
set pattern "*debugCommand*"
|
2021-12-07 05:02:58 -05:00
|
|
|
set res [wait_for_log_messages 0 \"$pattern\" 0 100 100]
|
|
|
|
if {$::verbose} { puts $res }
|
2015-02-10 08:40:27 -05:00
|
|
|
}
|
|
|
|
}
|
2021-11-11 06:51:33 -05:00
|
|
|
}
|
2020-11-03 07:59:21 -05:00
|
|
|
|
2021-11-11 06:51:33 -05:00
|
|
|
# Valgrind will complain that the process terminated by a signal, skip it.
|
|
|
|
if {!$::valgrind} {
|
|
|
|
if {$backtrace_supported} {
|
|
|
|
set crash_pattern "*STACK TRACE*"
|
|
|
|
} else {
|
|
|
|
set crash_pattern "*crashed by signal*"
|
|
|
|
}
|
|
|
|
|
|
|
|
set server_path [tmpdir server1.log]
|
|
|
|
start_server [list overrides [list dir $server_path]] {
|
|
|
|
test "Crash report generated on SIGABRT" {
|
|
|
|
set pid [s process_id]
|
|
|
|
exec kill -SIGABRT $pid
|
2021-12-07 05:02:58 -05:00
|
|
|
set res [wait_for_log_messages 0 \"$crash_pattern\" 0 50 100]
|
|
|
|
if {$::verbose} { puts $res }
|
2020-11-04 06:13:55 -05:00
|
|
|
}
|
2020-11-03 07:59:21 -05:00
|
|
|
}
|
2020-11-04 06:13:55 -05:00
|
|
|
|
2021-11-11 06:51:33 -05:00
|
|
|
set server_path [tmpdir server2.log]
|
|
|
|
start_server [list overrides [list dir $server_path]] {
|
|
|
|
test "Crash report generated on DEBUG SEGFAULT" {
|
|
|
|
catch {r debug segfault}
|
2021-12-07 05:02:58 -05:00
|
|
|
set res [wait_for_log_messages 0 \"$crash_pattern\" 0 50 100]
|
|
|
|
if {$::verbose} { puts $res }
|
2021-11-11 06:51:33 -05:00
|
|
|
}
|
|
|
|
}
|
2020-11-03 07:59:21 -05:00
|
|
|
}
|
2021-06-09 08:13:24 -04:00
|
|
|
|
|
|
|
}
|