From f1a5f8ab4d4a12c44c46ccbf6bcafadf9f86ab45 Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Wed, 18 Dec 2024 12:31:45 +0100 Subject: [PATCH] Add assertions to check the systemtap process in background. Add the `-p PID` option to the `rlWaitForCmd`. The option checks the PID is alive during the waiting. See for the logic of the `-p` option. Add an assertion to check the systemtap process after systemtap logging the the text "starting run" before running the assertions for ruby commands. Because systemtap can fail after logging the text as a possibility. An example of the failure: https://access.redhat.com/solutions/3613871 --- systemtap-static-probes-in-ruby/runtest.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/systemtap-static-probes-in-ruby/runtest.sh b/systemtap-static-probes-in-ruby/runtest.sh index cfac459..f128274 100755 --- a/systemtap-static-probes-in-ruby/runtest.sh +++ b/systemtap-static-probes-in-ruby/runtest.sh @@ -71,7 +71,13 @@ rlJournalStart echo -e "--_STAP_PID--\n${_STAP_PID}" # info # wait for systemtap to start - rlWaitForCmd "grep 'starting run' ${_STAP_OUT}" + rlWaitForCmd "grep 'starting run' ${_STAP_OUT}" -p "${_STAP_PID}" + sleep 1 + # check systemtap process, because systemtap can fail after logging + # "starting run". + rlRun "ps -q ${_STAP_PID}" 0 \ + "Checking systemtap process in background" \ + || rlRun -t "cat ${_STAP_OUT}" rlRun "$RUBY $RUBY_OPTS -e '1.0 + 9.0'" 0 "Running ruby interpreter: Float test" rlRun "$RUBY $RUBY_OPTS -e '[1, 2, 3].push(4)'" 0 "Running ruby interpreter: Array test"