Import RHEL's regression test for #1366145

This commit is contained in:
Václav Kadlčík 2021-04-16 13:02:35 +02:00
parent 484107a803
commit c468b0dfdd
4 changed files with 174 additions and 0 deletions

View File

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/binutils/Regression/bz1366145-dwz-applied-to-a-dts-compiled-binary-complains
# Description: Test for BZ#1366145 (dwz applied to a dts-compiled binary complains)
# Author: Sergey Kolosov <skolosov@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2016 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/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/binutils/Regression/bz1366145-dwz-applied-to-a-dts-compiled-binary-complains
export TESTVERSION=1.1
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Sergey Kolosov <skolosov@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for BZ#1366145 (dwz applied to a dts-compiled binary complains)" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 2h" >> $(METADATA)
@echo "RunFor: binutils" >> $(METADATA)
@echo "Requires: binutils dwz gcc" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 1366145" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,18 @@
PURPOSE of /tools/binutils/Regression/bz1366145-dwz-applied-to-a-dts-compiled-binary-complains
Description: Test for BZ#1366145 (dwz applied to a dts-compiled binary complains)
Author: Sergey Kolosov <skolosov@redhat.com>
Bug summary: dwz applied to a dts-compiled binary complains about section offsets not monotonically increasing
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1366145
Needs a bit more complicated relevancy settings. DWZ is not available in RHEL-6 - unless
you have DTS installed, then you can use (and test) dwz from devtoolset-N-dwz package.
# First two lines result in "True" when (RHEL6 && DTS).
distro = rhel-6 && collection = devtoolset-6: REQUIRES="devtoolset-6-gcc devtoolset-6-dwz"
distro = rhel-6 && collection = devtoolset-4: REQUIRES="devtoolset-4-gcc devtoolset-4-dwz"
# No DTS? No dwz then.
distro = rhel-6: False
# Only RHEL7 remains, and default REQUIRES is good enough for logging. Drop every other distro.
distro != rhel-7: False

View File

@ -0,0 +1,29 @@
summary: Test for BZ#1366145 (dwz applied to a dts-compiled binary complains)
description: |
Bug summary: dwz applied to a dts-compiled binary complains about section offsets not monotonically increasing
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1366145
Needs a bit more complicated relevancy settings. DWZ is not available in RHEL-6 - unless
you have DTS installed, then you can use (and test) dwz from devtoolset-N-dwz package.
# First two lines result in "True" when (RHEL6 && DTS).
distro = rhel-6 && collection = devtoolset-6: REQUIRES="devtoolset-6-gcc devtoolset-6-dwz"
distro = rhel-6 && collection = devtoolset-4: REQUIRES="devtoolset-4-gcc devtoolset-4-dwz"
# No DTS? No dwz then.
distro = rhel-6: False
# Only RHEL7 remains, and default REQUIRES is good enough for logging. Drop every other distro.
distro != rhel-7: False
contact: Sergey Kolosov <skolosov@redhat.com>
component:
- binutils
test: ./runtest.sh
framework: beakerlib
recommend:
- binutils
- dwz
- gcc
duration: 2h
extra-summary: /tools/binutils/Regression/bz1366145-dwz-applied-to-a-dts-compiled-binary-complains
extra-task: /tools/binutils/Regression/bz1366145-dwz-applied-to-a-dts-compiled-binary-complains

View File

@ -0,0 +1,64 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/binutils/Regression/bz1366145-dwz-applied-to-a-dts-compiled-binary-complains
# Description: Test for BZ#1366145 (dwz applied to a dts-compiled binary complains)
# Author: Sergey Kolosov <skolosov@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2016 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/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
LD="${LD:-$(which ld)}"
PACKAGE=$(rpm --qf '%{name}\n' -qf $(which $LD) | head -1)
PACKAGES=${PACKAGE}
REQUIRES="${REQUIRES:-gcc dwz}"
rlJournalStart
rlPhaseStartSetup
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "REQUIRES=$REQUIRES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "LD=$LD"
rlLogInfo "$(type gcc)"
rlAssertRpm --all
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
rlRun "echo 'int main(void){return 0;}' > test.c" 0 "Generating simple source"
rlRun "gcc test.c -g -o test"
rlRun "md5sum ./test > t_before_dwz"
rlRun "./test" 0 "Test binary is running"
rlRun "dwz ./test" 0 "DWZ returns correct result"
rlRun "md5sum ./test > t_after_dwz"
rlAssertDiffer t_before_dwz t_after_dwz
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd