|
|
582a0c8 |
#!/bin/bash
|
|
|
582a0c8 |
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
|
|
582a0c8 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
582a0c8 |
#
|
|
|
582a0c8 |
# runtest.sh of /tools/dwz/dwz-quick-test
|
|
|
582a0c8 |
# Description: Quick sanity test
|
|
|
582a0c8 |
# Author: Miroslav Franc <mfranc@redhat.com>
|
|
|
582a0c8 |
#
|
|
|
582a0c8 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
582a0c8 |
#
|
|
|
582a0c8 |
# Copyright (c) 2013 Red Hat, Inc. All rights reserved.
|
|
|
582a0c8 |
#
|
|
|
582a0c8 |
# This copyrighted material is made available to anyone wishing
|
|
|
582a0c8 |
# to use, modify, copy, or redistribute it subject to the terms
|
|
|
582a0c8 |
# and conditions of the GNU General Public License version 2.
|
|
|
582a0c8 |
#
|
|
|
582a0c8 |
# This program is distributed in the hope that it will be
|
|
|
582a0c8 |
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
|
582a0c8 |
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
582a0c8 |
# PURPOSE. See the GNU General Public License for more details.
|
|
|
582a0c8 |
#
|
|
|
582a0c8 |
# You should have received a copy of the GNU General Public
|
|
|
582a0c8 |
# License along with this program; if not, write to the Free
|
|
|
582a0c8 |
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
582a0c8 |
# Boston, MA 02110-1301, USA.
|
|
|
582a0c8 |
#
|
|
|
582a0c8 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
582a0c8 |
|
|
|
582a0c8 |
# Include Beaker environment
|
|
|
582a0c8 |
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
|
|
582a0c8 |
|
|
|
582a0c8 |
rlJournalStart
|
|
|
582a0c8 |
rlPhaseStartSetup
|
|
|
582a0c8 |
rlAssertRpm gcc
|
|
|
582a0c8 |
rlAssertRpm gdb
|
|
|
582a0c8 |
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
|
|
582a0c8 |
rlRun "cp something.c cmd.txt $TmpDir"
|
|
|
582a0c8 |
rlRun "pushd $TmpDir"
|
|
|
582a0c8 |
rlRun "gcc -g -O2 something.c -o something.out"
|
|
|
582a0c8 |
rlRun "cp something.out something.dwz"
|
|
|
582a0c8 |
rlPhaseEnd
|
|
|
582a0c8 |
|
|
|
582a0c8 |
rlPhaseStartTest "no crash + saved space"
|
|
|
582a0c8 |
rlRun "dwz something.dwz"
|
|
|
582a0c8 |
rlRun "[[ $(wc -c
|
|
|
582a0c8 |
rlPhaseEnd
|
|
|
582a0c8 |
|
|
|
582a0c8 |
rlPhaseStartTest "can we debug it?"
|
|
|
582a0c8 |
rlRun "gdb -x cmd.txt -batch -q ./something.dwz > log 2>&1"
|
|
|
582a0c8 |
rlRun "[[ $(grep -c 'hello, world' log) -eq 2 ]]"
|
|
|
582a0c8 |
rlAssertGrep '$1 = -1' log
|
|
|
582a0c8 |
rlAssertGrep '$2 = 0x2a' log
|
|
|
582a0c8 |
rlPhaseEnd
|
|
|
582a0c8 |
|
|
|
582a0c8 |
rlPhaseStartCleanup
|
|
|
582a0c8 |
rlRun "popd"
|
|
|
582a0c8 |
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
|
|
582a0c8 |
rlPhaseEnd
|
|
|
582a0c8 |
rlJournalPrintText
|
|
|
582a0c8 |
rlJournalEnd
|