Bootstrap tests in general

This commit is contained in:
Miloš Prchlík 2023-08-07 13:20:55 +02:00
commit 257385b64f
17 changed files with 1053 additions and 0 deletions

1
.fmf/version Normal file
View file

@ -0,0 +1 @@
1

13
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,13 @@
default:
tags:
- shared
image: registry.fedoraproject.org/fedora-minimal:38
stages:
- test
pre-commit:
stage: test
script:
- microdnf install -y git pre-commit
- pre-commit run --show-diff-on-failure --color=always --all-files

34
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,34 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: forbid-submodules
- id: mixed-line-ending
- id: no-commit-to-branch
args: [
"--branch", "main"
]
- id: trailing-whitespace
- repo: https://github.com/adrienverge/yamllint
rev: v1.32.0
hooks:
- id: yamllint
files: "^.*?\\.fmf$"
- repo: https://github.com/teemtee/tmt.git
rev: "1.26.0"
hooks:
- id: tmt-lint

98
README.adoc Normal file
View file

@ -0,0 +1,98 @@
= binutils tests
:icons: font
[WARNING]
====
Content of this repository belongs to upstream. Once I am cleared for creation of binutils' test repository in Fedora git, all publicable plans and tests would be relocated there.
====
== State of support
[%header,cols="1,1,1,1"]
|===
|Distro
|Flavor
|Gating
|Regression
|RHEL-9.3.0
|system
^|verified
^|not started
|RHEL-9.3.0
|gcc-toolset-13
^|verified
^|not started
|RHEL-9.3.0
|gcc-toolset-12
^|verified
^|not started
|RHEL-9.2.0
|system
^|in progress
^|not started
|RHEL-9.2.0
|gcc-toolset-12
^|in progress
^|not started
|RHEL-8.9.0
|system
^|in progress
^|not started
|RHEL-8.9.0
|gcc-toolset-13
^|in progress
^|not started
|RHEL-8.9.0
|gcc-toolset-12
^|not started
^|not started
|RHEL-8.8.0
|system
^|in progress
^|not started
|RHEL-8.8.0
|gcc-toolset-12
^|not started
^|not started
|RHEL-7.9
|system
^|in progress
^|not started
|RHEL-7.9
|devtoolset-13
^|not started
^|not started
|Fedora Rawhide
|system
^|not started
^|not started
|Fedora 38
|system
^|not started
^|not started
|CentOS Stream 9
|system
^|not started
^|not started
|CentOS Stream 8
|system
^|not started
^|not started
|===

40
plans/build-gating.fmf Normal file
View file

@ -0,0 +1,40 @@
#
# Build/PR gating tests for binutils
#
summary: "Build/PR gating tests for binutils"
discover:
how: fmf
filter: "tag:gate-build"
# Adjust rules
adjust+:
- because: "Plan to be ran when executed locally, or executed by CI system to gate a build or PR."
when: >-
trigger is defined
and trigger != commit
and trigger != build
enabled: false
- because: "On CentOS Stream 9, CRB repository must be enabled for various BuildRequires"
when: distro == centos-stream-9
prepare+:
- how: shell
script: dnf config-manager --set-enabled crb
- because: "On RHEL-9, CRB and buildroot repositories must be enabled for various BuildRequires"
when: distro == rhel-9
prepare+:
- how: shell
script:
- dnf config-manager --set-enabled rhel-CRB
- dnf config-manager --set-enabled rhel-buildroot
- because: "On RHEL-8, CRB and buildroot repositories must be enabled for various BuildRequires"
when: distro == rhel-8
prepare+:
- how: shell
script:
- dnf config-manager --set-enabled rhel-CRB
- dnf config-manager --set-enabled rhel-buildroot

5
plans/main.fmf Normal file
View file

@ -0,0 +1,5 @@
execute:
how: tmt
# Adjust rules
adjust+: []

View file

@ -0,0 +1,34 @@
contact:
- Milos Prchlik <mprchlik@redhat.com>
- Martin Cermak <mcermak@redhat.com>
summary: Rebuild Emacs
description: |
From: Jeff Law
... stuff deleted ...
emacs is highly sensitive to the order and structure of executables
produced by the linker. This is an artifact of its undumping mechanism
(essentially starts emacs, loads a bunch of stuff, core dumps, then
turns the core dump into a new executable).
We've seen a lot of pain around this for ppc64le as well as after the
RELRO improvements we made to binutils/ld over the last 6 months.
ISTM that the testing plans for RHEL going forward ought to include a
test build of emacs with the new binutils installed. No further tests
are necessary since the build process for emacs exercises the
problematic bits.
tag:
- gate-build
duration: 3h
# Configurable fields
require+:
- emacs
- rpm-build
environment+:
REQUIRES: "emacs"

View file

@ -0,0 +1,55 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Description: rebuild-emacs
#
# Author: Milos Prchlik <mprchlik@redhat.com>
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# 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, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "$TMT_TREE/tests/lib.sh" || exit 1
rlJournalStart
rlPhaseStartSetup
buTestHeader
buEnterTmpDir
buPrepareSRPM "emacs"
rlRun "saved_randomize_va_space=$(cat /proc/sys/kernel/randomize_va_space)"
rlRun "echo '1' > /proc/sys/kernel/randomize_va_space"
rlPhaseEnd
rlPhaseStartTest
buBuildSRPM
rlPhaseEnd
rlPhaseStartCleanup
rlRun "echo \"$saved_randomize_va_space\" > /proc/sys/kernel/randomize_va_space"
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,64 @@
summary: Check whether newly built kernel boots correctly
description: |
Rebuild kernel, install it, reboot, and check if we're running the correct
kernel. Tailored specificaly for binutils buildroot testing process.
A strong machine is recommended:
- kernel rebuild is very resoruce-intensive task, and having more powerful
boxes for it is simply good,
- this task will get its own boxes, not clobbered by additional kernel packages
that are usually installed by other tasks in the same run. E.g.kernel-debuginfo,
when installed, will conflict with freshly build kernel packages. This should
workaround such situations,
- this tasks reboots its boxes - should such reboot break something, don't ruin
the whole run by it, right?
Based on gcc/Sanity/rebuild-kernel by:
Author: Michal Nowak <mnowak@redhat.com>
Author: Marek Polacek <polacek@redhat.com>
tag:
- gate-build
duration: 20h
# Configurable fields
require+:
- yum-utils
- rng-tools
- rpm-build
- newt-devel
- perl-ExtUtils-Embed
- unifdef
- elfutils-libelf-devel
- elfutils-devel
- pciutils-devel
- wget
- hmaccalc
- binutils-devel
- glibc-static
- texinfo
- gdb
- ecj
- graphviz
- gmp-devel
- mpfr-devel
- xmlto
- asciidoc
- net-tools
# Adjust rules
adjust+:
- because: "python-devel has different names in different distros"
when: distro == rhel-8.9.0
require+:
- python3-devel
- because: "python-devel has different names in different distros"
when: distro != rhel-8.9.0
require+:
- python-devel
- because: "pesign is available for some architectures only"
when: distro == rhel and arch != ppc64le and arch != s390x
require+:
- pesign

View file

@ -0,0 +1,176 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Description: Check whether newly built kernel boots correctly
#
# Author: Milos Prchlik <mprchlik@redhat.com>
#
# Rebuild kernel, install it, reboot, and check if we're running the correct
# kernel. Tailored specificaly for binutils buildroot testing process.
#
# Based on gcc/Sanity/rebuild-kernel by:
# Author: Michal Nowak <mnowak@redhat.com>
# Author: Marek Polacek <polacek@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009, 2012 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
. "$TMT_TREE/tests/lib.sh" || exit 1
export AVC_ERROR='+no_avc_check'
case "$JUST_BUILD" in
0|[Ff][Aa][Ll][Ss][Ee]|[Nn][Oo])
JUST_BUILD=no
;;
*)
JUST_BUILD=yes
;;
esac
# Kernel package - usualy "kernel", but some trees may use different package
# name (e.g. kernel-PAE).
KERNEL="${KERNEL:-kernel}"
RPM_BUILD_ID="${RPM_BUILD_ID:-.LimeKitten}"
# Workaround possible restraint issues - restraint may fail to set REBOOTCOUNT properly.
REBOOT_FLAG=/.rebuild-kernel-and-reboot.flag
REBOOTCOUNT="${REBOOTCOUNT:-0}"
unset ARCH
rlJournalStart
rlPhaseStartSetup
buTestHeader
rlLogInfo "KERNEL=$KERNEL"
rlLogInfo "JUST_BUILD=$JUST_BUILD"
rlLogInfo "REBOOTCOUNT=$REBOOTCOUNT"
rlLogInfo "RPM_BUILD_ID=$RPM_BUILD_ID"
# We'll use a lot of disk space (tens of GBs at least). The root FS
# often is the most beefy one in CI environemnts. Let's use it but also
# let's log what's actually available.
export TMPDIR=/test_tmp_root
rlRun "mkdir -p $TMPDIR"
rlLogInfo "TMPDIR=$TMPDIR"
rlLogInfo 'Disk space:'
df -h | while read line; do
rlLogInfo " $line"
done
rlRun "AFTER_REBOOT=no"
if [ "$REBOOTCOUNT" != "0" ]; then
rlLogInfo "Reboot count envvar is non-zero, update our flag"
rlRun "AFTER_REBOOT=yes"
elif [ -f "$REBOOT_FLAG" ]; then
rlLogInfo "FS reboot flag exists, update our flag"
rlRun "AFTER_REBOOT=yes"
fi
if [ "$AFTER_REBOOT" = "no" ]; then
# We optionally need to skip checking for the presence of the metapackage
# because that would pull in all the dependent toolset subrpms. We do not
# always want that, especially in CI.
buEnterTmpDir
# Speed up keygen.
rlRun "rngd -r /dev/hwrandom || rngd -r /dev/urandom"
buPrepareSRPM "$KERNEL" "--nobest"
fi
rlPhaseEnd
if [ "$AFTER_REBOOT" = "no" ]; then
rlPhaseStartTest "Build"
if [ "$RPM_BUILD_ID" != "" ]; then
rlRun "sed -i \"s/# % define buildid .local/%define buildid $RPM_BUILD_ID/\" $SPECFILE"
rlRun "sed -i \"s/# define buildid .local/%define buildid $RPM_BUILD_ID/\" $SPECFILE"
fi
if [ "`rlGetPrimaryArch`" == "ppc64" ]; then
TARGET="--target=ppc64"
else
TARGET="--target=$(uname -m)"
fi
if rlRun "CC=$GCC rpmbuild --define=\"_topdir $TmpDir\" -bb $TARGET --clean $SPECFILE &> BUILD_LOG"; then
rlRun "RPMBUILD_OK=yes"
else
rlLogInfo "rpmbuild kernel failed"
rlRun "RPMBUILD_OK=no"
fi
rlBundleLogs "Build-log" BUILD_LOG
rlPhaseEnd
# Install and boot the new kernel only if it's requested *and* the build was successful
if [ "$JUST_BUILD" = 'no' ] && [ "$RPMBUILD_OK" = "yes" ]; then
rlPhaseStartTest "Install"
RPMS="$(ls -1 $TmpDir/RPMS/*/*.rpm | grep -v kernel-selftests-internal | tr '\n' ' ')"
rlRun "yum localinstall -y --disablerepo=\* $RPMS"
rlLogInfo "$(rpm -qa | grep kernel | sort)"
# Update the boot configuration
if [ "$(arch)" = "s390x" ]; then
rlRun "grubby --info=ALL"
rlLogInfo "Default kernel is $(grubby --default-kernel), index $(grubby --default-index)"
rlRun "KERNEL_FILE=$(ls -1 /boot/vmlinuz-*${RPM_BUILD_ID}."$(arch)")"
rlRun "ls -al $KERNEL_FILE"
rlRun "grubby --set-default $KERNEL_FILE"
rlLogInfo "Default kernel is $(grubby --default-kernel), index $(grubby --default-index)"
rlRun "zipl"
else
rlRun "grub2-set-default 2"
fi
rlPhaseEnd
rlPhaseStartTest "Reboot"
rlRun "touch $REBOOT_FLAG"
rlLog "Rebooting ..."
rhts-reboot
rlPhaseEnd
fi
fi
# Verify the build ID only if its install and boot were requested
if [ "$JUST_BUILD" = 'no' ]; then
rlPhaseStartTest "Test"
if ! [ "$AFTER_REBOOT" = 'yes' ]; then
rlFail 'Not rebooted. Probably rhts-reboot did not work.'
fi
rlLogInfo "$(uname -a)"
rlRun "uname -r | grep $RPM_BUILD_ID"
rlPhaseEnd
fi
rlPhaseStartCleanup
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,13 @@
summary: Rebuild wget
description: ''
tag:
- gate-build
duration: 1h
# Configurable fields
require+:
- wget
- rpm-build
# Adjust rules
adjust+: []

View file

@ -0,0 +1,51 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Description: Rebuild wget
#
# Author: Milos Prchlik <mprchlik@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
. "$TMT_TREE/tests/lib.sh" || exit 1
rlJournalStart
rlPhaseStartSetup
buTestHeader
buEnterTmpDir
buPrepareSRPM "wget"
rlPhaseEnd
rlPhaseStartTest
buBuildSRPM
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,34 @@
summary: Run binutils upstream test suite
description: ''
tag:
- gate-build
duration: 3h
# Configurable fields
require+:
- texinfo
- glibc-static
- dejagnu
- bison
- flex
- zlib-static
- sharutils
- yum-utils
- libstdc++-static
- rpm-build
# Adjust rules
adjust+:
- because: "On RHEL-9, system binutils build extra binaries for cross compilation"
when: distro == rhel-9.3.0 and collection is not defined
test: "$WITH_SCL ./test-rhel-9.3.0.sh"
- because: "On RHEL-9, gcc-toolset-13 binutils build has extra directory levels"
when: distro == rhel-9.3.0 and collection == gcc-toolset-13
test: "$WITH_SCL ./test-rhel-9.3.0.sh"
environment+:
CROSS_BINUTILS: "no"
- because: "On CentOS Stream 9, system binutils build extra binaries for cross compilation"
when: distro == centos-stream-9 and collection is not defined
test: "$WITH_SCL ./test-rhel-9.3.0.sh"

View file

@ -0,0 +1,116 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Description: Run binutils upstream test suite
#
# Author: Milos Prchlik <mprchlik@redhat.com>
# 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
. "$TMT_TREE/tests/lib.sh" || exit 1
rlJournalStart
rlPhaseStartSetup
buTestHeader
ARCH="$(rlGetPrimaryArch)"
CROSS_BINUTILS="${CROSS_BINUTILS:-yes}"
if [ "$CROSS_BINUTILS" = "yes" ]; then
if [ "$ARCH" = "x86_64" ]; then
BUILD_ARCHS="aarch64 ppc64le s390x x86_64"
else
BUILD_ARCHS="$ARCH"
fi
else
BUILD_ARCHS="$ARCH"
fi
rlLogInfo "ARCH=$ARCH"
rlLogInfo "BUILD_ARCHS=$BUILD_ARCHS"
rlLogInfo "CROSS_BINUTILS=$CROSS_BINUTILS"
buEnterTmpDir
rlRun "LOGDIR=$TmpDir/LOGS"
rlRun "BUILDDIR=$(rpm --define='_topdir $TmpDir' --eval=%_builddir)"
rlRun "CURRENT_BUILD=${BUILDDIR}/binutils-$(rpmquery "$BINUTILS_PACKAGE" --queryformat=%{VERSION})"
rlRun "mkdir $LOGDIR"
buPrepareSRPM "$BINUTILS_PACKAGE"
rlPhaseEnd
rlPhaseStartSetup "Rebuild binutils"
buBuildSRPM
for build_arch in $BUILD_ARCHS; do
rlRun "cp $CURRENT_BUILD/build-${build_arch}-redhat-linux/binutils/binutils.log $LOGDIR/binutils-$build_arch.log"
rlRun "cp $CURRENT_BUILD/build-${build_arch}-redhat-linux/binutils/binutils.sum $LOGDIR/binutils-$build_arch.sum"
if [ "$build_arch" = "$ARCH" ]; then
rlRun "cp $CURRENT_BUILD/build-${build_arch}-redhat-linux/ld/ld.log $LOGDIR/ld-$build_arch.log"
rlRun "cp $CURRENT_BUILD/build-${build_arch}-redhat-linux/ld/ld.sum $LOGDIR/ld-$build_arch.sum"
fi
rlRun "cp $CURRENT_BUILD/build-${build_arch}-redhat-linux/gas/testsuite/gas.log $LOGDIR/gas-$build_arch.log"
rlRun "cp $CURRENT_BUILD/build-${build_arch}-redhat-linux/gas/testsuite/gas.sum $LOGDIR/gas-$build_arch.sum"
done
rlPhaseEnd
for TOOL in binutils ld gas; do
for build_arch in $BUILD_ARCHS; do
if [[ "$TOOL" == "ld" && "$build_arch" != "$ARCH" ]]; then
continue
fi
tool_label="$TOOL / $build_arch"
tool_log="$LOGDIR/$TOOL-$build_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
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.tar.gz
rlFileSubmit buildroot.tgz
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

89
tests/Sanity/testsuite/test.sh Executable file
View file

@ -0,0 +1,89 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Description: Run binutils upstream test suite
#
# Author: Milos Prchlik <mprchlik@redhat.com>
# 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
. "$TMT_TREE/tests/lib.sh" || exit 1
rlJournalStart
rlPhaseStartSetup
buTestHeader
buEnterTmpDir
rlRun "LOGDIR=$TmpDir/LOGS"
rlRun "BUILDDIR=$(rpm --define='_topdir $TmpDir' --eval=%_builddir)"
rlRun "CURRENT_BUILD=${BUILDDIR}/binutils-$(rpmquery "$BINUTILS_PACKAGE" --queryformat=%{VERSION})"
rlRun "mkdir $LOGDIR"
buPrepareSRPM "$BINUTILS_PACKAGE"
rlPhaseEnd
rlPhaseStartSetup "Rebuild binutils"
buBuildSRPM
rlRun "cp $CURRENT_BUILD/binutils/binutils.log $LOGDIR/binutils-$build_arch.log"
rlRun "cp $CURRENT_BUILD/binutils/binutils.sum $LOGDIR/binutils-$build_arch.sum"
rlRun "cp $CURRENT_BUILD/ld/ld.log $LOGDIR/ld-$build_arch.log"
rlRun "cp $CURRENT_BUILD/ld/ld.sum $LOGDIR/ld-$build_arch.sum"
rlRun "cp $CURRENT_BUILD/gas/testsuite/gas.log $LOGDIR/gas-$build_arch.log"
rlRun "cp $CURRENT_BUILD/gas/testsuite/gas.sum $LOGDIR/gas-$build_arch.sum"
rlPhaseEnd
for TOOL in binutils ld gas; do
tool_label="$TOOL / $build_arch"
tool_log="$LOGDIR/$TOOL-$build_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.tar.gz
rlFileSubmit buildroot.tgz
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

63
tests/lib.sh Normal file
View file

@ -0,0 +1,63 @@
#!/bin/bash
. /usr/share/beakerlib/beakerlib.sh || exit 1
function buTestHeader () {
_LD="$(which ld)"
_GCC="$(which gcc)"
_LD_PACKAGE="$(rpm --qf '%{name}\n' -qf "$_LD" | head -1)"
_GCC_PACKAGE="$(rpm --qf '%{name}\n' -qf "$_GCC" | head -1)"
export REQUIRES="${REQUIRES} ${_REQUIRES:-}"
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "REQUIRES=$REQUIRES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "LD=$_LD"
rlLogInfo "GCC=$_GCC"
rlAssertRpm --all
rlAssertEquals "active ld $_LD is owned by the given package" \
"$_LD_PACKAGE" \
"$BINUTILS_PACKAGE"
rlAssertEquals "active gcc $_GCC is owned by the given package" \
"$_GCC_PACKAGE" \
"$GCC_PACKAGE"
}
function buEnterTmpDir () {
rlRun "export TmpDir=$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
}
function buExitTmpDir () {
rlRun "popd"
if [ -z "$PRESERVE_TMPDIR" ]; then
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
fi
}
function buPrepareSRPM () {
local installed_rpm="$1"
local builddep_options="${2:-}"
rlFetchSrcForInstalled "$installed_rpm"
rlRun "export SRPM=`find . -name '*.src.rpm'`"
rlRun "rpm -ivh --define=\"_topdir $TmpDir\" $SRPM"
rlRun "export SPECDIR=`rpm --define=\"_topdir $TmpDir\" --eval=%_specdir`"
rlRun "export SPECFILE=`find $SPECDIR/ -name '*.spec'`"
rlRun "yum-builddep -y $builddep_options $SPECFILE"
}
function buBuildSRPM () {
rlRun "rpmbuild -bb --define='_topdir $TmpDir' $SPECFILE"
}

167
tests/main.fmf Normal file
View file

@ -0,0 +1,167 @@
contact:
- Milos Prchlik <mprchlik@redhat.com>
framework: beakerlib
test: "$WITH_SCL ./test.sh"
component: binutils
require+:
- type: file
pattern:
- lib.sh
# Adjust rules
adjust+:
# RHEL-9 / no collection
- when: distro == rhel-9 and collection is not defined
require+:
- binutils
- gcc
- gcc-c++
- annobin
environment+:
PACKAGES: binutils
_REQUIRES: gcc gcc-c++ glibc annobin
BINUTILS_PACKAGE: binutils
GCC_PACKAGE: gcc
# RHEL-9 / gcc-toolset-13
- when: distro == rhel-9 and collection == gcc-toolset-13
require+:
- gcc-toolset-13-binutils
- gcc-toolset-13-gcc
- gcc-toolset-13-gcc-c++
- gcc-toolset-13-gcc-plugin-annobin
environment+:
PACKAGES: gcc-toolset-13-binutils
_REQUIRES: gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ gcc-toolset-13-gcc-plugin-annobin glibc
# COLLECTIONS: gcc-toolset-13
WITH_SCL: scl enable gcc-toolset-13
BINUTILS_PACKAGE: gcc-toolset-13-binutils
GCC_PACKAGE: gcc-toolset-13-gcc
# RHEL-9 / gcc-toolset-12
- when: distro == rhel-9 and collection == gcc-toolset-12
require+:
- gcc-toolset-12-binutils
- gcc-toolset-12-gcc
- gcc-toolset-12-gcc-c++
- gcc-toolset-12-gcc-plugin-annobin
environment+:
PACKAGES: gcc-toolset-12-binutils
_REQUIRES: gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-gcc-plugin-annobin glibc
# COLLECTIONS: gcc-toolset-12
WITH_SCL: scl enable gcc-toolset-12
BINUTILS_PACKAGE: gcc-toolset-12-binutils
GCC_PACKAGE: gcc-toolset-12-gcc
# RHEL-9 / gcc-toolset-11
# RHEL-8 / no collection
- when: distro == rhel-8 and collection is not defined
require+:
- binutils
- gcc
- gcc-c++
- annobin
environment+:
PACKAGES: binutils
_REQUIRES: gcc gcc-c++ glibc annobin
BINUTILS_PACKAGE: binutils
GCC_PACKAGE: gcc
# RHEL-8 / gcc-toolset-13
- when: distro == rhel-8 and collection == gcc-toolset-13
require+:
- gcc-toolset-13-binutils
- gcc-toolset-13-gcc
- gcc-toolset-13-gcc-c++
- gcc-toolset-13-gcc-plugin-annobin
environment+:
PACKAGES: gcc-toolset-13-binutils
_REQUIRES: gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ gcc-toolset-13-gcc-plugin-annobin glibc
# COLLECTIONS: gcc-toolset-13
WITH_SCL: scl enable gcc-toolset-13
BINUTILS_PACKAGE: gcc-toolset-13-binutils
GCC_PACKAGE: gcc-toolset-13-gcc
# RHEL-8 / gcc-toolset-12
# RHEL-8 / gcc-toolset-11
- when: distro == rhel-7 and collection == devtoolset-13
require+:
- devtoolset-13-binutils
- devtoolset-13-gcc
- devtoolset-13-gcc-c++
environment+:
PACKAGES: devtoolset-13-binutils
_REQUIRES: devtoolset-13-gcc devtoolset-13-gcc-c++ glibc
# COLLECTIONS: devtoolset-13
WITH_SCL: scl enable devtoolset-13
BINUTILS_PACKAGE: devtoolset-13-binutils
GCC_PACKAGE: devtoolset-13-gcc
# RHEL-7 / no collection
# RHEL-7 / devtoolset-13
# RHEL-7 / devtoolset-12
# RHEL-7 / devtoolset-11
# CentOS Stream 9 / no collection
- when: distro == centos-stream-9 and collection is not defined
require+:
- binutils
- gcc
- gcc-c++
- annobin
environment+:
PACKAGES: binutils
_REQUIRES: gcc gcc-c++ glibc annobin
BINUTILS_PACKAGE: binutils
GCC_PACKAGE: gcc
# CentOS Stream 9 / gcc-toolset-13
# CentOS Stream 9 / gcc-toolset-12
# CentOS Stream 9 / gcc-toolset-11
# CentOS Stream 8 / no collection
- when: distro == centos-stream-8 and collection is not defined
require+:
- binutils
- gcc
- gcc-c++
- annobin
environment+:
PACKAGES: binutils
_REQUIRES: gcc gcc-c++ glibc annobin
BINUTILS_PACKAGE: binutils
GCC_PACKAGE: gcc
# CentOS Stream 8 / gcc-toolset-13
# CentOS Stream 8 / gcc-toolset-12
# CentOS Stream 8 / gcc-toolset-11
# Fedora-39 / no collection
- when: distro == fedora-39 and collection is not defined
require+:
- binutils
- gcc
- gcc-c++
- annobin-plugin-gcc
environment+:
PACKAGES: binutils
_REQUIRES: gcc gcc-c++ glibc annobin-plugin-gcc
BINUTILS_PACKAGE: binutils
GCC_PACKAGE: gcc
# Fedora-38 / no collection
- when: distro == fedora-38 and collection is not defined
require+:
- binutils
- gcc
- gcc-c++
- annobin-plugin-gcc
environment+:
PACKAGES: binutils
_REQUIRES: gcc gcc-c++ glibc annobin-plugin-gcc
BINUTILS_PACKAGE: binutils
GCC_PACKAGE: gcc