systemtap-probe: sync downstream changes, fix require

While require on file in rpm works now, with dnf-5 it might not work out
of the box. Let's keep adding package which contains this file in the
require/recommend instead

Extend stap buffer size and limit "noise" produced by ruby interpreter
so stap output is more usable.
This commit is contained in:
Lukas Zachar 2023-04-13 17:52:04 +02:00 committed by Lukáš Zachar
commit b35f6f20d7
2 changed files with 23 additions and 10 deletions

View file

@ -8,5 +8,4 @@ require:
- systemtap
- ruby-doc
- ruby
- /usr/share/doc/ruby-doc/ruby-exercise.stp
duration: 30m

View file

@ -2,7 +2,7 @@
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/ruby/Regression/systemtap-static-probes-in-ruby
# runtest.sh of systemtap-static-probes-in-ruby
# Description: It tests there are static probes in ruby package.
# Author: Ales Marecek <amarecek@redhat.com>
#
@ -27,7 +27,7 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/share/beakerlib/beakerlib.sh
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGES=${PACKAGES:-ruby ruby-libs rubypick}
# in RHEL7 and later the stap file is in ruby-doc package
@ -45,11 +45,15 @@ _STAP_OUT="stap-out.log"
# for ruby on RHEL7 and in collections
PRINT="Kernel::printf"
RUBY_OPTS="--disable-gems"
STAP_OPTS="--suppress-handler-errors"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm --all
rlAssertBinaryOrigin $RUBY
rlAssertExists "${_STAP_FILE}" || rlDie
rlRun "stap-prep" 0 "Prepare system for systemtap use"
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
rlRun "pushd ${TmpDir}"
_LOG_FILE="${TmpDir}/${_LOG_FILE}"
@ -61,19 +65,29 @@ rlJournalStart
rlRun "rpm -ql $PACKAGES | grep 'stp' | grep 'tapset'" 0 "Checking tapset file"
rlRun "rpm -ql $PACKAGES | grep 'stp' | grep 'doc'" 0 "Checking doc file"
rlRun "{ stap -v ${_STAP_FILE} -o ${_LOG_FILE} |& tee ${_STAP_OUT}; } &" 0 "Running systemtap in background"
if ! $RUBY $RUBY_OPTS -e ''; then
rlLog "Can't use $RUBY_OPTS as option for $RUBY, removing these options"
RUBY_OPTS=""
fi
if rlTestVersion "$(rpm -qf $(command -v stap) --qf '%{version}-%{release}')" ">=" "4.7-1"; then
rlLog "Changing stap buffer size"
STAP_OPTS="$STAP_OPTS -s 100"
fi
rlRun "{ stap $STAP_OPTS -v ${_STAP_FILE} -o ${_LOG_FILE} |& tee ${_STAP_OUT}; } &" 0 "Running systemtap in background"
_STAP_PID=$!
echo -e "--_STAP_PID--\n${_STAP_PID}" # info
# wait for systemtap to start
rlWaitForCmd "grep 'starting run' ${_STAP_OUT}"
rlRun "$RUBY -e '1.0 + 9.0'" 0 "Running ruby interpreter: Float test"
rlRun "$RUBY -e '[1, 2, 3].push(4)'" 0 "Running ruby interpreter: Array test"
rlRun "$RUBY -e '(1..10).step(1)'" 0 "Running ruby interpreter: Range test"
rlRun "$RUBY -e 'Hash.new()'" 0 "Running ruby interpreter: Hash test"
rlRun "$RUBY -e '\"abc\".slice!(\"c\")'" 0 "Running ruby interpreter: String test"
rlRun "$RUBY -e '5.times { printf \"Ruby!\n\" }'" 0 "Running ruby interpreter: Cycle and print test"
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"
rlRun "$RUBY $RUBY_OPTS -e '(1..10).step(1)'" 0 "Running ruby interpreter: Range test"
rlRun "$RUBY $RUBY_OPTS -e 'Hash.new()'" 0 "Running ruby interpreter: Hash test"
rlRun "$RUBY $RUBY_OPTS -e '\"abc\".slice!(\"c\")'" 0 "Running ruby interpreter: String test"
rlRun "$RUBY $RUBY_OPTS -e '5.times { printf \"Ruby!\n\" }'" 0 "Running ruby interpreter: Cycle and print test"
# wait for all output
rlRun "sleep 10" 0 "Waiting \"10\" seconds"