binutils/tests/Regression/bz959422-TLS-variable-wrongly-relocated-on-debug-info/runtest.sh

58 lines
2.0 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 /CoreOS/binutils/Regression/bz959422-TLS-variable-wrongly-relocated-on-debug-info
# Description: Test for BZ#959422 (TLS variable wrongly relocated on .debug_info)
# Author: Milos Prchlik <mprchlik@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
PACKAGE="binutils"
GCC=${GCC:-"gcc"}
GDB=${GDB:-"gdb"}
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "cp ld-fail.c $TmpDir/"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
rlRun "$GCC -lpthread -g3 -O0 ld-fail.c -o ld-fail"
rlRun "$GDB ./ld-fail -q -ex start -ex 'print tls_var' -ex cont -ex quit &> gdb.log"
rlLogInfo "$(cat gdb.log)"
rlRun "grep -P '\\\$1 = 0x[0-9a-f]{1,16} \"hello\"' gdb.log"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd