CI: Refer to tests in Rawhide dist-git
This commit is contained in:
parent
b8a6290bd2
commit
7b1dd23b34
@ -1,7 +1,10 @@
|
||||
summary: CI Gating Plan
|
||||
discover:
|
||||
how: fmf
|
||||
url: https://src.fedoraproject.org/rpms/systemtap.git
|
||||
ref: rawhide
|
||||
directory: tests
|
||||
filter: 'tier: 1'
|
||||
prepare:
|
||||
how: install
|
||||
exclude:
|
||||
|
@ -1,30 +0,0 @@
|
||||
#!/usr/bin/stap -g
|
||||
|
||||
global sshd_fork_count
|
||||
global fork_to_fail=1
|
||||
|
||||
probe begin {
|
||||
printf("Started\n\n")
|
||||
}
|
||||
|
||||
probe kernel.function("*kernel_clone").call {
|
||||
if (execname() == "sshd") {
|
||||
sshd_fork_count++
|
||||
printf(">>>%s[%5d] %s\n", execname(), pid(), $$parms)
|
||||
printf(" PPID=%d\n",ppid())
|
||||
printf(" sshd_fork_count=%d\n",sshd_fork_count)
|
||||
}
|
||||
}
|
||||
|
||||
probe kernel.function("*kernel_clone").return {
|
||||
if (execname() == "sshd") {
|
||||
printf("<<<%s[%5d] %s\n", execname(), pid(), $$return)
|
||||
printf(" PPID=%d\n",ppid())
|
||||
printf(" RETURN:%d\n\n",$return)
|
||||
if (sshd_fork_count == fork_to_fail) {
|
||||
printf("!!! fork() will return -1\n")
|
||||
$return = -1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +0,0 @@
|
||||
summary: Test for BZ#2047256
|
||||
description: Test for BZ#2047256
|
||||
contact: Martin Cermak <mcermak@redhat.com>
|
||||
component:
|
||||
- systemtap
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- systemtap
|
||||
duration: 10m
|
||||
enabled: true
|
||||
extra-nitrate: TC#0387246
|
||||
extra-summary: /tools/systemtap/Regression/bz2047256
|
||||
extra-task: /tools/systemtap/Regression/bz2047256
|
@ -1,39 +0,0 @@
|
||||
#!/bin/bash
|
||||
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /tools/systemtap/Regression/bz2047256
|
||||
# Author: Martin Cermak <mcermak@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2014 Red Hat, Inc.
|
||||
#
|
||||
# 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
|
||||
rlPhaseStartTest
|
||||
# Exit code 137 is expected with the fixed package
|
||||
# on systems with low memory. On systems with enough
|
||||
# memory, this should just pass.
|
||||
rlRun "stap -vp2 -g fork.stp" 0,137
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
@ -1,20 +0,0 @@
|
||||
#!/usr/bin/stap -v
|
||||
/*
|
||||
Example usage of the Python systemtap tapset to show a nested view of all
|
||||
Python function calls (and returns) across the whole system.
|
||||
|
||||
Run this using
|
||||
stap systemtap-example.stp
|
||||
to instrument all Python processes on the system, or (for example) using
|
||||
stap systemtap-example.stp -c COMMAND
|
||||
to instrument a specific program (implemented in Python)
|
||||
*/
|
||||
probe python.function.entry
|
||||
{
|
||||
printf("%s => %s in %s:%d\n", thread_indent(1), funcname, filename, lineno);
|
||||
}
|
||||
|
||||
probe python.function.return
|
||||
{
|
||||
printf("%s <= %s in %s:%d\n", thread_indent(-1), funcname, filename, lineno);
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
summary: Systemtap static probes test
|
||||
description: |
|
||||
This test checks basic functionality of Python's systemtap static
|
||||
probes. It runs list & top systemtap scripts (examples from the
|
||||
python rpm) and then a python script using the "random" module.
|
||||
Finally it checks that the "random" module is correctly listed in
|
||||
the output of both systemtap scripts.
|
||||
contact: Petr Splichal <psplicha@redhat.com>
|
||||
component:
|
||||
- python
|
||||
- systemtap
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- python
|
||||
- python-debuginfo
|
||||
- systemtap
|
||||
- python2
|
||||
- python3
|
||||
- elfutils
|
||||
duration: 15m
|
||||
extra-summary: /CoreOS/python/Sanity/systemtap
|
||||
extra-task: /CoreOS/python/Sanity/systemtap
|
@ -1,81 +0,0 @@
|
||||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /CoreOS/python/Sanity/systemtap
|
||||
# Description: Systemtap static probes test
|
||||
# Author: Petr Splichal <psplicha@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2011 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 rhts environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
# Packages to be tested
|
||||
PACKAGES="${PACKAGES:-python3}"
|
||||
# Other required packages
|
||||
REQUIRES=${REQUIRES:-}
|
||||
# Binary name parametrized
|
||||
PYTHON="${PYTHON:-python3}"
|
||||
|
||||
package=$(rpm -qf --queryformat '%{name}\n' $(which $PYTHON))
|
||||
collection_path=$(which python | sed 's/\/usr\/bin\/python//')
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm --all
|
||||
rlAssertRpm "systemtap"
|
||||
rlLogInfo "Running on kernel: $(uname -r)"
|
||||
rlRun "rpm -qa 'systemtap*'" 0 "Checking systemtap packages"
|
||||
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
|
||||
rlRun "cp list.stp top.stp test.py $TmpDir" 0 "Copying scripts"
|
||||
rlRun "pushd $TmpDir"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Verifying ELF file for presence of .probes section"
|
||||
for lib in ${collection_path}/usr/lib*/libpython*.so.* ; do
|
||||
rlRun "eu-readelf -x .probes $lib" \
|
||||
0 "Checking for .probes section within $lib"
|
||||
done
|
||||
rlPhaseEnd
|
||||
|
||||
# Note that typically you need to be root to run "stap" (or be within
|
||||
# an appropriate group)
|
||||
for script in list top; do
|
||||
rlPhaseStartTest "Test $script"
|
||||
rlRun "rm -rf ~/.systemtap/cache" 0 "Cleaning cache"
|
||||
rlRun "stap $script.stp -v -c \"$PYTHON test.py\" > $script" \
|
||||
0 "Testing with $script.stp"
|
||||
rlRun "tail -100 $script | col -b" 0 "Inspecting output"
|
||||
if ! rlRun "grep '/usr/lib.*python.*random.py' '$script'" \
|
||||
0 "Checking for random in the $script output"; then
|
||||
rlRun "stap $script.stp -vvv -c \"$PYTHON test.py\" > $script" \
|
||||
0 "Running $script.stp once more in verbose mode"
|
||||
fi
|
||||
rlPhaseEnd
|
||||
done
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
@ -1,3 +0,0 @@
|
||||
import random, time
|
||||
print(random.random())
|
||||
time.sleep(3)
|
@ -1,21 +0,0 @@
|
||||
#!/usr/bin/stap -v
|
||||
|
||||
global fn_calls;
|
||||
|
||||
probe python.function.entry
|
||||
{
|
||||
fn_calls[pid(), filename, funcname, lineno] += 1;
|
||||
}
|
||||
|
||||
probe timer.ms(1000) {
|
||||
printf("\033[2J\033[1;1H") /* clear screen */
|
||||
printf("%6s %80s %6s %30s %6s\n",
|
||||
"PID", "FILENAME", "LINE", "FUNCTION", "CALLS")
|
||||
foreach ([pid, filename, funcname, lineno] in fn_calls- limit 1000) {
|
||||
printf("%6d %80s %6d %30s %6d\n",
|
||||
pid, filename, lineno, funcname,
|
||||
fn_calls[pid, filename, funcname, lineno]);
|
||||
}
|
||||
|
||||
delete fn_calls;
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
summary: suns small tests
|
||||
description: ''
|
||||
contact: Martin Cermak <mcermak@redhat.com>
|
||||
component:
|
||||
- systemtap
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- systemtap
|
||||
- systemtap-testsuite
|
||||
- perf
|
||||
duration: 10m
|
||||
extra-summary: /tools/systemtap/Regression/small-tests
|
||||
extra-task: /tools/systemtap/Regression/small-tests
|
@ -1,183 +0,0 @@
|
||||
#!/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
|
||||
|
||||
PACKAGE="systemtap"
|
||||
|
||||
export DEBUGINFOD_URLS="https://debuginfod.fedoraproject.org/ $DEBUGINFOD_URLS"
|
||||
export DEBUGINFOD_TIMEOUT=300
|
||||
|
||||
_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"
|
||||
rlPhaseEnd
|
||||
|
||||
# bz1162939 ---------------------------------------------------
|
||||
(
|
||||
perf_probe_failed "vfs_read" && exit
|
||||
rlPhaseStart FAIL "test 1 bz1162939"
|
||||
# At this point a weird problem shows up: sometimes the first
|
||||
# systemtap invocation fails for some reason, but subsequent
|
||||
# invocations succeed. Can't reproduce this manually:
|
||||
rlRun "stap -vvvp4 -e 'probe vfs.read{println(\"hit\")}'" 0,1
|
||||
sleep 30
|
||||
rlRun "stap -vvvp4 -e 'probe vfs.read{println(\"hit\")}'" 0,1
|
||||
sleep 30
|
||||
rlRun "stap -e 'probe vfs.read{println(\"hit\")}' -c 'head -1 /etc/hosts'"
|
||||
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
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
@ -1,60 +0,0 @@
|
||||
package foo.bar;
|
||||
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
|
||||
class ThreadedExample
|
||||
{
|
||||
|
||||
public static void printMessage(int message) {
|
||||
System.out.println("message: " + message);
|
||||
}
|
||||
|
||||
public static void printMessage(long message) {
|
||||
System.out.println("message: " + message);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
// sleep so that stap can start and byteman agent gets installed
|
||||
try {
|
||||
Thread.sleep(30000);
|
||||
} catch(InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
String[] inputs = new String[] {"int", "foo", "long"};
|
||||
for (String next : inputs) {
|
||||
|
||||
final String arg = next;
|
||||
final int i = 42;
|
||||
final long j = 987234864;
|
||||
Thread thread = new Thread(arg) {
|
||||
public void run() {
|
||||
if(arg.equals("int"))
|
||||
printMessage(i);
|
||||
else if(arg.equals("long"))
|
||||
printMessage(j);
|
||||
else
|
||||
System.out.println("Neither of the types");
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
try {
|
||||
thread.join();
|
||||
} catch (Exception e){}
|
||||
}
|
||||
} catch (Exception e){}
|
||||
|
||||
|
||||
// sleep so that stap can finish still while probed java program still runs
|
||||
try {
|
||||
Thread.sleep(80000);
|
||||
} catch(InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +0,0 @@
|
||||
probe java("foo.bar.ThreadedExample").class("ThreadedExample").method("printMessage(int)")
|
||||
{
|
||||
printf("Hit printMessage(int): %s\n", arg1)
|
||||
}
|
||||
|
||||
probe java("foo.bar.ThreadedExample").class("ThreadedExample").method("printMessage(long)")
|
||||
{
|
||||
printf("Hit printMessage(long): %s\n", arg1)
|
||||
exit()
|
||||
}
|
||||
|
||||
probe timer.ms(100000)
|
||||
{
|
||||
error("Exit on timeout")
|
||||
exit()
|
||||
}
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
summary: byteman-java-methods-probing
|
||||
description: ''
|
||||
contact: Martin Cermak <mcermak@redhat.com>
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- java-devel
|
||||
- systemtap
|
||||
- systemtap-runtime-java
|
||||
duration: 15m
|
||||
extra-summary: /tools/systemtap/Sanity/byteman-java-methods-probing
|
||||
extra-task: /tools/systemtap/Sanity/byteman-java-methods-probing
|
@ -1,83 +0,0 @@
|
||||
#!/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
|
||||
|
||||
export DEBUGINFOD_URLS="https://debuginfod.fedoraproject.org/ $DEBUGINFOD_URLS"
|
||||
export DEBUGINFOD_TIMEOUT=300
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
# 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 | fgrep -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
|
@ -1,3 +0,0 @@
|
||||
obj-m := MODULENAME.o
|
||||
module:
|
||||
make -C /lib/modules/$(shell uname -r)/build KBUILD_EXTMOD=DIRECTORY SUBDIRS=DIRECTORY modules
|
@ -1,17 +0,0 @@
|
||||
summary: Tests systemtap working with kernel modules
|
||||
description: ''
|
||||
contact: Petr Muller <pmuller@redhat.com>
|
||||
component:
|
||||
- systemtap
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- systemtap
|
||||
- kernel-devel
|
||||
- bison
|
||||
- flex
|
||||
- openssl-devel
|
||||
- elfutils-libelf-devel
|
||||
duration: 10m
|
||||
extra-summary: /tools/systemtap/Sanity/kernel-modules
|
||||
extra-task: /tools/systemtap/Sanity/kernel-modules
|
@ -1,20 +0,0 @@
|
||||
#include <linux/module.h> /* Needed by all modules */
|
||||
#include <linux/kernel.h> /* Needed for KERN_INFO */
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
printk(KERN_INFO "Hello world 1.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int some_method(void){
|
||||
printk(KERN_INFO "Some method called\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cleanup_module(void)
|
||||
{
|
||||
printk(KERN_INFO "Goodbye world 1.\n");
|
||||
}
|
||||
|
||||
MODULE_LICENSE("GPL");
|
@ -1,123 +0,0 @@
|
||||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /tools/systemtap/Sanity/kernel-modules
|
||||
# Description: Tests systemtap working with kernel modules
|
||||
# Author: Petr Muller <pmuller@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2012 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
|
||||
|
||||
PACKAGE="systemtap"
|
||||
|
||||
check_probes(){
|
||||
FAIL=""
|
||||
rlAssertGrep init_module $1 || FAIL='yes'
|
||||
rlAssertGrep cleanup_module $1 || FAIL='yes'
|
||||
rlAssertGrep some_method $1 || FAIL='yes'
|
||||
|
||||
if [ -n "$FAIL" ]
|
||||
then
|
||||
rlFileSubmit $1 $2.out
|
||||
fi
|
||||
}
|
||||
|
||||
rlJournalStart
|
||||
|
||||
rlPhaseStartSetup "Preparing modules"
|
||||
rlRun "mkdir -p 'stap-underscore' 'stap-dash' 'stap-none'"
|
||||
rlRun "cp module.c stap-underscore/test_module.c"
|
||||
rlRun "cp module.c stap-dash/test-module.c"
|
||||
rlRun "cp module.c stap-none/testmodule.c"
|
||||
|
||||
cat Makefile.template | sed -e 's/MODULENAME/test_module/g' \
|
||||
| sed -e "s|DIRECTORY|$PWD/stap-underscore|g" > stap-underscore/Makefile
|
||||
rlAssert0 "Creating Makefile for underscore variant" $?
|
||||
cat Makefile.template | sed -e 's/MODULENAME/test-module/g' \
|
||||
| sed -e "s|DIRECTORY|$PWD/stap-dash|g" > stap-dash/Makefile
|
||||
rlAssert0 "Creating Makefile for dash variant" $?
|
||||
|
||||
cat Makefile.template | sed -e 's/MODULENAME/testmodule/g' \
|
||||
| sed -e "s|DIRECTORY|$PWD/stap-none|g" > stap-none/Makefile
|
||||
rlAssert0 "Creating Makefile for no character variant" $?
|
||||
|
||||
if [ -n "$ARCH" ]
|
||||
then
|
||||
rlLog "ARCH is set to: [$ARCH]"
|
||||
rlLog "This interferes with 'make module', so it needs to be unset."
|
||||
ARCHOLD="$ARCH"
|
||||
unset ARCH
|
||||
rlLog "ARCH is set to: [$ARCH]"
|
||||
fi
|
||||
rlRun "make -C stap-underscore module"
|
||||
rlRun "make -C stap-dash module"
|
||||
rlRun "make -C stap-none module"
|
||||
if [ -n "$ARCHOLD" ]
|
||||
then
|
||||
rlLog "Restoring ARCH"
|
||||
export ARCH="$ARCHOLD"
|
||||
rlLog "ARCH is set to: [$ARCH]"
|
||||
fi
|
||||
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Testing underscore variant"
|
||||
rlRun "cp stap-underscore/test_module.ko /lib/modules/$(uname -r)/"
|
||||
rlRun "insmod stap-underscore/test_module.ko"
|
||||
stap -L 'module("test_module").function("*")' -v > stap.out
|
||||
check_probes stap.out "module-und-probe-und"
|
||||
stap -L 'module("test-module").function("*")' -v > stap.out
|
||||
check_probes stap.out "module-und-probe-dash"
|
||||
sleep 1
|
||||
rlRun "rmmod test_module"
|
||||
rlRun "rm -f /lib/modules/$(uname -r)/test_module.ko"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Testing dash variant"
|
||||
rlRun "cp stap-dash/test-module.ko /lib/modules/$(uname -r)/"
|
||||
rlRun "insmod stap-dash/test-module.ko"
|
||||
stap -L 'module("test_module").function("*")' -v > stap.out
|
||||
check_probes stap.out "module-dash-probe-und"
|
||||
stap -L 'module("test-module").function("*")' -v > stap.out
|
||||
check_probes stap.out "module-dash-probe-dash"
|
||||
sleep 1
|
||||
rlRun "rmmod test-module"
|
||||
rlRun "rm -f /lib/modules/$(uname -r)/test-module.ko"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Testing no separator variant"
|
||||
rlRun "cp stap-none/testmodule.ko /lib/modules/$(uname -r)/"
|
||||
rlRun "insmod stap-none/testmodule.ko"
|
||||
stap -L 'module("testmodule").function("*")' -v > stap.out
|
||||
check_probes stap.out "module-none-probe-none"
|
||||
sleep 1
|
||||
rlRun "rmmod testmodule"
|
||||
rlRun "rm -f /lib/modules/$(uname -r)/testmodule.ko"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "rm -rf stap-underscore stap-dash stap-none stap.out"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
@ -1,14 +0,0 @@
|
||||
summary: Quick test that systemtap generally works
|
||||
description: ''
|
||||
contact:
|
||||
- Petr Muller <pmuller@redhat.com>
|
||||
component:
|
||||
- systemtap
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- systemtap
|
||||
- kernel-devel
|
||||
duration: 1h
|
||||
extra-summary: /tools/systemtap/Sanity/quick-smoke-test
|
||||
extra-task: /tools/systemtap/Sanity/quick-smoke-test
|
@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# runtest.sh of /tools/systemtap/Sanity/quick-smoke-test
|
||||
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartTest
|
||||
rlRun "rpm -qa | egrep '^(kernel|systemtap)' | sort"
|
||||
rlRun "uname -r"
|
||||
rlRun "stap-prep"
|
||||
rlRun "stap -L 'process(\"stap\").mark(\"*\")' | grep pass"
|
||||
rlRun "stap -v --example helloworld.stp"
|
||||
rlRun "stap -v -T 10 -p4 -e 'probe kernel.function(\"do_exit\") {println(\$\$vars)}'"
|
||||
rlRun "stap -v -T 60 -e 'probe kernel.function(\"vfs_read\"){ println(\$\$vars); exit() }'"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
@ -1,17 +0,0 @@
|
||||
summary: stap-server-basic-sanity
|
||||
description: ''
|
||||
contact: Martin Cermak <mcermak@redhat.com>
|
||||
component:
|
||||
- systemtap
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- systemtap
|
||||
- kernel-debuginfo
|
||||
- avahi
|
||||
- systemtap-server
|
||||
- dbus
|
||||
- net-tools
|
||||
duration: 45m
|
||||
extra-summary: /tools/systemtap/Sanity/stap-server-basic-sanity
|
||||
extra-task: /tools/systemtap/Sanity/stap-server-basic-sanity
|
@ -1,98 +0,0 @@
|
||||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /tools/systemtap/Sanity/stap-server-basic-sanity
|
||||
# Description: stap-server-basic-sanity
|
||||
# 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
|
||||
|
||||
CMD='stap'
|
||||
BIN=$(which --skip-alias $CMD)
|
||||
PACKAGE="${PACKAGE:-$(rpm -qf --qf='%{name}\n' $BIN | head -1)}"
|
||||
|
||||
export DEBUGINFOD_URLS="https://debuginfod.fedoraproject.org/ $DEBUGINFOD_URLS"
|
||||
export DEBUGINFOD_TIMEOUT=300
|
||||
|
||||
function service_stap_server() {
|
||||
action=$1
|
||||
retval=${2:-0}
|
||||
sleep 5
|
||||
rlLogInfo "PACKAGE=$PACKAGE"
|
||||
if echo $PACKAGE | grep -q devtoolset; then
|
||||
__i=$(echo $PACKAGE | awk -F- '{print $2}')
|
||||
rlRun "service devtoolset-$__i-stap-server $action" $retval
|
||||
elif echo $PACKAGE | grep -q gcc-toolset; then
|
||||
__i=$(echo $PACKAGE | awk -F- '{print $3}')
|
||||
rlRun "service gcc-toolset-$__i-stap-server $action" $retval
|
||||
else
|
||||
rlRun "service stap-server $action" $retval
|
||||
fi
|
||||
sleep 5
|
||||
}
|
||||
|
||||
_rhelmajor=$(rpm --eval '%{rhel}')
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlRun "TMPDIR=$(mktemp -d)"
|
||||
rlRun "pushd $TMPDIR"
|
||||
rlAssertRpm dbus
|
||||
rlAssertRpm avahi
|
||||
rlAssertRpm net-tools # because of netstat
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStart FAIL "sanity check"
|
||||
rlRun "stap -v -e 'probe begin { log(\"hello\"); exit() }'"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
rlRun "service iptables stop" 0-255
|
||||
rlRun "service firewalld stop" 0-255
|
||||
service_stap_server stop
|
||||
test $_rhelmajor -le 8 && \
|
||||
rlRun "service messagebus restart"
|
||||
rlRun "service avahi-daemon restart"
|
||||
service_stap_server start
|
||||
|
||||
rlRun "netstat -tlp | grep stap"
|
||||
rlRun "SERVER_PORT=$( netstat -tlpn | awk '/stap/ {print $4}' | grep -o '[0-9]*$' )"
|
||||
|
||||
for SERVER_IP in '127.0.0.1' '[::1]'; do
|
||||
rlLogInfo "Testing SERVER_IP=$SERVER_IP"
|
||||
rlRun "stap --trust-servers=ssl,signer,all-users,no-prompt --use-server=$SERVER_IP:$SERVER_PORT"
|
||||
rlRun "stap --use-server=$SERVER_IP:$SERVER_PORT -v -e 'probe begin { log(\"hello\"); exit() }' 2>&1 | tee output.log"
|
||||
rlRun "grep 'Using a compile server' output.log"
|
||||
rlRun "grep '^hello$' output.log"
|
||||
done
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
service_stap_server stop
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TMPDIR"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
@ -1,7 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
printf("Hello world!\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,16 +0,0 @@
|
||||
summary: userspace-probes
|
||||
description: ''
|
||||
contact: Martin Cermak <mcermak@redhat.com>
|
||||
component:
|
||||
- systemtap
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- systemtap
|
||||
- dyninst-devel
|
||||
- gawk
|
||||
duration: 5m
|
||||
link:
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=855981
|
||||
extra-summary: /CoreOS/systemtap/Sanity/userspace-probes
|
||||
extra-task: /CoreOS/systemtap/Sanity/userspace-probes
|
@ -1,90 +0,0 @@
|
||||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /CoreOS/systemtap/Sanity/userspace-probes
|
||||
# Description: userspace-probes
|
||||
# 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
|
||||
|
||||
export DEBUGINFOD_URLS="https://debuginfod.fedoraproject.org/ $DEBUGINFOD_URLS"
|
||||
export DEBUGINFOD_TIMEOUT=300
|
||||
|
||||
PACKAGE="$(rpm -qf $( which stap ) | head -n 1 )"
|
||||
WORKDIR=$( mktemp -d )
|
||||
TESTUSER=mytestuser
|
||||
|
||||
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStart WARN "Check the environment"
|
||||
if ! stap -V 2>&1 | grep -q 'enabled features:.*DYNINST'; then
|
||||
rlLogWarning "No dyninst available in $PACKAGE"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
||||
exit 0
|
||||
fi
|
||||
rlRun "useradd $TESTUSER" 0,9
|
||||
rlRun "su $TESTUSER -c 'which stap'"
|
||||
rlRun "rpm -qa | fgrep -e dyninst -e systemtap | sort"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartSetup
|
||||
rlRun "cp hello.c testcase*.sh $WORKDIR"
|
||||
rlRun "chown -R $TESTUSER:$TESTUSER $WORKDIR"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStart FAIL "Testcase 1"
|
||||
rlRun "which gcc"
|
||||
rlRun "su $TESTUSER -c 'gcc -g -o $WORKDIR/hello $WORKDIR/hello.c'"
|
||||
rlRun "su $TESTUSER -c '$WORKDIR/hello'"
|
||||
rlRun "chmod a+x $WORKDIR/testcase1.sh"
|
||||
rlRun "su $TESTUSER -c '$WORKDIR/testcase1.sh $WORKDIR'"
|
||||
|
||||
LOG="$WORKDIR/stapout.log"
|
||||
|
||||
rlRun "cat $LOG"
|
||||
rlRun "grep '^process(\"$WORKDIR/hello\").function(\"main@$WORKDIR/hello.c:3\")$' $LOG"
|
||||
rlRun "grep -i error $LOG" 1
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStart FAIL "Testcase 2"
|
||||
rlRun "chmod a+x $WORKDIR/testcase2.sh"
|
||||
rlRun "su $TESTUSER -c '$WORKDIR/testcase2.sh $WORKDIR'"
|
||||
|
||||
LOG="$WORKDIR/stapout.log"
|
||||
|
||||
rlRun "cat $LOG"
|
||||
rlRun "grep '^\*\*\*\ exiting\ \*\*\*$' $LOG"
|
||||
rlRun "egrep -i 'error|warning' $LOG" 1
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "userdel $TESTUSER" 0-255
|
||||
rlRun "rm -rf /home/$TESTUSER $WORKDIR"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
stap -e "probe process(\"$1/hello\").function(\"main\") { println(pn()) }" --runtime=dyninst -c "$1/hello" -o "$1/stapout.log"
|
@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
stap --runtime=dyninst -e 'probe end { printf("*** exiting ***\n"); exit() }' -c "$1/hello" -o "$1/stapout.log"
|
||||
|
Loading…
Reference in New Issue
Block a user