glibc/tests/Regression/bz464146-sp-corruption/runtest.sh
Sergey Kolosov ab4bc8a24e Extend the test coverage
Move some of the RHEL QE testcases upstream to Fedora.
2022-05-31 09:29:27 +02:00

68 lines
2.0 KiB
Bash
Executable File

# runtest.sh - bz464146-sp-corruption - Bugzilla(s) 464146
# Author: Petr Muller <pmuller@redhat.com>
# Location: /tools/glibc/Regression/bz464146-sp-corruption/runtest.sh
# Description: Test for bz464144, a stack pointer corruption problem
# Copyright (c) 2008 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 v.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.
PACKAGE=glibc
# Include rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
rlStartJournal
######################
# Prepare environment
######################
rlPhaseStartSetup Preparation
rlAssertRpm ${PACKAGE}
ARCH=`uname -m`
if [ "$ARCH" == "ia64" -o "$ARCH" == "aarch64" -o "$ARCH" == "ppc64le" ]
then
FLAGS=""
else
FLAGS="-m64"
fi
rlRun "gcc $FLAGS testit.c -o testit -lpthread" 0 "Compiling the testcase"
rlPhaseEnd
######################
# Begin Test-Case
######################
rlPhaseStartTest Test
output=`mktemp`
./testit > $output
RC=$?
rlAssert0 "Testing for success of the testcases" $RC
rlAssertNotEquals "Testing for segfault (bug 464146)" $RC 139
rlAssertEquals "Testing for correct output - output should contain 1 line" `cat $output | wc -l` 1
cat $output > /tmp/mineminemine
rlAssertGrep "received \"Hello World\!\"" /tmp/mineminemine
rlPhaseEnd
######################
# Clean after the test
######################
rlPhaseStartCleanup Clean-Up
rlRun "rm -f $output testit"
rlCreateLogFromJournal > ${OUTPUTFILE}
rlCompareJournalWithRCW
rlPhaseEnd