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.
This commit is contained in:
Binbin 2021-12-07 18:02:58 +08:00 committed by GitHub
parent 36ca545286
commit b947049f85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,18 +21,8 @@ if {$backtrace_supported} {
r config set watchdog-period 200
r debug sleep 1
set pattern "*debugCommand*"
set retry 10
while {$retry} {
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"
}
set res [wait_for_log_messages 0 \"$pattern\" 0 100 100]
if {$::verbose} { puts $res }
}
}
}
@ -50,8 +40,8 @@ if {!$::valgrind} {
test "Crash report generated on SIGABRT" {
set pid [s process_id]
exec kill -SIGABRT $pid
set result [exec tail -1000 < [srv 0 stdout]]
assert {[string match $crash_pattern $result]}
set res [wait_for_log_messages 0 \"$crash_pattern\" 0 50 100]
if {$::verbose} { puts $res }
}
}
@ -59,8 +49,8 @@ if {!$::valgrind} {
start_server [list overrides [list dir $server_path]] {
test "Crash report generated on DEBUG SEGFAULT" {
catch {r debug segfault}
set result [exec tail -1000 < [srv 0 stdout]]
assert {[string match $crash_pattern $result]}
set res [wait_for_log_messages 0 \"$crash_pattern\" 0 50 100]
if {$::verbose} { puts $res }
}
}
}