gcc-toolset-13-binutils/tests/Sanity/testsuite/runtest.sh
Miloš Prchlík c9bd2d012b tests: bootstrap test coverage
There's a "standard" plan for the gating, plus a small fix of
gating.yaml, and a beginning of non-gating coverage for migrated tests.
2023-07-03 10:28:37 +02:00

115 lines
4.2 KiB
Bash
Executable File

#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/binutils/Sanity/testsuite
#
# Description: The test rebuilds binutils.src.rpm and runs the suite.
# The test is based on /tools/binutils/testsuite, but it had to be
# rewritten.
#
# Author: Michael Petlan <mpetlan@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 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="${PACKAGE:-gcc-toolset-13-binutils}"
PACKAGES="${PACKAGES:-$PACKAGE}"
REQUIRES="${REQUIRES:-gcc glibc}"
rlJournalStart
rlPhaseStartSetup
ARCH="$(rlGetPrimaryArch)"
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "REQUIRES=$REQUIRES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "LD=$LD"
rlLogInfo "GCC=$GCC"
rlLogInfo "ARCH=$ARCH"
rlAssertRpm --all
rlRun "TESTDIR=$PWD"
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "LOGDIR=$TmpDir/LOGS"
rlRun "BUILDDIR=$(rpm --define='_topdir $TmpDir' --eval=%_builddir)"
rlRun "CURRENT_BUILD=${BUILDDIR}/binutils-$(rpmquery "$PACKAGE" --queryformat=%{VERSION})"
rlRun "mkdir $LOGDIR"
rlRun "pushd $TmpDir"
# fetch'n'build the source
rlFetchSrcForInstalled "$PACKAGE"
rlRun "yum-builddep -y *.src.rpm"
rlRun "SRPM=$(find . -name 'gcc-toolset-13-binutils-*.src.rpm')"
rlRun "rpm -ivh --define='_topdir $TmpDir' $SRPM"
rlRun "SPECFILE=$(find "$TmpDir/" -name '*.spec')"
rlRun "dnf builddep -y $SPECFILE"
rlPhaseEnd
rlPhaseStartSetup "Rebuild binutils"
rlRun "rpmbuild -bc --define='_topdir $TmpDir' $SPECFILE"
rlRun "cp $CURRENT_BUILD/build-${ARCH}-redhat-linux/binutils/binutils.log $LOGDIR/binutils-$ARCH.log"
rlRun "cp $CURRENT_BUILD/build-${ARCH}-redhat-linux/binutils/binutils.sum $LOGDIR/binutils-$ARCH.sum"
rlRun "cp $CURRENT_BUILD/build-${ARCH}-redhat-linux/ld/ld.log $LOGDIR/ld-$ARCH.log"
rlRun "cp $CURRENT_BUILD/build-${ARCH}-redhat-linux/ld/ld.sum $LOGDIR/ld-$ARCH.sum"
rlRun "cp $CURRENT_BUILD/build-${ARCH}-redhat-linux/gas/testsuite/gas.log $LOGDIR/gas-$ARCH.log"
rlRun "cp $CURRENT_BUILD/build-${ARCH}-redhat-linux/gas/testsuite/gas.sum $LOGDIR/gas-$ARCH.sum"
rlPhaseEnd
for TOOL in binutils ld gas; do
tool_label="$TOOL / $ARCH"
tool_log="$LOGDIR/$TOOL-$ARCH"
rlPhaseStartTest "$tool_label"
rlLogInfo "$tool_label Summary"
rlLogInfo "$(grep -A 50 '=== .* Summary ===' "$tool_log.sum")"
rlRun "awk \"/=== $TOOL tests ===/,/=== $TOOL Summary ===/\" $tool_log.sum > $tool_log.tests" 0,1 "Save results of all tests"
rlRun "grep -E '^FAIL: ' $tool_log.tests | sort > $tool_log.failed" 0,1 "Save failures"
rlRun "grep '# of unexpected failures' $tool_log.sum" 0,1 "Checking number of unexpected failures"
rlLogInfo "$(sort < "$tool_log.failed")"
rlLogInfo "$(grep -E '^[A-Z]+:' "$tool_log.tests" | sort)"
rlPhaseEnd
done
rlPhaseStartCleanup
rlRun "tar czf $TmpDir/logs.tgz $LOGDIR/*.sum $LOGDIR/*.log $LOGDIR/*.tests $LOGDIR/*.failed"
rlRun "tar czf $TmpDir/buildroot.tgz $CURRENT_BUILD/"
rlFileSubmit logs.tgz
rlFileSubmit buildroot.tgz
rlRun "popd" # $TmpDir
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd