mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
test: make the strace check a bit more clever
We still sometimes try to grep an empty strace log because strace is not yet properly initialized. Let's make the check a bit clever and wait until strace is attached to PID 1 by checking the `TracerPid` field in `/proc/1/status`.
This commit is contained in:
parent
e68e473ba2
commit
7e8cfa4bb6
@ -34,8 +34,9 @@ journalCursorFile="jounalCursorFile"
|
||||
|
||||
startStrace() {
|
||||
coproc strace -qq -p 1 -o "$straceLog" -e set_mempolicy -s 1024 ${1:+"$1"}
|
||||
# Wait for strace to properly "initialize"
|
||||
sleep $sleepAfterStart
|
||||
# Wait for strace to properly "initialize", i.e. until PID 1 has the TracerPid
|
||||
# field set to the current strace's PID
|
||||
while ! awk -v spid="$COPROC_PID" '/^TracerPid:/ {exit !($2 == spid);}' /proc/1/status; do sleep 0.1; done
|
||||
}
|
||||
|
||||
stopStrace() {
|
||||
|
Loading…
Reference in New Issue
Block a user