systemtap/tests/Regression/RHEL6Feature-cpp-backtraces/runtest.sh

122 lines
4.2 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/RHEL6Feature-cpp-backtraces
# Description: Tests backtracking in C++ programs
# Author: Petr Muller <pmuller@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2010 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
. /etc/os-release || exit 1
PACKAGE="systemtap"
inputAs_rlLog(){
while read line
do
rlLog "$line"
done
}
compareAndLog(){
rlAssertNotDiffer "$1" "$2"
if [ "$?" != "0" ]
then
rlLog "Difference:"
diff -u "$1" "$2" | inputAs_rlLog
fi
}
rlJournalStart
rlPhaseStartSetup
rlRun "g++ classes.cpp main.cpp -g -o classes"
rlAssertRpm glibc # show NVR
rlAssertRpm glibc-debuginfo
rlRun "stap-prep" 0-255
rlPhaseEnd
rlPhaseStartTest
rlRun "stap --ldd backtrackator.stp -c ./classes > output.out"
rlRun "cp output.out unprocessed.out"
rlLog "Processing output"
rlRun "sed -i -r -e 's/0x[0-9a-f]+/ADDRESS/g' output.out"
rlRun "sed -i -r -e 's/_[_A-Za-z0-9]*publicA1[A-Za-z0-9]*/publicA1/g' output.out"
rlRun "sed -i -r -e 's/_[_A-Za-z0-9]*publicA2[A-Za-z0-9]*/publicA2/g' output.out"
rlRun "sed -i -r -e 's/_[_A-Za-z0-9]*privateA1[A-Za-z0-9]*/privateA1/g' output.out"
rlRun "sed -i -r -e 's/_[_A-Za-z0-9]*privateA2[A-Za-z0-9]*/privateA2/g' output.out"
rlRun "sed -i -r -e 's/_[_A-Za-z0-9]*recursiveA1[A-Za-z0-9]*/recursiveA1/g' output.out"
rlRun "sed -i -r -e 's/_[_A-Za-z0-9]*publicB1[A-Za-z0-9]*/publicB1/g' output.out"
rlRun "sed -i -r -e 's/_[_A-Za-z0-9]*privateB1[A-Za-z0-9]*/privateB1/g' output.out"
rlRun "sed -i -r -e 's!\[((.*\/.*)|(classes))\]!\[PATH\]!g' output.out"
# http://stackoverflow.com/questions/13963150/what-does-the-gcc-function-suffix-isra-mean
rlIsRHEL '>=' 7 && arch | grep -q ppc && \
rlRun "sed -i 's/generic_start_main.isra.0/generic_start_main/' output.out"
if rlIsRHEL '>=' 9; then
[[ "`uname -m`" =~ "ppc64" ]] && \
rlRun "cat golden.el9.`arch`.out > golden-ppc64-17.out" || \
rlRun "cat golden.el9.`arch`.out > golden.out"
fi
if [ "$ID" == "fedora" ] && test "0$VERSION_ID" -ge 39; then
rlRun "cat golden.fc39.out > golden.out"
fi
# RHEL-9 s390x runtime/stack-s390.c:63:52: error: ASYNC_SIZE undeclared
# (PAGE_SIZE << 1) on stap side seems to work it around
if [ "`uname -m`" == "s390x" ] && ( rlIsRHEL 5 || rlIsRHEL 4 )
then
rlLog "Detected we are running on: s390x && RHEL <= 5"
rlLog "Using special expected output"
compareAndLog golden-s390x.out output.out
elif [ "`uname -m`" == "ppc64" ] && ( rlIsRHEL 5 || rlIsRHEL 4 )
then
rlLog "Detected we are running on: ppc64 && RHEL <= 5"
rlLog "Using special expected output"
compareAndLog golden-ppc64.out output.out
elif [[ "`uname -m`" =~ "ppc64" ]]
then
rlLog "Detected we are running on: ppc64"
rlLog "Using special expected output"
compareAndLog golden-ppc64-17.out output.out
else
rlLog "Detected we are running on: nothing special"
rlLog "Using generic expected output"
compareAndLog golden.out output.out
fi
rlPhaseEnd
rlPhaseStartCleanup
rlFileSubmit output.out
rlFileSubmit golden.out
rlFileSubmit unprocessed.out
rlRun "rm -f classes output.out unprocessed.out"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd