systemtap/tests/Sanity/byteman-java-methods-probing/runtest.sh
Frank Ch. Eigler 6b9b658442 testsuite: adapt to "fgrep" deprecation
Since for some reason upstream grep deprecated "fgrep", and for some reason
fedora packagers followed suit, some these tests scripts fail with the goofy
"fgrep: warning: fgrep is obsolescent; using grep -F" warning.
2024-01-25 16:42:18 -05:00

84 lines
3.1 KiB
Bash
Executable File

#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/systemtap/Sanity/byteman-java-methods-probing
# Description: byteman-java-methods-probing
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2013 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
rlJournalStart
rlPhaseStartSetup
rlLogInfo "DEBUGINFOD_URLS=$DEBUGINFOD_URLS"
rlLogInfo "DEBUGINFOD_TIMEOUT=$DEBUGINFOD_TIMEOUT"
# At this point we simply rely on that the %triggerin scriptlet from
# systemtap-runtime-java did it's job well. There was a hack to force
# trigger it here, but commit respective to this comment removes it.
# https://bugzilla.redhat.com/show_bug.cgi?id=1732514#c11
rlRun "rpm -qa | grep -F -e systemtap-runtime-java -e byteman -e openjdk | sort"
rlRun "stap-prep"
for BINARY in java javac; do
rlRun "alternatives --display $BINARY | grep -v slave"
rlRun "$BINARY -version"
done
rlRun "TMPDIR=$( mktemp -d )"
rlRun "mkdir -p $TMPDIR/foo/bar"
rlRun "cp ThreadedExample.java $TMPDIR/foo/bar/"
rlRun "cp ThreadedExample.stp $TMPDIR/"
rlRun "pushd $TMPDIR"
rlPhaseEnd
rlPhaseStart FAIL 'Prepare bytecode class'
rlRun "javac foo/bar/ThreadedExample.java"
rlPhaseEnd
rlPhaseStart FAIL 'Prepare the LKML'
rlRun "stap -p4 -m ThreadedExample ThreadedExample.stp"
rlPhaseEnd
rlPhaseStart FAIL 'Check the Feature'
java foo.bar.ThreadedExample &
rlRun "jps -l | grep 'foo.bar.ThreadedExample'"
export STAPBM_VERBOSE=yes
# rlRun "stap --poison-cache -vv ThreadedExample.stp 2>&1 | tee testout.log"
# Speed the stap startup up by pre-compiling the module within separate
# phase 'Prepare the LKML' above.
rlRun "staprun -v -R ThreadedExample.ko 2>&1 | tee testout.log"
rlRun "grep -q 'Hit printMessage(int): 42' testout.log"
rlRun "grep -q 'Hit printMessage(long): 987234864' testout.log"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TMPDIR"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd