Update system during systemtap probe test

Otherwise CI might be running old kernel which
no longer exists in repositories making the stap-prep fail on missing
debuginfo/devel packages.
This commit is contained in:
Lukáš Zachar 2025-01-21 10:03:16 +01:00
commit a0ddcd21c4
2 changed files with 18 additions and 1 deletions

View file

@ -8,6 +8,8 @@ adjust:
summary: It tests there are static probes in ruby package.
description: |
Simple test to exercise ruby's systemtap API.
Test updates the system under test unless ``UPDATE_SUT``
environment variable is set to any other value than ``1``.
component:
- systemtap
- ruby
@ -15,4 +17,4 @@ require:
- systemtap
- ruby-doc
- ruby
duration: 30m
duration: 50m

View file

@ -39,12 +39,27 @@ _STAP_OUT="stap-out.log"
RUBY_OPTS="--disable-gems"
STAP_OPTS="--suppress-handler-errors"
# System Under Test
UPDATE_SUT="${UPDATE_SUT:-1}"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm --all
rlAssertBinaryOrigin $RUBY
rlAssertExists "${_STAP_FILE}" || rlDie
rlLog "Using STAP_FILE from $(rpm -qf ${_STAP_FILE})."
if [[ $UPDATE_SUT == "1" ]]; then
rlLog "Machine to be updated, disable by setting UPDATE_SUT to other value than 1"
if [[ $TMT_REBOOT_COUNT == "0" ]]; then
rlRun "dnf update --refresh -y"
rlLog "Now reboot the system"
tmt-reboot
else
rlLog "SUT updated and rebooted"
fi
else
rlLog "Machine not to be updated"
fi
rlRun "stap-prep" 0 "Prepare system for systemtap use"
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
rlRun "pushd ${TmpDir}"