78 lines
2.7 KiB
Bash
78 lines
2.7 KiB
Bash
|
#!/bin/bash
|
||
|
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
#
|
||
|
# runtest.sh of /tools/systemtap/Regression/utrace-taskfinder-misses-events
|
||
|
# Description: Test for BZ#876848 (utrace taskfinder misses events when main thread)
|
||
|
# 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
|
||
|
|
||
|
# if this testcase caused kernel crash and reboot, don't try to rerun it
|
||
|
[[ $REBOOTCOUNT -gt 0 ]] && exit 1
|
||
|
|
||
|
rlJournalStart
|
||
|
rlPhaseStartSetup
|
||
|
rlRun "TMPDIR=\$(mktemp -d)"
|
||
|
rlRun "cp pthreadtestcase.cpp pthreadtestcase.stp $TMPDIR"
|
||
|
rlRun "pushd $TMPDIR"
|
||
|
rlPhaseEnd
|
||
|
|
||
|
rlPhaseStart FAIL "Systemtap sanity check"
|
||
|
rlRun "stap --version"
|
||
|
rlRun "stap -v -e 'probe kernel.function(\"vfs_read\"){ exit() }'"
|
||
|
rlPhaseEnd
|
||
|
|
||
|
rlPhaseStart FAIL "Prepare pthreadtestcase, run it"
|
||
|
rlRun "g++ -g -o pthreadtestcase pthreadtestcase.cpp -lpthread"
|
||
|
killall -9 pthreadtestcase &> /dev/null
|
||
|
./pthreadtestcase &
|
||
|
MYPID=$!
|
||
|
sleep 3
|
||
|
rlRun "ps | grep '$MYPID.*pthreadtestcase$'"
|
||
|
rlPhaseEnd
|
||
|
|
||
|
rlPhaseStartTest
|
||
|
rlRun "stap -v pthreadtestcase.stp 2>&1 | tee mylog.txt"
|
||
|
rlRun "grep EXITONTIMEOUT mylog.txt" 1
|
||
|
for token in USERSPACEFUNCTIONENTER \
|
||
|
USERSPACEREACHEDLINE \
|
||
|
USERSPACEFUNCTIONLEAVE
|
||
|
do
|
||
|
rlRun "grep ^$token$ mylog.txt" 0
|
||
|
done
|
||
|
rlPhaseEnd
|
||
|
|
||
|
rlPhaseStart FAIL "Shut pthreadtestcase down"
|
||
|
# pthreadtestcase should still be running
|
||
|
# so killing it should certsinly succeed
|
||
|
rlRun "kill $MYPID"
|
||
|
rlPhaseEnd
|
||
|
|
||
|
rlPhaseStartCleanup
|
||
|
rlRun "popd"
|
||
|
rlRun "rm -r $TMPDIR"
|
||
|
rlPhaseEnd
|
||
|
rlJournalEnd
|