From ba92017b680791e03e10a428b9b94de193072d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kadl=C4=8D=C3=ADk?= Date: Tue, 4 May 2021 12:54:49 +0200 Subject: [PATCH] Import RHEL's regression test for #509124 --- .../509124-holes-in-debuginfo/Makefile | 59 +++++++++++++++ .../509124-holes-in-debuginfo/PURPOSE | 14 ++++ .../509124-holes-in-debuginfo/ascend.C | 15 ++++ .../509124-holes-in-debuginfo/main.fmf | 25 +++++++ .../509124-holes-in-debuginfo/runtest.sh | 73 +++++++++++++++++++ .../509124-holes-in-debuginfo/test.c | 14 ++++ 6 files changed, 200 insertions(+) create mode 100644 tests/Regression/509124-holes-in-debuginfo/Makefile create mode 100644 tests/Regression/509124-holes-in-debuginfo/PURPOSE create mode 100755 tests/Regression/509124-holes-in-debuginfo/ascend.C create mode 100644 tests/Regression/509124-holes-in-debuginfo/main.fmf create mode 100755 tests/Regression/509124-holes-in-debuginfo/runtest.sh create mode 100644 tests/Regression/509124-holes-in-debuginfo/test.c diff --git a/tests/Regression/509124-holes-in-debuginfo/Makefile b/tests/Regression/509124-holes-in-debuginfo/Makefile new file mode 100644 index 0000000..29b1a87 --- /dev/null +++ b/tests/Regression/509124-holes-in-debuginfo/Makefile @@ -0,0 +1,59 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2009 Red Hat, Inc. All rights reserved. +# +# 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. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/binutils/Regressions/readelf/509124-holes-in-debuginfo +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE ascend.C test.c + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + chmod a+x ./runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Michal Nowak " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: holes in debuginfo" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 15m" >> $(METADATA) + @echo "RunFor: binutils" >> $(METADATA) + @echo "Requires: binutils gcc44 gcc gcc44-c++ gcc-c++" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 509124 499164" >> $(METADATA) + @echo "Releases: -RHEL4 -RHEL5" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Regression/509124-holes-in-debuginfo/PURPOSE b/tests/Regression/509124-holes-in-debuginfo/PURPOSE new file mode 100644 index 0000000..d4bba30 --- /dev/null +++ b/tests/Regression/509124-holes-in-debuginfo/PURPOSE @@ -0,0 +1,14 @@ +(1) readelf fix now posted upstream: + http://sourceware.org/ml/binutils/2009-07/msg00123.html +QA: New testcase: binutils-all/testranges.s + +(2) gcc has been fixed based on this bugreport by Jakub upstream: + http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40713 + gcc44 backport request for RHEL-5.5 is: Bug 510958 + +(3) Going to be backported for RHEL-5.5 readelf. + It has been already fixed by Nick Clifton upstream: + http://sourceware.org/ml/binutils/2009-06/msg00418.html + http://sourceware.org/ml/binutils-cvs/2009-06/msg00158.html +QA: RHEL-only new testcase: binutils-all/testloc.S + as a part of binutils-all/readelf.exp (not shown when PASSing) diff --git a/tests/Regression/509124-holes-in-debuginfo/ascend.C b/tests/Regression/509124-holes-in-debuginfo/ascend.C new file mode 100755 index 0000000..917937f --- /dev/null +++ b/tests/Regression/509124-holes-in-debuginfo/ascend.C @@ -0,0 +1,15 @@ +class A { +public: + A(); + void f(){} +}; + +class C { + C(); +}; + +C::C() { + A* p = new A; + p->f(); +} + diff --git a/tests/Regression/509124-holes-in-debuginfo/main.fmf b/tests/Regression/509124-holes-in-debuginfo/main.fmf new file mode 100644 index 0000000..07430bd --- /dev/null +++ b/tests/Regression/509124-holes-in-debuginfo/main.fmf @@ -0,0 +1,25 @@ +summary: holes in debuginfo +description: "(1) readelf fix now posted upstream:\n http://sourceware.org/ml/binutils/2009-07/msg00123.html\n\ + QA: New testcase: binutils-all/testranges.s\n\n(2) gcc has been fixed based on\ + \ this bugreport by Jakub upstream:\n http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40713\n\ + \ gcc44 backport request for RHEL-5.5 is: Bug 510958\n\n(3) Going to be backported\ + \ for RHEL-5.5 readelf.\n It has been already fixed by Nick Clifton upstream:\n\ + \ http://sourceware.org/ml/binutils/2009-06/msg00418.html\n http://sourceware.org/ml/binutils-cvs/2009-06/msg00158.html\n\ + QA: RHEL-only new testcase: binutils-all/testloc.S\n as a part of binutils-all/readelf.exp\ + \ (not shown when PASSing) \n" +contact: Michal Nowak +component: +- binutils +test: ./runtest.sh +framework: beakerlib +recommend: +- binutils +- gcc44 +- gcc +- gcc44-c++ +- gcc-c++ +duration: 15m +link: +- relates: https://bugzilla.redhat.com/show_bug.cgi?id=509124 +extra-summary: /tools/binutils/Regressions/readelf/509124-holes-in-debuginfo +extra-task: /tools/binutils/Regressions/readelf/509124-holes-in-debuginfo diff --git a/tests/Regression/509124-holes-in-debuginfo/runtest.sh b/tests/Regression/509124-holes-in-debuginfo/runtest.sh new file mode 100755 index 0000000..2e8ad28 --- /dev/null +++ b/tests/Regression/509124-holes-in-debuginfo/runtest.sh @@ -0,0 +1,73 @@ +#!/bin/bash +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2009 Red Hat, Inc. All rights reserved. +# +# 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. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Author: Michal Nowak +# +# Include rhts environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="binutils" + +rlJournalStart + rlPhaseStartSetup Setup + rlAssertRpm $PACKAGE + rlShowPackageVersion $PACKAGE + rlShowRunningKernel + + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + cp ascend.C test.c $TmpDir + rlRun "pushd $TmpDir" + rlPhaseEnd + + for gcc in $( ls /usr/bin/gcc{,44} 2> /dev/null ); do + for opt in s $( seq 0 3 ); do + rlPhaseStartTest "ascend.C: gcc=$gcc opt=$opt" + rlRun "$gcc -O${opt} ascend.C -c -g" + rlAssertExists "ascend.o" + # kinda weird running readelf on .o file, but... + rlRun "readelf -a -w -W ./ascend.o > /dev/less 2> readelf.errout.g++" 0 "[gcc] Generating readelf output" + rlLog "$( cat readelf.errout.g++ )" + rlAssertNotGrep "readelf" readelf.errout.g++ + rm -f ./ascend.o + rlPhaseEnd + done + done + + for gcc in $( ls /usr/bin/gcc{,44} 2> /dev/null ); do + for opt in s $( seq 0 3 ); do + rlPhaseStartTest "test.c: gcc=$gcc opt=$opt" + rlRun "$gcc -O${opt} test.c -c -g" + rlAssertExists "test.o" + # kinda weird running readelf on .o file, but... + rlRun "readelf -a -w -W ./test.o > /dev/less 2> readelf.errout.g++" 0 "[gcc] Generating readelf output" + rlLog "$( cat readelf.errout.g++ )" + rlAssertNotGrep "readelf" readelf.errout.g++ + rm -f ./test.o + rlPhaseEnd + done + done + + rlPhaseStartCleanup Cleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd + rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/509124-holes-in-debuginfo/test.c b/tests/Regression/509124-holes-in-debuginfo/test.c new file mode 100644 index 0000000..57b8e7e --- /dev/null +++ b/tests/Regression/509124-holes-in-debuginfo/test.c @@ -0,0 +1,14 @@ +void f(int i) { + k(i); +} + +void g(int i) { + int j[65537]; + l(i,j); +} + +struct s { + void (*m)(int i); + void (*n)(int i); +} t={f,g}; +