Port tests

This commit is contained in:
Miloš Prchlík 2023-11-10 09:15:59 +01:00
commit 49a8b1ca16
57 changed files with 1445 additions and 9 deletions

View file

@ -0,0 +1,9 @@
summary: Regression test for bz241252
duration: 3m
contact+:
- Michal Nowak <mnowak@redhat.com>
link+:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=241252

View file

@ -0,0 +1,58 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "$TMT_TREE/tests/lib.sh" || exit 1
rlJournalStart
rlPhaseStartSetup
buTestHeader
buEnterTmpDir
buCopyReproducers "x.i y.i"
rlPhaseEnd
rlPhaseStartTest
rlRun "gcc -c -O2 -fpic -o x.o x.i -g" 0 "Compile test case 'x'"
rlRun "gcc -c -O2 -fpic -o y.o y.i -g" 0 "Compile test case 'y'"
rlRun "gcc -Wl,--unique -o x [xy].o" 0 "Link 'x' and 'y'"
# Note: debug_ranges replaced by debug_rnglist (since DWARF 5 in Fedora 34)
rlLogInfo 'x.o + y.o:'
rlLogInfo "$( readelf -WS [xy].o | grep debug_rnglist | grep PROGBITS )"
rlLogInfo 'x:'
rlLogInfo "$( readelf -WS x | grep debug_rnglist )"
if [ $( readelf -WS [xy].o | grep debug_rnglist | grep PROGBITS | wc -l ) -eq 2 ] \
&& [ $( readelf -WS x | grep debug_rnglist | wc -l ) -eq 1 ]; then
rlPass "Debug ranges sections were merged"
else
rlFail "Debug ranges sections were not merged"
fi
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,62 @@
extern void __assert_fail (const char *, const char *, unsigned int, const char *)
__attribute__ ((__nothrow__, __noreturn__));
struct gst;
struct gs;
extern void bar (void *) __attribute__ ((__nothrow__));
typedef int (*gf) (struct gst *, struct gs *,
const unsigned char **, const unsigned char *,
unsigned char **, unsigned long *, int, int);
struct gst
{
gf fct;
int min_needed_from;
};
struct gs
{
unsigned char *outbuf;
unsigned char *outbufend;
int flags;
int invocation_counter;
int internal_use;
};
typedef struct gi
{
unsigned long nsteps;
struct gst *steps;
struct gs data [10];
} *gt;
int
foo (gt cd, const unsigned char **inbuf,
const unsigned char *inbufend, unsigned char **outbuf,
unsigned char *outbufend, unsigned long *irreversible)
{
unsigned long last_step;
int result;
last_step = cd->nsteps - 1;
*irreversible = 0;
cd->data[last_step].outbuf = outbuf != ((void *)0) ? *outbuf : ((void *)0);
cd->data[last_step].outbufend = outbufend;
gf fct = cd->steps->fct;
if (inbuf == ((void *)0) || *inbuf == ((void *)0))
result = (bar ((void *) (fct)), (*(fct)) (cd->steps, cd->data, ((void *)0), ((void *)0), ((void *)0), irreversible, cd->data[last_step].outbuf == ((void *)0) ? 2 : 1, 0));
else
{
const unsigned char *last_start;
((outbuf != ((void *)0) && *outbuf != ((void *)0)) ? (void) (0) : __assert_fail ("outbuf != ((void *)0) && *outbuf != ((void *)0)", "gconv.c", 67, "foo"));
do
{
last_start = *inbuf;
result = (bar ((void *) (fct)), (*(fct)) (cd->steps, cd->data, inbuf, inbufend, ((void *)0), irreversible, 0, 0));
}
while (result == 4 && last_start != *inbuf
&& *inbuf + cd->steps->min_needed_from <= inbufend);
}
return result;
}

View file

@ -0,0 +1,71 @@
extern void __assert_fail (const char *, const char *, unsigned int, const char *)
__attribute__ ((__nothrow__, __noreturn__));
struct gst;
struct gs;
extern void bar (void *) __attribute__ ((__nothrow__));
void bar (void *x)
{
}
typedef int (*gf) (struct gst *, struct gs *,
const unsigned char **, const unsigned char *,
unsigned char **, unsigned long *, int, int);
struct gst
{
gf fct;
int min_needed_from;
};
struct gs
{
unsigned char *outbuf;
unsigned char *outbufend;
int flags;
int invocation_counter;
int internal_use;
};
typedef struct gi
{
unsigned long nsteps;
struct gst *steps;
struct gs data [10];
} *gt;
int
baz (gt cd, const unsigned char **inbuf,
const unsigned char *inbufend, unsigned char **outbuf,
unsigned char *outbufend, unsigned long *irreversible)
{
unsigned long last_step;
int result;
last_step = cd->nsteps - 1;
*irreversible = 0;
cd->data[last_step].outbuf = outbuf != ((void *)0) ? *outbuf : ((void *)0);
cd->data[last_step].outbufend = outbufend;
gf fct = cd->steps->fct;
if (inbuf == ((void *)0) || *inbuf == ((void *)0))
result = (bar ((void *) (fct)), (*(fct)) (cd->steps, cd->data, ((void *)0), ((void *)0), ((void *)0), irreversible, cd->data[last_step].outbuf == ((void *)0) ? 2 : 1, 0));
else
{
const unsigned char *last_start;
((outbuf != ((void *)0) && *outbuf != ((void *)0)) ? (void) (0) : __assert_fail ("outbuf != ((void *)0) && *outbuf != ((void *)0)", "gconv.c", 67, "foo"));
do
{
last_start = *inbuf;
result = (bar ((void *) (fct)), (*(fct)) (cd->steps, cd->data, inbuf, inbufend, ((void *)0), irreversible, 0, 0));
}
while (result == 4 && last_start != *inbuf
&& *inbuf + cd->steps->min_needed_from <= inbufend);
}
return result;
}
int
main (void)
{
}

View file

@ -13,4 +13,5 @@ void bar(void);
int main() {
foo();
bar();
return 0;
}

View file

@ -0,0 +1 @@
int main () { return 42; }

View file

@ -0,0 +1,9 @@
summary: ELFOSABI_LINUX is incorrectly set in a dynamic ifunc-using executable
contact+:
- Michal Nowak <mnowak@redhat.com>
duration: 5m
link:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=689829

View file

@ -0,0 +1,52 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/binutils/Regression/bz689829-ELFOSABI_LINUX-is-incorrectly-set-in-a-dynamic-ifunc-using-executable
# Description: ELFOSABI_LINUX is incorrectly set in a dynamic ifunc-using executable
# Author: Michal Nowak <mnowak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2011 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "$TMT_TREE/tests/lib.sh" || exit 1
rlJournalStart
rlPhaseStartSetup
buTestHeader
buEnterTmpDir
buCopyReproducers bar.c
rlPhaseEnd
rlPhaseStartTest
rlRun "gcc bar.c -o bar"
rlAssertExists "bar"
readelf -a bar | grep 'OS/ABI' > out
rlAssertGrep "UNIX - System V" out
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,9 @@
summary: "[RFE] - Please configure ld.bfd to allow --sysroot"
contact+:
- Martin Cermak <mcermak@redhat.com>
duration: 5m
link+:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=1080077

View file

@ -0,0 +1,51 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/binutils/Regression/bz1080077-RFE-Please-configure-ld-bfd-to-allow-sysroot
# Description: Test for BZ#1080077 ([RFE] - Please configure ld.bfd to allow --sysroot)
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2014 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
. "$TMT_TREE/tests/lib.sh" || exit 1
rlJournalStart
rlPhaseStartSetup
buTestHeader
_LD_BDF="$(which ld.bfd)"
_LD_BDF_PACKAGE="$(rpm --qf '%{name}\n' -qf "$_LD_BDF" | head -1)"
rlLogInfo "ld.bfd is $_LD_BDF of $_LD_BDF"
rlPhaseEnd
rlPhaseStartTest
rlRun "ld.bfd --sysroot=/tmp |& grep 'not configured to use sysroots'" 1
rlRun "ld.bfd --sysroot=/tmp |& grep 'no input files'"
rlPhaseEnd
rlPhaseStartCleanup
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,36 @@
summary: Make sure there is .stapsdt.base field
contact+:
- Michal Nowak <mnowak@redhat.com>
component+:
- glibc
- systemtap
recommend+:
- glibc.i386
- glibc.x86_64
- glibc.ppc
- glibc.ppc64
- glibc.s390
- glibc.s390x
- glibc.ia64
- glibc.i686
duration: 5m
link:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=748927
adjust+:
- when: arch == s390,s390x and distro == rhel-7
enabled: false
- when: arch == ppc64 and distro == rhel-7
enabled: false
- when: arch == aarch64
enabled: false
- when: arch == ppc64le
enabled: false

View file

@ -0,0 +1,57 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/binutils/Regression/bz748927-SystemTap-affected-by-stapsdt-base-1
# Description: Make sure there is .stapsdt.base field
# Author: Michal Nowak <mnowak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2011 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "$TMT_TREE/tests/lib.sh" || exit 1
rlJournalStart
rlPhaseStartSetup
buTestHeader
buEnterTmpDir
rlRun "grep -q CONFIG_UTRACE /boot/config-$( uname -r )" 0,1 || rlLogWarning "Uprobes disabled"
rlPhaseEnd
for ld in $( ls {/emul/ia32-linux,}/lib*/ld-2* 2> /dev/null); do
rlPhaseStartTest "${ld} from $( rpmquery -f ${ld} )"
filename="$( basename ${ld} ).readline"
rlRun "readelf -S ${ld} > $filename" 0 "[$( basename ${ld} )] Write section headers of ${ld}"
if ! [[ "$( rlGetArch )" == "ia64" && ! "${ld}" =~ "emul" ]]; then
rlAssertGrep ".stapsdt.base " $filename || rlLogError "This may be problem for SystemTap"
fi
rlAssertNotGrep ".stapsdt.base.1" $filename || rlLogError "This may be problem for SystemTap"
rlPhaseEnd
done
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -4,3 +4,8 @@ duration: 5m
link+:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=850832
adjust+:
- when: arch == s390x
because: Test is not relevant for s390x only
enabled: false

View file

@ -13,3 +13,8 @@ contact+:
require+:
- sed
adjust+:
- when: arch != x86_64
because: Test is relevant for x86_64 only
enabled: false

View file

@ -0,0 +1,13 @@
summary: "eu-unstrip: do not seem to match"
contact+:
- Michal Nowak <mnowak@redhat.com>
duration: 5m
link:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=698005
adjust+:
- when: arch != x86_64
enabled: false

View file

@ -0,0 +1,59 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/binutils/Regression/bz698005-eu-unstrip-do-not-seem-to-match
# Description: eu-unstrip: do not seem to match
# Author: Michal Nowak <mnowak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2011 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "$TMT_TREE/tests/lib.sh" || exit 1
rlJournalStart
rlPhaseStartSetup
buTestHeader
buEnterTmpDir
rlPhaseEnd
EABI_file="$(file $(find /usr/bin /bin /sbin /usr/sbin/) | grep '(GNU/Linux)' | tail -n1 | awk '{ print $1 }' | sed 's/://g')"
rlPhaseStartTest
if [ "${EABI_file}" ]; then
rlLog "EABI_file = $EABI_file"
rlRun "cp -v $EABI_file $TmpDir" 0 "Copy file with GNU/Linux EABI"
local_binary="$(basename ${EABI_file})"
rlAssertExists ${local_binary}
rlRun "strip -R .comment ${local_binary}"
file $local_binary > out
rlAssertNotGrep "(SYSV)" out
else
rlDie "There's nothing to test."
fi
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,14 @@
class A {
public:
A();
void f(){}
};
class C {
C();
};
C::C() {
A* p = new A;
p->f();
}

View file

@ -0,0 +1,25 @@
summary: holes in debuginfo
description: |
(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)
contact+:
- Michal Nowak <mnowak@redhat.com>
duration: 15m
link:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=509124

View file

@ -0,0 +1,13 @@
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};

View file

@ -0,0 +1,64 @@
#!/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 <mnowak@redhat.com>
#
# Include rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "$TMT_TREE/tests/lib.sh" || exit 1
rlJournalStart
rlPhaseStartSetup
buTestHeader
buEnterTmpDir
buCopyReproducers "ascend.C test.c"
rlPhaseEnd
for opt in s $( seq 0 3 ); do
rlPhaseStartTest "ascend.C: -O$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
for opt in s $( seq 0 3 ); do
rlPhaseStartTest "test.c: 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
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,2 @@
.org 0x100
nop

View file

@ -0,0 +1,11 @@
summary: ld crashes on ppc64 when being used with --oformat
duration: 15m
link+:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=1226864
adjust+:
- when: arch != ppc64 or arch != ppc64le
because: Test is relevant for x86_64 only
enabled: false

View file

@ -0,0 +1,51 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/binutils/Regression/bz1226864-ld-crashes-on-ppc64-when-being-used-with-oformat
# Description: Test for BZ#1226864 (ld crashes on ppc64 when being used with --oformat)
# 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
buCopyReproducers ldtest.S
rlPhaseEnd
rlPhaseStartTest
rlRun "gcc -c -o ldtest.o ldtest.S"
rlRun "ld --oformat=binary -o ldtest.bin ldtest.o"
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,14 @@
summary: ld eats all available memory on any -gdwarf-4 compiled object
contact+:
- Michal Nowak <mnowak@redhat.com>
duration: 5m
link:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=579696
adjust+:
- when: arch != x86_64
because: Test is relevant for x86_64 only
enabled: false

View file

@ -0,0 +1,49 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/binutils/Regressions/ld/bz579696-ld-r-produces-nonzero-sh_addr-values
# Description: .text, .data, and .bss show sh_addr values that are not zero.
# Author: Michal Nowak <mnowak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2010, 2012 Red Hat, Inc. All rights reserved.
#
# 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 3 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 rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "$TMT_TREE/tests/lib.sh" || exit 1
rlJournalStart
rlPhaseStartSetup
buTestHeader
buEnterTmpDir
buCopyReproducers X.o
rlPhaseEnd
rlPhaseStartTest
rlWatchdog "gcc -m32 -o X X.o" 5
rlAssert0 "gcc/ld finished on it's own" $?
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,18 @@
int foo __attribute__ ((section (".gnu.linkonce.d.1"),
visibility ("hidden"))) = 1;
int
__attribute__ ((section (".gnu.linkonce.t.1"), visibility ("hidden")))
bar ()
{
return 1;
}
int
get_foo ()
{
return foo;
}
int
get_bar ()
{
return bar ();
}

View file

@ -0,0 +1,7 @@
int foo __attribute__ ((section (".gnu.linkonce.d.1"))) = 1;
int
__attribute__ ((section (".gnu.linkonce.t.1")))
bar ()
{
return 1;
}

View file

@ -0,0 +1,9 @@
summary: ld fails to merge different visibility for the same symbol in distinct object files
contact+:
- Michal Nowak <mnowak@redhat.com>
duration: 5m
link:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=531269

View file

@ -0,0 +1,48 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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 <mnowak@redhat.com>
#
# Include rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "$TMT_TREE/tests/lib.sh" || exit 1
rlJournalStart
rlPhaseStartSetup
buTestHeader
buEnterTmpDir
buCopyReproducers "foo.c bar.c"
rlPhaseEnd
rlPhaseStartTest
rlRun "gcc -fPIC -c -o foo.o foo.c" 0 "Compile foo.c => foo.o"
rlRun "gcc -fPIC -c -o bar.o bar.c" 0 "Compile bar.c => bar.o"
rlRun "ld -shared -o foobar.so foo.o bar.o" 0 "Link foo.o & bar.o => foobar.so"
rlAssertExists foobar.so
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,3 @@
int foo(void) {
return 10;
}

View file

@ -0,0 +1,9 @@
summary: ld from devtoolset copies SONAME to DT_NEEDED
description: |
ld from devtoolset copies SONAME to DT_NEEDED without checking if its empty
duration: 5m
link:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=1117458

View file

@ -0,0 +1,60 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/binutils/Regression/bz1117458-ld-from-devtoolset-copies-SONAME-to-DT-NEEDED
# Description: Test for BZ#1117458 (ld from devtoolset copies SONAME to DT_NEEDED)
# Author: Milos Prchlik <mprchlik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2014 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
buCopyReproducers "user.c libfoo.c"
rlPhaseEnd
rlPhaseStartTest
rlRun "gcc -fPIC -g -c libfoo.c"
rlAssertExists "libfoo.o"
rlRun "gcc -shared -Wl,-soname, -o libfoo.so -lc libfoo.o 2>&1 | tee out" 0
rlAssertExists "libfoo.so"
rlLogInfo "gcc output:"
rlLogInfo "$(cat out)"
rlAssertGrep "SONAME must not be empty string; ignored" out
rlRun "objdump -p libfoo.so | grep SONAME | awk '{print \$2}' > soname"
if [ "`stat -c '%s' soname`" != "0" ]; then
rlLogInfo "SONAME='$(cat soname)'"
rlFail "Detected SONAME is empty"
fi
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,9 @@
#include <stdio.h>
extern int foo(void);
int main(void) {
int a = foo();
printf("a is %d\n", a);
return 0;
}

View file

@ -7,3 +7,8 @@ duration: 15m
link+:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=1573872
adjust+:
- when: arch != x86_64
because: Test is relevant for x86_64 only
enabled: false

View file

@ -0,0 +1 @@
int here, there __attribute__ ((section (".discard")));

View file

@ -0,0 +1,57 @@
summary: ld -r generates R_X86_64_NONE
description: |
WRONG:
$ readelf -r foo2.o
Relocation section '.rela.debug_info' at offset 0x618 contains 11 entries:
Offset Info Type Sym. Value Sym. Name + Addend
000000000006 00040000000a R_X86_64_32 0000000000000000 .debug_abbrev + 0
00000000000c 00080000000a R_X86_64_32 0000000000000000 .debug_str + b
000000000011 00080000000a R_X86_64_32 0000000000000000 .debug_str + 38
000000000015 00080000000a R_X86_64_32 0000000000000000 .debug_str + 6
000000000019 000100000001 R_X86_64_64 0000000000000000 .text + 0
000000000021 000100000001 R_X86_64_64 0000000000000000 .text + 0
000000000029 00060000000a R_X86_64_32 0000000000000000 .debug_line + 0
00000000002e 00080000000a R_X86_64_32 0000000000000000 .debug_str + 33
00000000003b 000c00000001 R_X86_64_64 0000000000000004 here + 0
00000000004b 00080000000a R_X86_64_32 0000000000000000 .debug_str + 0
-> 000000000058 000000000000 R_X86_64_NONE 0000000000000000
Relocation section '.rela.debug_pubnames' at offset 0x720 contains 1 entries:
Offset Info Type Sym. Value Sym. Name + Addend
000000000006 00050000000a R_X86_64_32 0000000000000000 .debug_info + 0
OK:
Relocation section '.rela.debug_info' at offset 0x628 contains 10 entries:
Offset Info Type Sym. Value Sym. Name + Addend
000000000006 00040000000a R_X86_64_32 0000000000000000 .debug_abbrev + 0
00000000000c 00080000000a R_X86_64_32 0000000000000000 .debug_str + 1f
000000000011 00080000000a R_X86_64_32 0000000000000000 .debug_str + 46
000000000015 00080000000a R_X86_64_32 0000000000000000 .debug_str + b
000000000019 000100000001 R_X86_64_64 0000000000000000 .text + 0
000000000021 000100000001 R_X86_64_64 0000000000000000 .text + 0
000000000029 00060000000a R_X86_64_32 0000000000000000 .debug_line + 0
00000000002e 00080000000a R_X86_64_32 0000000000000000 .debug_str + 6
00000000003b 000c00000001 R_X86_64_64 0000000000000004 here + 0
00000000004b 00080000000a R_X86_64_32 0000000000000000 .debug_str + 0
Relocation section '.rela.debug_pubnames' at offset 0x730 contains 1 entries:
Offset Info Type Sym. Value Sym. Name + Addend
000000000006 00050000000a R_X86_64_32 0000000000000000 .debug_info + 0
contact+:
- Michal Nowak <mnowak@redhat.com>
duration: 5m
link+:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=587788
- relates: https://sourceware.org/bugzilla/show_bug.cgi?id=11542
adjust+:
- when: arch != x86_64
because: Test is relevant for x86_64 only
enabled: false

View file

@ -0,0 +1,8 @@
/*
* Common module linker script, always used when linking a module.
* Archs are free to supply their own linker scripts. ld will
* combine them automatically.
*/
SECTIONS {
/DISCARD/ : { *(.discard) }
}

View file

@ -0,0 +1,53 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/binutils/Regressions/ld/bz579696-ld-r-produces-nonzero-sh_addr-values
# Description: .text, .data, and .bss show sh_addr values that are not zero.
# Author: Michal Nowak <mnowak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2010, 2012 Red Hat, Inc. All rights reserved.
#
# 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 3 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 rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "$TMT_TREE/tests/lib.sh" || exit 1
rlJournalStart
rlPhaseStartSetup
buTestHeader
buEnterTmpDir
buCopyReproducers "foo.c module-common.lds"
rlPhaseEnd
rlPhaseStartTest
rlRun "gcc -c foo.c -g -O0"
rlRun "ld -r -o foo2.o -T module-common.lds foo.o"
rlAssertExists foo2.o
readelf -r foo2.o &> readelf.r
cat readelf.r
rlAssertNotGrep R_X86_64_NONE readelf.r
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,22 @@
summary: libbfd.a not compiled with -fPIC
description: |
Would it be possible to have /usr/lib64/libbfd.a in binutils
compiled with -fPIC? Otherwise, shared apps can't link against
libbfd. In binutils.spec, libiberty.a is already recreated
with -fPIC, is there some reason the same isn't done for
libbfd?
From binutils.spec:
# Rebuild libiberty.a with -fPIC
make -C libiberty clean
make CFLAGS=\"-g -fPIC $RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64\" -C libiberty
contact+:
- Michal Nowak <mnowak@redhat.com>
duration: 5m
link+:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=430856

View file

@ -0,0 +1,20 @@
CC=gcc
CFLAGS=-g -Wall
all: test
libbfdtest.so bfdtest: Makefile
libbfdtest.so: libbfdtest.c libbfdtest.h
$(CC) $(CFLAGS) -shared -o $@ -fPIC $< -lbfd -liberty
bfdtest: bfdtest.c libbfdtest.h libbfdtest.so
$(CC) -o $@ $< -L. -Wl,-rpath,. -lbfdtest -ldl
.PHONY: test
test: bfdtest
./$<
@echo OK
clean:
$(RM) libbfdtest.so bfdtest

View file

@ -0,0 +1,7 @@
#include "libbfdtest.h"
int
main (void)
{
return libbfdtest () ? 0 : 1;
}

View file

@ -0,0 +1,10 @@
#include <bfd.h>
#include "libbfdtest.h"
int
libbfdtest (void)
{
bfd_set_error (bfd_error_no_error);
return bfd_get_error () == bfd_error_no_error;
}

View file

@ -0,0 +1 @@
extern int libbfdtest (void);

View file

@ -0,0 +1,44 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "$TMT_TREE/tests/lib.sh" || exit 1
rlJournalStart
rlPhaseStartSetup
buTestHeader
buEnterTmpDir
buCopyReproducers "reproducer/Makefile reproducer/bfdtest.c reproducer/libbfdtest.c reproducer/libbfdtest.h"
rlPhaseEnd
rlPhaseStartTest
rlRun "make clean"
rlRun "make" 0 "Build the files"
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,9 @@
summary: Checks c++filt
contact+:
- Michal Nowak <mnowak@redhat.com>
duration: 5m
link:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=495196

View file

@ -0,0 +1,51 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/binutils/Regressions/cxx-filt/bz495196-man-page-for-c-filt-contains-unsupported-options
# Description: Checks c++filt's man page for unsupported options
# Author: Michal Nowak <mnowak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "$TMT_TREE/tests/lib.sh" || exit 1
rlJournalStart
rlPhaseStartSetup
buTestHeader
buEnterTmpDir
rlPhaseEnd
rlPhaseStartTest
rlRun "man c++filt | sed $'s/.\x08//g' > cxxfilt.man" 0 "Write prepared cxxfilt man page"
rlAssertNotGrep "--*strip-underscores" cxxfilt.man --
rlAssertNotGrep "--n*o*-*strip-underscores" cxxfilt.man --
rlAssertNotGrep "--*java" cxxfilt.man --
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,13 @@
summary: The output of strings -0 file is in loop and -n 0xA cannot be correctly recognized
description: |
Use "strings -0 file", the output will be in loop.
And "strings -n 0xA file" will report error as "invalid number 0xA"
contact+:
- Michal Nowak <mnowak@redhat.com>
duration: 5m
link+:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=435078

View file

@ -0,0 +1,53 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "$TMT_TREE/tests/lib.sh" || exit 1
rlJournalStart
rlPhaseStartSetup
buTestHeader
buEnterTmpDir
rlRun "echo -e \"asdjkhsd\nsdsdsdssd\n\nsdsd\n\" > tstfile" 0 "Generating test file tstfile"
rlPhaseEnd
rlPhaseStartTest TestingOne
rlRun "strings -0 tstfile > errorfile 2>&1 &"
rlRun "sleep 5"
rlRun "jobs"
rlRun "kill -9 %1" 1 "strings in the loop"
rlAssertGrep "minim" errorfile
rlPhaseEnd
rlPhaseStartTest TestingTwo
rlRun "strings -n 0xA tstfile" 0 "echo \"PASS: tstfile processed.\""
rlPhaseEnd
rlPhaseStartCleanup Cleanup
rlBundleLogs "binutils-outputs" errorfile tstfile
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,5 @@
#include <stdio.h>
int main() {
fprintf(stderr, "Hello world\n");
return 0;
}

View file

@ -0,0 +1,19 @@
summary: "programs linked with gcc -static -s fail with 'unexpected reloc type in static binary'"
description: |
This only happens with gcc -static -s; compiling with gcc -static and then
stripping with strip works fine.
contact+:
- Michal Nowak <mnowak@redhat.com>
require+:
- glibc-static
environment+:
REQUIRES: "glibc-static"
duration: 5m
link:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=533321

View file

@ -0,0 +1,50 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/binutils/Regressions/ld/bz533321-programs-linked-with-gcc-static-s-fail-with-unexpected-reloc-type-in-static-binary
# Description: This only happens with gcc -static -s; compiling with gcc -static and then stripping with strip works fine.
# Author: Michal Nowak <mnowak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2010, 2012 Red Hat, Inc. All rights reserved.
#
# 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 3 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 rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "$TMT_TREE/tests/lib.sh" || exit 1
rlJournalStart
rlPhaseStartSetup
buTestHeader
buEnterTmpDir
buCopyReproducers hello-unexpected-reloc-type.c
rlPhaseEnd
rlPhaseStartTest
rlRun "gcc -static -s -o hello-unexpected-reloc-type hello-unexpected-reloc-type.c" 0 "Compiling & linking hello-unexpected-reloc-type.c "
rlAssertExists "hello-unexpected-reloc-type"
rlRun "./hello-unexpected-reloc-type"
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,37 @@
summary: When mistaking the argument of strings command , the same error message is output.
description: |+
[RHEL5.2]
# strings -n file1
strings: invalid integer argument file1
# strings --bytes file1
strings: invalid integer argument file1
# strings -n 0
strings: invalid number 0
# strings --bytes 0
strings: invalid number 0
[RHEL5.3]
# strings -n file1
strings: invalid minimum string length 0
# strings --bytes file1
strings: invalid minimum string length 0
# strings -n 0
strings: invalid minimum string length 0
# strings --bytes 0
strings: invalid minimum string length 0
contact+:
- Michal Nowak <mnowak@redhat.com>
duration: 5m
link:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=480009

View file

@ -0,0 +1,56 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
#
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
#
# 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 3 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/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
# source the test script helpers
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "$TMT_TREE/tests/lib.sh" || exit 1
rlJournalStart
rlPhaseStartSetup
buTestHeader
buEnterTmpDir
rlPhaseEnd
rlPhaseStartTest "#1: strings -n file1"
rlRun "strings -n file1 2>&1 | tee output"
rlAssertGrep "invalid integer argument file1" output
rlPhaseEnd
rlPhaseStartTest "#2: strings --bytes file1"
rlRun "strings --bytes file1 2>&1 | tee output"
rlAssertGrep "invalid integer argument file1" output
rlPhaseEnd
rlPhaseStartTest "#3: strings -n 0"
rlRun "strings -n 0 2>&1 | tee output"
rlAssertGrep "invalid minimum string length 0" output
rlPhaseEnd
rlPhaseStartTest "#4: strings --bytes 0"
rlRun "strings --bytes 0 2>&1 | tee output"
rlAssertGrep "invalid minimum string length 0" output
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -41,6 +41,8 @@ function buTestHeader () {
rlLogInfo "BU_TMPDIR_PARENT=$BU_TMPDIR_PARENT"
rlLogInfo "BU_AS_TEST_USER=$BU_AS_TEST_USER"
rlShowRunningKernel
rlAssertRpm --all
if [ "$1" = "--system-is-active" ]; then

View file

@ -6,7 +6,8 @@
description: ""
# Set component to `binutils` - probably not having any exceptions.
component: binutils
component:
- binutils
# Default set of contacts - some tests will add more as needed to reflect the fact
# some tests were developed by other people.
@ -185,6 +186,22 @@ adjust+:
# RHEL-8 / gcc-toolset-11
# RHEL-7 / no collection
- when: distro == rhel-7 and collection is not defined
require+:
- binutils
- binutils-devel
# - binutils-gold
# - binutils-gprofng
- gcc
- gcc-c++
environment+:
PACKAGES: binutils
_REQUIRES: gcc gcc-c++ glibc
BINUTILS_PACKAGE: binutils
GCC_PACKAGE: gcc
# RHEL-7 / devtoolset-13
- when: distro == rhel-7 and collection == devtoolset-13
require+:
- devtoolset-13-binutils
@ -201,8 +218,6 @@ adjust+:
GCC_PACKAGE: devtoolset-13-gcc
COLLECTION_PACKAGES: devtoolset-13-binutils devtoolset-13-binutils-devel devtoolset-13-binutils-gold devtoolset-13-binutils-gprofng
# RHEL-7 / no collection
# RHEL-7 / devtoolset-13
# RHEL-7 / devtoolset-12
# RHEL-7 / devtoolset-11

View file

@ -36,12 +36,6 @@ rlJournalStart
rlPhaseStartSetup
buTestHeader
if [ -z "$BASELINE" ]; then
rlLog "$(cat /etc/redhat-release)"
rlFail "No baseline available for this major release; using RHEL-7 as baseline"
BASELINE=7
fi
rlLogInfo "BASELINE=$BASELINE"
if rlIsRHEL "=6"; then