Unverified Commit b947049f authored by Binbin's avatar Binbin Committed by GitHub
Browse files

Fix timing issue in logging.tcl with FreeBSD (#9910)

A test failure was reported in Daily CI.
`Crash report generated on SIGABRT` with FreeBSD.

```
*** [err]: Crash report generated on SIGABRT in tests/integration/logging.tcl
Expected [string match *crashed by signal* ### Starting...(logs) in tests/integration/logging.tcl]
```

It look like `tail -1000` was executed too early, before it
printed out all the crash logs. We can give it a few more
chances by using `wait_for_log_messages`.

Other changes:
1. In `Server is able to generate a stack trace on selected systems`,
use `wait_for_log_messages`to reduce the lines of code. And if it
fails, there are more detailed logs that can be printed.

2. In `Crash report generated on DEBUG SEGFAULT`, we also use
`wait_for_log_messages` to avoid possible timing issues.
parent 36ca5452
...@@ -21,18 +21,8 @@ if {$backtrace_supported} { ...@@ -21,18 +21,8 @@ if {$backtrace_supported} {
r config set watchdog-period 200 r config set watchdog-period 200
r debug sleep 1 r debug sleep 1
set pattern "*debugCommand*" set pattern "*debugCommand*"
set retry 10 set res [wait_for_log_messages 0 \"$pattern\" 0 100 100]
while {$retry} { if {$::verbose} { puts $res }
set result [exec tail -100 < [srv 0 stdout]]
if {[string match $pattern $result]} {
break
}
incr retry -1
after 1000
}
if {$retry == 0} {
error "assertion:expected stack trace not found into log file"
}
} }
} }
} }
...@@ -50,8 +40,8 @@ if {!$::valgrind} { ...@@ -50,8 +40,8 @@ if {!$::valgrind} {
test "Crash report generated on SIGABRT" { test "Crash report generated on SIGABRT" {
set pid [s process_id] set pid [s process_id]
exec kill -SIGABRT $pid exec kill -SIGABRT $pid
set result [exec tail -1000 < [srv 0 stdout]] set res [wait_for_log_messages 0 \"$crash_pattern\" 0 50 100]
assert {[string match $crash_pattern $result]} if {$::verbose} { puts $res }
} }
} }
...@@ -59,8 +49,8 @@ if {!$::valgrind} { ...@@ -59,8 +49,8 @@ if {!$::valgrind} {
start_server [list overrides [list dir $server_path]] { start_server [list overrides [list dir $server_path]] {
test "Crash report generated on DEBUG SEGFAULT" { test "Crash report generated on DEBUG SEGFAULT" {
catch {r debug segfault} catch {r debug segfault}
set result [exec tail -1000 < [srv 0 stdout]] set res [wait_for_log_messages 0 \"$crash_pattern\" 0 50 100]
assert {[string match $crash_pattern $result]} if {$::verbose} { puts $res }
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment