systemtap/tests/Regression/small-tests/runtest.sh

216 lines
8.5 KiB
Bash
Raw Normal View History

#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/systemtap/Regression/small-tests
# Description: suns small tests
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2014 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# 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, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
. /etc/os-release ||:
PACKAGE="systemtap"
_arch=$(arch)
function perf_probe_failed ()
{
probe=$1
perf probe -d $probe ||:
perf probe --add $probe
retval=$?
test $retval -eq 0 && \
rlLogInfo "Running perf probe --add $probe PASSED" || \
rlLogInfo "Running perf probe --add $probe FAILED"
perf probe -d $probe ||:
if test $retval -eq 0; then
return 1
else
return 0
fi
}
function perf_found_none_of ()
{
ret=0
for f in "$@"; do
perf_probe_failed $f || ret=1
done
return $ret
}
rlJournalStart
# Check the environment ---------------------------------------
rlPhaseStart WARN "Check the environment"
rlRun "rpm -qa | egrep '^(kernel|systemtap|perf)' | sort"
rlRun "uname -r"
rlRun "perf --version"
rlLogInfo "DEBUGINFOD_URLS=$DEBUGINFOD_URLS"
rlLogInfo "DEBUGINFOD_TIMEOUT=$DEBUGINFOD_TIMEOUT"
rlPhaseEnd
# bz1162939 ---------------------------------------------------
(
perf_probe_failed "vfs_read" && exit
rlPhaseStart FAIL "test 1 bz1162939"
rlRun "stap -e 'probe vfs.read{println(\"hit\"); exit()}' -c 'head -1 /etc/hosts' | grep -F hit"
rlPhaseEnd
)
# bz1119335 ---------------------------------------------------
rlPhaseStart FAIL "test 2 bz1119335"
rlRun "man 8 staprun | grep 'STAP_FIPS_OVERRIDE'"
rlPhaseEnd
# bz1153673 ---------------------------------------------------
rlPhaseStart FAIL "test 3 bz1153673"
_tested=0
for _pkg in $( rpm -qa | grep systemtap-testsuite ); do
for _tc in $( rpm -ql $_pkg | grep 'alias_suffixes.stp$' ); do
stap -p4 $_tc && p="" || p="-P"
rlRun "stap $p -p4 $_tc"
_tested=1
done
done
[[ $_tested -eq 0 ]] && rlFail "Not tested"
rlPhaseEnd
# bz1160837 ---------------------------------------------------
(
perf_probe_failed "sd_init_command" && exit
rlPhaseStart FAIL "test 4 bz1160837"
_tested=0
_prologue_search=''
for _pkg in $( rpm -qa | grep systemtap-testsuite ); do
for _tc in $( rpm -ql $_pkg | grep 'iostat-scsi.stp$' ); do
test $_arch = ppc64le && _prologue_search='-P'
rlRun "stap -g $_prologue_search $_tc 1 -c 'sleep 1'"
_tested=1
done
done
[[ $_tested -eq 0 ]] && rlFail "Not tested"
rlPhaseEnd
)
# bz1203808 ---------------------------------------------------
rlPhaseStart FAIL "test 5 bz1203808"
_tested=0
for _pkg in $( rpm -qa | grep systemtap-testsuite ); do
for _tc in $( rpm -ql $_pkg | grep 'vfs-all-probes.stp$' ); do
stap -wp4 $_tc && p="" || p="-P"
rlRun "stap $p -w -p4 $_tc"
_tested=1
done
done
[[ $_tested -eq 0 ]] && rlFail "Not tested"
rlPhaseEnd
# bz1269062 ---------------------------------------------------
rlPhaseStart FAIL "test 6 bz1269062"
rlRun "stap -c sync --suppress-handler-errors -e 'probe ioscheduler.elv_add_request{println(elevator_name) exit()}'"
rlPhaseEnd
# bz528792 ---------------------------------------------------
(
# Not relevant on rhel-9 because of kernel commit cad6967ac10843a70842cd39c7b53412901dd21f that removes
# _do_fork() and replaces it with new kernel_clone()
perf_found_none_of "_do_fork" "do_fork" "sys_clone" && exit
rlPhaseStart FAIL "test 7 bz528792"
if test $_arch = ppc64le; then
# https://bugzilla.redhat.com/show_bug.cgi?id=1652740#c4 - We can not reach any function parameters, namely $clone_flags
rlRun "stap -ve 'probe kernel.function(\"_do_fork\")!, kernel.function(\"do_fork\")!, kernel.function(\"sys_clone\") { println(pp()) exit() }' -c \"bash -c 'while sleep 1; do /bin/true; done'\""
else
rlRun "stap -ve 'probe kernel.function(\"_do_fork\")!, kernel.function(\"do_fork\")!, kernel.function(\"sys_clone\") { printf(\"%x\n\",\$clone_flags) exit() }' -c \"bash -c 'while sleep 1; do /bin/true; done'\""
fi
rlPhaseEnd
)
# bz1890702 ---------------------------------------------------
(
perf_probe_failed "vfs_open" && exit
rlPhaseStart FAIL "test 8 bz1890702"
rlRun "stap -g --suppress-time-limits -e 'probe kernel.function(\"vfs_open\") { printf(\"%s(path: %s)\", ppfunc(), \$path\$) ; exit() }' -c 'cat /etc/hosts'"
rlPhaseEnd
)
# bz1904216 ---------------------------------------------------
rlPhaseStart FAIL "test 9 bz1904216"
rlRun "stap -p4 -DSTP_NO_OVERLOAD -t -c 'sleep 0.25' -e 'probe kernel.trace(\"bcache:bcache_btree_set_root\") { if (pid() == 0) printf(\"probe hit\n\"); }'"
rlPhaseEnd
# bz1940804 ---------------------------------------------------
rlPhaseStart FAIL "test 10 bz1940804"
rlRun "stap -e 'probe process(\"/bin/bash\").function(\"main\") {println(pn()) }' -c '/bin/bash --help'"
rlPhaseEnd
# bz1940945 ---------------------------------------------------
rlPhaseStart FAIL "test 11 bz1940945"
rlRun "stap -c sync --suppress-handler-errors -e 'probe ioscheduler.elv_add_request{println(elevator_name) exit()}'"
rlPhaseEnd
# bz1940761 ---------------------------------------------------
rlPhaseStart FAIL "test 12 bz1940761"
rlRun "stap -v /usr/share/systemtap/examples/process/strace.stp -w -c \"echo hello world\""
rlPhaseEnd
# broken-tapset-print-ubacktrace ------------------------------
rlPhaseStart FAIL "test 13 broken-tapset-print-ubacktrace"
rlRun "stap -p4 -e 'probe begin { print_ubacktrace() }'"
rlPhaseEnd
# Protected from elision --------------------------------------
rlPhaseStart FAIL "test 14 protected from elision"
rlRun "stap -v -e 'probe nfs.fop.fsync {} probe begin {print(\"Protected from elision\")}' -c true |\
grep -F 'Protected from elision'"
rlPhaseEnd
# bz544207 ----------------------------------------------------
rlPhaseStart FAIL "test 15 bz544207"
extra_opts=""
stap -vp4 -e 'probe nfs.proc.write_setup{ println(how) }' || extra_opts="-P"
rlRun "stap $extra_opts -vp4 -e 'probe nfs.proc.write_setup{ println(how) }'"
rlPhaseEnd
# bz544209 ----------------------------------------------------
rlPhaseStart FAIL "test 16 bz544209"
rlRun "stap -vp2 -e 'probe sunrpc.clnt.create_client.return {}'"
rlPhaseEnd
# bz592830 ----------------------------------------------------
rlPhaseStart FAIL "test 17 bz592830"
rlRun "stap -vp2 -e 'probe signal.check_ignored.return {println(1)}'"
rlPhaseEnd
# caller-does-not-work ----------------------------------------
rlPhaseStart FAIL "test 18 caller-does-not-work"
rlRun "stap -ve 'probe kernel.function(\"vfs_read\") \
{ printf(\"%s\n\", caller()); exit() }' 2>&1 | tee strace.log"
rlPhaseEnd
# missing-rpc-tracepoints -------------------------------------
rlPhaseStart FAIL "test 19 missing-rpc-tracepoints"
rlRun "stap -L 'kernel.trace(\"rpc*\")'"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd