From 49a8b1ca160fa1c6127d2b10cffa9a7d719108d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Prchl=C3=ADk?= Date: Fri, 10 Nov 2023 09:15:59 +0100 Subject: [PATCH] Port tests --- .../main.fmf | 9 +++ .../test.sh | 58 ++++++++++++++ .../x.i | 62 +++++++++++++++ .../y.i | 71 ++++++++++++++++++ .../t.c | 1 + .../bar.c | 1 + .../main.fmf | 9 +++ .../test.sh | 52 +++++++++++++ .../main.fmf | 9 +++ .../test.sh | 51 +++++++++++++ .../main.fmf | 36 +++++++++ .../test.sh | 57 ++++++++++++++ .../main.fmf | 5 ++ .../main.fmf | 5 ++ .../eu-unstrip-do-not-seem-to-match/main.fmf | 13 ++++ .../eu-unstrip-do-not-seem-to-match/test.sh | 59 +++++++++++++++ tests/bugs/holes-in-debuginfo/ascend.C | 14 ++++ tests/bugs/holes-in-debuginfo/main.fmf | 25 ++++++ tests/bugs/holes-in-debuginfo/test.c | 13 ++++ tests/bugs/holes-in-debuginfo/test.sh | 64 ++++++++++++++++ .../ldtest.S | 2 + .../main.fmf | 11 +++ .../test.sh | 51 +++++++++++++ .../X.o | Bin 0 -> 2180 bytes .../main.fmf | 14 ++++ .../test.sh | 49 ++++++++++++ .../bar.c | 18 +++++ .../foo.c | 7 ++ .../main.fmf | 9 +++ .../test.sh | 48 ++++++++++++ .../libfoo.c | 3 + .../main.fmf | 9 +++ .../test.sh | 60 +++++++++++++++ .../user.c | 9 +++ .../ld-should-allow-lea-foo-GOT-ecx/main.fmf | 5 ++ .../bugs/ld_-r-generates-R_X86_64_NONE/foo.c | 1 + .../ld_-r-generates-R_X86_64_NONE/main.fmf | 57 ++++++++++++++ .../module-common.lds | 8 ++ .../ld_-r-generates-R_X86_64_NONE/test.sh | 53 +++++++++++++ .../libbfd.a-not-compiled-with-fPIC/main.fmf | 22 ++++++ .../reproducer/Makefile | 20 +++++ .../reproducer/bfdtest.c | 7 ++ .../reproducer/libbfdtest.c | 10 +++ .../reproducer/libbfdtest.h | 1 + .../libbfd.a-not-compiled-with-fPIC/test.sh | 44 +++++++++++ .../main.fmf | 9 +++ .../test.sh | 51 +++++++++++++ .../main.fmf | 13 ++++ .../test.sh | 53 +++++++++++++ .../hello-unexpected-reloc-type.c | 5 ++ .../main.fmf | 19 +++++ .../test.sh | 50 ++++++++++++ .../main.fmf | 37 +++++++++ .../test.sh | 56 ++++++++++++++ tests/lib.sh | 2 + tests/main.fmf | 21 +++++- tests/supported-targets/test.sh | 6 -- 57 files changed, 1445 insertions(+), 9 deletions(-) create mode 100644 tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/main.fmf create mode 100755 tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/test.sh create mode 100644 tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/x.i create mode 100644 tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/y.i create mode 100644 tests/bugs/ELFOSABI_LINUX-is-incorrectly-set-in-a-dynamic-ifunc-using-executable/bar.c create mode 100644 tests/bugs/ELFOSABI_LINUX-is-incorrectly-set-in-a-dynamic-ifunc-using-executable/main.fmf create mode 100755 tests/bugs/ELFOSABI_LINUX-is-incorrectly-set-in-a-dynamic-ifunc-using-executable/test.sh create mode 100644 tests/bugs/RFE-Please-configure-ld-bfd-to-allow-sysroot/main.fmf create mode 100755 tests/bugs/RFE-Please-configure-ld-bfd-to-allow-sysroot/test.sh create mode 100644 tests/bugs/SystemTap-affected-by-stapsdt-base-1/main.fmf create mode 100755 tests/bugs/SystemTap-affected-by-stapsdt-base-1/test.sh create mode 100644 tests/bugs/eu-unstrip-do-not-seem-to-match/main.fmf create mode 100755 tests/bugs/eu-unstrip-do-not-seem-to-match/test.sh create mode 100644 tests/bugs/holes-in-debuginfo/ascend.C create mode 100644 tests/bugs/holes-in-debuginfo/main.fmf create mode 100644 tests/bugs/holes-in-debuginfo/test.c create mode 100755 tests/bugs/holes-in-debuginfo/test.sh create mode 100644 tests/bugs/ld-crashes-on-ppc64-when-being-used-with-oformat/ldtest.S create mode 100644 tests/bugs/ld-crashes-on-ppc64-when-being-used-with-oformat/main.fmf create mode 100755 tests/bugs/ld-crashes-on-ppc64-when-being-used-with-oformat/test.sh create mode 100644 tests/bugs/ld-eats-all-available-memory-on-gdwarf-4-compiled-object/X.o create mode 100644 tests/bugs/ld-eats-all-available-memory-on-gdwarf-4-compiled-object/main.fmf create mode 100755 tests/bugs/ld-eats-all-available-memory-on-gdwarf-4-compiled-object/test.sh create mode 100644 tests/bugs/ld-fails-to-merge-different-visibility-for-the-same-symbol/bar.c create mode 100644 tests/bugs/ld-fails-to-merge-different-visibility-for-the-same-symbol/foo.c create mode 100644 tests/bugs/ld-fails-to-merge-different-visibility-for-the-same-symbol/main.fmf create mode 100755 tests/bugs/ld-fails-to-merge-different-visibility-for-the-same-symbol/test.sh create mode 100644 tests/bugs/ld-from-devtoolset-copies-SONAME-to-DT-NEEDED/libfoo.c create mode 100644 tests/bugs/ld-from-devtoolset-copies-SONAME-to-DT-NEEDED/main.fmf create mode 100755 tests/bugs/ld-from-devtoolset-copies-SONAME-to-DT-NEEDED/test.sh create mode 100644 tests/bugs/ld-from-devtoolset-copies-SONAME-to-DT-NEEDED/user.c create mode 100644 tests/bugs/ld_-r-generates-R_X86_64_NONE/foo.c create mode 100644 tests/bugs/ld_-r-generates-R_X86_64_NONE/main.fmf create mode 100644 tests/bugs/ld_-r-generates-R_X86_64_NONE/module-common.lds create mode 100755 tests/bugs/ld_-r-generates-R_X86_64_NONE/test.sh create mode 100644 tests/bugs/libbfd.a-not-compiled-with-fPIC/main.fmf create mode 100644 tests/bugs/libbfd.a-not-compiled-with-fPIC/reproducer/Makefile create mode 100644 tests/bugs/libbfd.a-not-compiled-with-fPIC/reproducer/bfdtest.c create mode 100644 tests/bugs/libbfd.a-not-compiled-with-fPIC/reproducer/libbfdtest.c create mode 100644 tests/bugs/libbfd.a-not-compiled-with-fPIC/reproducer/libbfdtest.h create mode 100755 tests/bugs/libbfd.a-not-compiled-with-fPIC/test.sh create mode 100644 tests/bugs/man-page-for-c-filt-contains-unsupported-options/main.fmf create mode 100755 tests/bugs/man-page-for-c-filt-contains-unsupported-options/test.sh create mode 100644 tests/bugs/output-of-strings-0-n-is-incorrect/main.fmf create mode 100755 tests/bugs/output-of-strings-0-n-is-incorrect/test.sh create mode 100644 tests/bugs/programs-linked-with-gcc-static-s-fail-with-unexpected-reloc-type-in-static-binary/hello-unexpected-reloc-type.c create mode 100644 tests/bugs/programs-linked-with-gcc-static-s-fail-with-unexpected-reloc-type-in-static-binary/main.fmf create mode 100755 tests/bugs/programs-linked-with-gcc-static-s-fail-with-unexpected-reloc-type-in-static-binary/test.sh create mode 100644 tests/bugs/when-mistaking-argument-of-strings/main.fmf create mode 100755 tests/bugs/when-mistaking-argument-of-strings/test.sh diff --git a/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/main.fmf b/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/main.fmf new file mode 100644 index 0000000..c4202d8 --- /dev/null +++ b/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/main.fmf @@ -0,0 +1,9 @@ +summary: Regression test for bz241252 + +duration: 3m + +contact+: + - Michal Nowak + +link+: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=241252 diff --git a/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/test.sh b/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/test.sh new file mode 100755 index 0000000..b9e4187 --- /dev/null +++ b/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/test.sh @@ -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 diff --git a/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/x.i b/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/x.i new file mode 100644 index 0000000..0a81c5d --- /dev/null +++ b/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/x.i @@ -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; +} diff --git a/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/y.i b/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/y.i new file mode 100644 index 0000000..b5dc13b --- /dev/null +++ b/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/y.i @@ -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) +{ +} diff --git a/tests/bugs/Bogus-warning-about-cross-object-references-to/t.c b/tests/bugs/Bogus-warning-about-cross-object-references-to/t.c index 01c050d..ede511e 100644 --- a/tests/bugs/Bogus-warning-about-cross-object-references-to/t.c +++ b/tests/bugs/Bogus-warning-about-cross-object-references-to/t.c @@ -13,4 +13,5 @@ void bar(void); int main() { foo(); bar(); + return 0; } diff --git a/tests/bugs/ELFOSABI_LINUX-is-incorrectly-set-in-a-dynamic-ifunc-using-executable/bar.c b/tests/bugs/ELFOSABI_LINUX-is-incorrectly-set-in-a-dynamic-ifunc-using-executable/bar.c new file mode 100644 index 0000000..b908b6d --- /dev/null +++ b/tests/bugs/ELFOSABI_LINUX-is-incorrectly-set-in-a-dynamic-ifunc-using-executable/bar.c @@ -0,0 +1 @@ +int main () { return 42; } diff --git a/tests/bugs/ELFOSABI_LINUX-is-incorrectly-set-in-a-dynamic-ifunc-using-executable/main.fmf b/tests/bugs/ELFOSABI_LINUX-is-incorrectly-set-in-a-dynamic-ifunc-using-executable/main.fmf new file mode 100644 index 0000000..9e8a135 --- /dev/null +++ b/tests/bugs/ELFOSABI_LINUX-is-incorrectly-set-in-a-dynamic-ifunc-using-executable/main.fmf @@ -0,0 +1,9 @@ +summary: ELFOSABI_LINUX is incorrectly set in a dynamic ifunc-using executable + +contact+: + - Michal Nowak + +duration: 5m + +link: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=689829 diff --git a/tests/bugs/ELFOSABI_LINUX-is-incorrectly-set-in-a-dynamic-ifunc-using-executable/test.sh b/tests/bugs/ELFOSABI_LINUX-is-incorrectly-set-in-a-dynamic-ifunc-using-executable/test.sh new file mode 100755 index 0000000..7e59ebe --- /dev/null +++ b/tests/bugs/ELFOSABI_LINUX-is-incorrectly-set-in-a-dynamic-ifunc-using-executable/test.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 diff --git a/tests/bugs/RFE-Please-configure-ld-bfd-to-allow-sysroot/main.fmf b/tests/bugs/RFE-Please-configure-ld-bfd-to-allow-sysroot/main.fmf new file mode 100644 index 0000000..09ef2cc --- /dev/null +++ b/tests/bugs/RFE-Please-configure-ld-bfd-to-allow-sysroot/main.fmf @@ -0,0 +1,9 @@ +summary: "[RFE] - Please configure ld.bfd to allow --sysroot" + +contact+: + - Martin Cermak + +duration: 5m + +link+: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=1080077 diff --git a/tests/bugs/RFE-Please-configure-ld-bfd-to-allow-sysroot/test.sh b/tests/bugs/RFE-Please-configure-ld-bfd-to-allow-sysroot/test.sh new file mode 100755 index 0000000..858b8b8 --- /dev/null +++ b/tests/bugs/RFE-Please-configure-ld-bfd-to-allow-sysroot/test.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 diff --git a/tests/bugs/SystemTap-affected-by-stapsdt-base-1/main.fmf b/tests/bugs/SystemTap-affected-by-stapsdt-base-1/main.fmf new file mode 100644 index 0000000..30d06d2 --- /dev/null +++ b/tests/bugs/SystemTap-affected-by-stapsdt-base-1/main.fmf @@ -0,0 +1,36 @@ +summary: Make sure there is .stapsdt.base field + +contact+: + - Michal Nowak + +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 diff --git a/tests/bugs/SystemTap-affected-by-stapsdt-base-1/test.sh b/tests/bugs/SystemTap-affected-by-stapsdt-base-1/test.sh new file mode 100755 index 0000000..dae48f7 --- /dev/null +++ b/tests/bugs/SystemTap-affected-by-stapsdt-base-1/test.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 diff --git a/tests/bugs/The-binutils-package-contains-the-windmc-1-manual/main.fmf b/tests/bugs/The-binutils-package-contains-the-windmc-1-manual/main.fmf index 00e0896..311d367 100644 --- a/tests/bugs/The-binutils-package-contains-the-windmc-1-manual/main.fmf +++ b/tests/bugs/The-binutils-package-contains-the-windmc-1-manual/main.fmf @@ -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 diff --git a/tests/bugs/binutils-ld-removes-some-R-X86-64-JUMP-SLOT/main.fmf b/tests/bugs/binutils-ld-removes-some-R-X86-64-JUMP-SLOT/main.fmf index fc4b7dc..8ef0a2b 100644 --- a/tests/bugs/binutils-ld-removes-some-R-X86-64-JUMP-SLOT/main.fmf +++ b/tests/bugs/binutils-ld-removes-some-R-X86-64-JUMP-SLOT/main.fmf @@ -13,3 +13,8 @@ contact+: require+: - sed + +adjust+: + - when: arch != x86_64 + because: Test is relevant for x86_64 only + enabled: false diff --git a/tests/bugs/eu-unstrip-do-not-seem-to-match/main.fmf b/tests/bugs/eu-unstrip-do-not-seem-to-match/main.fmf new file mode 100644 index 0000000..6fda41b --- /dev/null +++ b/tests/bugs/eu-unstrip-do-not-seem-to-match/main.fmf @@ -0,0 +1,13 @@ +summary: "eu-unstrip: do not seem to match" + +contact+: + - Michal Nowak + +duration: 5m + +link: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=698005 + +adjust+: + - when: arch != x86_64 + enabled: false diff --git a/tests/bugs/eu-unstrip-do-not-seem-to-match/test.sh b/tests/bugs/eu-unstrip-do-not-seem-to-match/test.sh new file mode 100755 index 0000000..d40eceb --- /dev/null +++ b/tests/bugs/eu-unstrip-do-not-seem-to-match/test.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 diff --git a/tests/bugs/holes-in-debuginfo/ascend.C b/tests/bugs/holes-in-debuginfo/ascend.C new file mode 100644 index 0000000..d8e834d --- /dev/null +++ b/tests/bugs/holes-in-debuginfo/ascend.C @@ -0,0 +1,14 @@ +class A { +public: + A(); + void f(){} +}; + +class C { + C(); +}; + +C::C() { + A* p = new A; + p->f(); +} diff --git a/tests/bugs/holes-in-debuginfo/main.fmf b/tests/bugs/holes-in-debuginfo/main.fmf new file mode 100644 index 0000000..d7781c6 --- /dev/null +++ b/tests/bugs/holes-in-debuginfo/main.fmf @@ -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 + +duration: 15m + +link: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=509124 diff --git a/tests/bugs/holes-in-debuginfo/test.c b/tests/bugs/holes-in-debuginfo/test.c new file mode 100644 index 0000000..80e7cc4 --- /dev/null +++ b/tests/bugs/holes-in-debuginfo/test.c @@ -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}; diff --git a/tests/bugs/holes-in-debuginfo/test.sh b/tests/bugs/holes-in-debuginfo/test.sh new file mode 100755 index 0000000..1ba86d9 --- /dev/null +++ b/tests/bugs/holes-in-debuginfo/test.sh @@ -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 +# +# 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 diff --git a/tests/bugs/ld-crashes-on-ppc64-when-being-used-with-oformat/ldtest.S b/tests/bugs/ld-crashes-on-ppc64-when-being-used-with-oformat/ldtest.S new file mode 100644 index 0000000..16b3950 --- /dev/null +++ b/tests/bugs/ld-crashes-on-ppc64-when-being-used-with-oformat/ldtest.S @@ -0,0 +1,2 @@ +.org 0x100 + nop diff --git a/tests/bugs/ld-crashes-on-ppc64-when-being-used-with-oformat/main.fmf b/tests/bugs/ld-crashes-on-ppc64-when-being-used-with-oformat/main.fmf new file mode 100644 index 0000000..13e316b --- /dev/null +++ b/tests/bugs/ld-crashes-on-ppc64-when-being-used-with-oformat/main.fmf @@ -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 diff --git a/tests/bugs/ld-crashes-on-ppc64-when-being-used-with-oformat/test.sh b/tests/bugs/ld-crashes-on-ppc64-when-being-used-with-oformat/test.sh new file mode 100755 index 0000000..cf2a1b1 --- /dev/null +++ b/tests/bugs/ld-crashes-on-ppc64-when-being-used-with-oformat/test.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 diff --git a/tests/bugs/ld-eats-all-available-memory-on-gdwarf-4-compiled-object/X.o b/tests/bugs/ld-eats-all-available-memory-on-gdwarf-4-compiled-object/X.o new file mode 100644 index 0000000000000000000000000000000000000000..66ddcbacad915a2add88f502c350319fc1ad92c4 GIT binary patch literal 2180 zcma)8O=whC6#mY;Z+>**Wa8MGkQS$)C0hDsqEm`VnuLZLA|+^P1R*HzOVp5I+#&d#< z#en1E-!qGwaoz#W87Is3qxH?$lsCx;Cg0!w$B!>M1Jf_R_}lapW8VS( zFl5$RyuKaMuSK9nzy|=TnvZ**d*0^zvjll&3``z**m@VQhqnFjE5`ix3M`wf6$B0* zG6^9&bp# + +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 diff --git a/tests/bugs/ld-eats-all-available-memory-on-gdwarf-4-compiled-object/test.sh b/tests/bugs/ld-eats-all-available-memory-on-gdwarf-4-compiled-object/test.sh new file mode 100755 index 0000000..4786ee1 --- /dev/null +++ b/tests/bugs/ld-eats-all-available-memory-on-gdwarf-4-compiled-object/test.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 diff --git a/tests/bugs/ld-fails-to-merge-different-visibility-for-the-same-symbol/bar.c b/tests/bugs/ld-fails-to-merge-different-visibility-for-the-same-symbol/bar.c new file mode 100644 index 0000000..6e3c867 --- /dev/null +++ b/tests/bugs/ld-fails-to-merge-different-visibility-for-the-same-symbol/bar.c @@ -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 (); +} diff --git a/tests/bugs/ld-fails-to-merge-different-visibility-for-the-same-symbol/foo.c b/tests/bugs/ld-fails-to-merge-different-visibility-for-the-same-symbol/foo.c new file mode 100644 index 0000000..7834bd4 --- /dev/null +++ b/tests/bugs/ld-fails-to-merge-different-visibility-for-the-same-symbol/foo.c @@ -0,0 +1,7 @@ +int foo __attribute__ ((section (".gnu.linkonce.d.1"))) = 1; +int +__attribute__ ((section (".gnu.linkonce.t.1"))) +bar () +{ + return 1; +} diff --git a/tests/bugs/ld-fails-to-merge-different-visibility-for-the-same-symbol/main.fmf b/tests/bugs/ld-fails-to-merge-different-visibility-for-the-same-symbol/main.fmf new file mode 100644 index 0000000..9c89bef --- /dev/null +++ b/tests/bugs/ld-fails-to-merge-different-visibility-for-the-same-symbol/main.fmf @@ -0,0 +1,9 @@ +summary: ld fails to merge different visibility for the same symbol in distinct object files + +contact+: + - Michal Nowak + +duration: 5m + +link: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=531269 diff --git a/tests/bugs/ld-fails-to-merge-different-visibility-for-the-same-symbol/test.sh b/tests/bugs/ld-fails-to-merge-different-visibility-for-the-same-symbol/test.sh new file mode 100755 index 0000000..49a444d --- /dev/null +++ b/tests/bugs/ld-fails-to-merge-different-visibility-for-the-same-symbol/test.sh @@ -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 +# +# 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 diff --git a/tests/bugs/ld-from-devtoolset-copies-SONAME-to-DT-NEEDED/libfoo.c b/tests/bugs/ld-from-devtoolset-copies-SONAME-to-DT-NEEDED/libfoo.c new file mode 100644 index 0000000..7eabd2e --- /dev/null +++ b/tests/bugs/ld-from-devtoolset-copies-SONAME-to-DT-NEEDED/libfoo.c @@ -0,0 +1,3 @@ +int foo(void) { + return 10; +} diff --git a/tests/bugs/ld-from-devtoolset-copies-SONAME-to-DT-NEEDED/main.fmf b/tests/bugs/ld-from-devtoolset-copies-SONAME-to-DT-NEEDED/main.fmf new file mode 100644 index 0000000..cabf941 --- /dev/null +++ b/tests/bugs/ld-from-devtoolset-copies-SONAME-to-DT-NEEDED/main.fmf @@ -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 it’s empty + +duration: 5m + +link: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=1117458 diff --git a/tests/bugs/ld-from-devtoolset-copies-SONAME-to-DT-NEEDED/test.sh b/tests/bugs/ld-from-devtoolset-copies-SONAME-to-DT-NEEDED/test.sh new file mode 100755 index 0000000..7b23a81 --- /dev/null +++ b/tests/bugs/ld-from-devtoolset-copies-SONAME-to-DT-NEEDED/test.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 diff --git a/tests/bugs/ld-from-devtoolset-copies-SONAME-to-DT-NEEDED/user.c b/tests/bugs/ld-from-devtoolset-copies-SONAME-to-DT-NEEDED/user.c new file mode 100644 index 0000000..e433023 --- /dev/null +++ b/tests/bugs/ld-from-devtoolset-copies-SONAME-to-DT-NEEDED/user.c @@ -0,0 +1,9 @@ +#include + +extern int foo(void); + +int main(void) { + int a = foo(); + printf("a is %d\n", a); + return 0; +} diff --git a/tests/bugs/ld-should-allow-lea-foo-GOT-ecx/main.fmf b/tests/bugs/ld-should-allow-lea-foo-GOT-ecx/main.fmf index 3e30dcd..05848a8 100644 --- a/tests/bugs/ld-should-allow-lea-foo-GOT-ecx/main.fmf +++ b/tests/bugs/ld-should-allow-lea-foo-GOT-ecx/main.fmf @@ -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 diff --git a/tests/bugs/ld_-r-generates-R_X86_64_NONE/foo.c b/tests/bugs/ld_-r-generates-R_X86_64_NONE/foo.c new file mode 100644 index 0000000..7e8b716 --- /dev/null +++ b/tests/bugs/ld_-r-generates-R_X86_64_NONE/foo.c @@ -0,0 +1 @@ +int here, there __attribute__ ((section (".discard"))); diff --git a/tests/bugs/ld_-r-generates-R_X86_64_NONE/main.fmf b/tests/bugs/ld_-r-generates-R_X86_64_NONE/main.fmf new file mode 100644 index 0000000..259c66c --- /dev/null +++ b/tests/bugs/ld_-r-generates-R_X86_64_NONE/main.fmf @@ -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 + +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 diff --git a/tests/bugs/ld_-r-generates-R_X86_64_NONE/module-common.lds b/tests/bugs/ld_-r-generates-R_X86_64_NONE/module-common.lds new file mode 100644 index 0000000..b12ba88 --- /dev/null +++ b/tests/bugs/ld_-r-generates-R_X86_64_NONE/module-common.lds @@ -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) } +} diff --git a/tests/bugs/ld_-r-generates-R_X86_64_NONE/test.sh b/tests/bugs/ld_-r-generates-R_X86_64_NONE/test.sh new file mode 100755 index 0000000..7e484f9 --- /dev/null +++ b/tests/bugs/ld_-r-generates-R_X86_64_NONE/test.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 diff --git a/tests/bugs/libbfd.a-not-compiled-with-fPIC/main.fmf b/tests/bugs/libbfd.a-not-compiled-with-fPIC/main.fmf new file mode 100644 index 0000000..6c56b3e --- /dev/null +++ b/tests/bugs/libbfd.a-not-compiled-with-fPIC/main.fmf @@ -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 + +duration: 5m + +link+: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=430856 diff --git a/tests/bugs/libbfd.a-not-compiled-with-fPIC/reproducer/Makefile b/tests/bugs/libbfd.a-not-compiled-with-fPIC/reproducer/Makefile new file mode 100644 index 0000000..68f126f --- /dev/null +++ b/tests/bugs/libbfd.a-not-compiled-with-fPIC/reproducer/Makefile @@ -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 diff --git a/tests/bugs/libbfd.a-not-compiled-with-fPIC/reproducer/bfdtest.c b/tests/bugs/libbfd.a-not-compiled-with-fPIC/reproducer/bfdtest.c new file mode 100644 index 0000000..cc8038e --- /dev/null +++ b/tests/bugs/libbfd.a-not-compiled-with-fPIC/reproducer/bfdtest.c @@ -0,0 +1,7 @@ +#include "libbfdtest.h" + +int +main (void) +{ + return libbfdtest () ? 0 : 1; +} diff --git a/tests/bugs/libbfd.a-not-compiled-with-fPIC/reproducer/libbfdtest.c b/tests/bugs/libbfd.a-not-compiled-with-fPIC/reproducer/libbfdtest.c new file mode 100644 index 0000000..b3ec8fe --- /dev/null +++ b/tests/bugs/libbfd.a-not-compiled-with-fPIC/reproducer/libbfdtest.c @@ -0,0 +1,10 @@ +#include + +#include "libbfdtest.h" + +int +libbfdtest (void) +{ + bfd_set_error (bfd_error_no_error); + return bfd_get_error () == bfd_error_no_error; +} diff --git a/tests/bugs/libbfd.a-not-compiled-with-fPIC/reproducer/libbfdtest.h b/tests/bugs/libbfd.a-not-compiled-with-fPIC/reproducer/libbfdtest.h new file mode 100644 index 0000000..f67d25b --- /dev/null +++ b/tests/bugs/libbfd.a-not-compiled-with-fPIC/reproducer/libbfdtest.h @@ -0,0 +1 @@ +extern int libbfdtest (void); diff --git a/tests/bugs/libbfd.a-not-compiled-with-fPIC/test.sh b/tests/bugs/libbfd.a-not-compiled-with-fPIC/test.sh new file mode 100755 index 0000000..5d1e842 --- /dev/null +++ b/tests/bugs/libbfd.a-not-compiled-with-fPIC/test.sh @@ -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 diff --git a/tests/bugs/man-page-for-c-filt-contains-unsupported-options/main.fmf b/tests/bugs/man-page-for-c-filt-contains-unsupported-options/main.fmf new file mode 100644 index 0000000..7b2399d --- /dev/null +++ b/tests/bugs/man-page-for-c-filt-contains-unsupported-options/main.fmf @@ -0,0 +1,9 @@ +summary: Checks c++filt + +contact+: + - Michal Nowak + +duration: 5m + +link: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=495196 diff --git a/tests/bugs/man-page-for-c-filt-contains-unsupported-options/test.sh b/tests/bugs/man-page-for-c-filt-contains-unsupported-options/test.sh new file mode 100755 index 0000000..a3873b5 --- /dev/null +++ b/tests/bugs/man-page-for-c-filt-contains-unsupported-options/test.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 diff --git a/tests/bugs/output-of-strings-0-n-is-incorrect/main.fmf b/tests/bugs/output-of-strings-0-n-is-incorrect/main.fmf new file mode 100644 index 0000000..fa7dc54 --- /dev/null +++ b/tests/bugs/output-of-strings-0-n-is-incorrect/main.fmf @@ -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 + +duration: 5m + +link+: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=435078 diff --git a/tests/bugs/output-of-strings-0-n-is-incorrect/test.sh b/tests/bugs/output-of-strings-0-n-is-incorrect/test.sh new file mode 100755 index 0000000..992b8db --- /dev/null +++ b/tests/bugs/output-of-strings-0-n-is-incorrect/test.sh @@ -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 diff --git a/tests/bugs/programs-linked-with-gcc-static-s-fail-with-unexpected-reloc-type-in-static-binary/hello-unexpected-reloc-type.c b/tests/bugs/programs-linked-with-gcc-static-s-fail-with-unexpected-reloc-type-in-static-binary/hello-unexpected-reloc-type.c new file mode 100644 index 0000000..e7d11ba --- /dev/null +++ b/tests/bugs/programs-linked-with-gcc-static-s-fail-with-unexpected-reloc-type-in-static-binary/hello-unexpected-reloc-type.c @@ -0,0 +1,5 @@ +#include +int main() { + fprintf(stderr, "Hello world\n"); + return 0; +} diff --git a/tests/bugs/programs-linked-with-gcc-static-s-fail-with-unexpected-reloc-type-in-static-binary/main.fmf b/tests/bugs/programs-linked-with-gcc-static-s-fail-with-unexpected-reloc-type-in-static-binary/main.fmf new file mode 100644 index 0000000..840bc1a --- /dev/null +++ b/tests/bugs/programs-linked-with-gcc-static-s-fail-with-unexpected-reloc-type-in-static-binary/main.fmf @@ -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 + +require+: + - glibc-static + +environment+: + REQUIRES: "glibc-static" + +duration: 5m + +link: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=533321 diff --git a/tests/bugs/programs-linked-with-gcc-static-s-fail-with-unexpected-reloc-type-in-static-binary/test.sh b/tests/bugs/programs-linked-with-gcc-static-s-fail-with-unexpected-reloc-type-in-static-binary/test.sh new file mode 100755 index 0000000..8359a50 --- /dev/null +++ b/tests/bugs/programs-linked-with-gcc-static-s-fail-with-unexpected-reloc-type-in-static-binary/test.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 diff --git a/tests/bugs/when-mistaking-argument-of-strings/main.fmf b/tests/bugs/when-mistaking-argument-of-strings/main.fmf new file mode 100644 index 0000000..2e16227 --- /dev/null +++ b/tests/bugs/when-mistaking-argument-of-strings/main.fmf @@ -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 + +duration: 5m + +link: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=480009 diff --git a/tests/bugs/when-mistaking-argument-of-strings/test.sh b/tests/bugs/when-mistaking-argument-of-strings/test.sh new file mode 100755 index 0000000..5dd4033 --- /dev/null +++ b/tests/bugs/when-mistaking-argument-of-strings/test.sh @@ -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 . +# +# Author: Michal Nowak + +# 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 diff --git a/tests/lib.sh b/tests/lib.sh index d8ffe1f..9c75473 100644 --- a/tests/lib.sh +++ b/tests/lib.sh @@ -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 diff --git a/tests/main.fmf b/tests/main.fmf index 9305474..ec37c71 100644 --- a/tests/main.fmf +++ b/tests/main.fmf @@ -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 diff --git a/tests/supported-targets/test.sh b/tests/supported-targets/test.sh index e73a2e1..75c4f9f 100755 --- a/tests/supported-targets/test.sh +++ b/tests/supported-targets/test.sh @@ -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