diff --git a/tests/bugs/Bogus-warning-about-cross-object-references-to/main.fmf b/tests/bugs/Bogus-warning-about-cross-object-references-to/main.fmf new file mode 100644 index 0000000..bc1f029 --- /dev/null +++ b/tests/bugs/Bogus-warning-about-cross-object-references-to/main.fmf @@ -0,0 +1,13 @@ +summary: Bogus warning about cross object references to + +description: | + Bogus warning about cross object references to hidden symbols in GOLD + +duration: 15m + +link+: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=895241 + +adjust+: + - when: arch != x86_64 + enabled: false 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 new file mode 100644 index 0000000..01c050d --- /dev/null +++ b/tests/bugs/Bogus-warning-about-cross-object-references-to/t.c @@ -0,0 +1,16 @@ +#include +#include + +void foo(void) __attribute__((visibility("hidden"))); +void foo(void) { + puts("In executable: foo - before forwarding to DSO"); + ((void(*)(void))dlsym(RTLD_DEFAULT,"foo"))(); + puts("In executable: foo - after forwarding to DSO"); +} + +void bar(void); + +int main() { + foo(); + bar(); +} diff --git a/tests/bugs/Bogus-warning-about-cross-object-references-to/test.sh b/tests/bugs/Bogus-warning-about-cross-object-references-to/test.sh new file mode 100755 index 0000000..526167f --- /dev/null +++ b/tests/bugs/Bogus-warning-about-cross-object-references-to/test.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/binutils/Regression/bz895241-Bogus-warning-about-cross-object-references-to +# Description: Test for BZ#895241 (Bogus warning about cross object references to) +# 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. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +. "$TMT_TREE/tests/lib.sh" || exit 1 + +ALTERNATIVES_ROOT="${ALTERNATIVES_ROOT:-}" + +rlJournalStart + rlPhaseStartSetup + buTestHeader + buEnterTmpDir + buCopyReproducers "t.c u.c v.c" + + rlRun "alternatives --altdir $ALTERNATIVES_ROOT/etc/alternatives/ --admindir $ALTERNATIVES_ROOT/var/lib/alternatives/ --display ld" + rlRun "alternatives --altdir $ALTERNATIVES_ROOT/etc/alternatives/ --admindir $ALTERNATIVES_ROOT/var/lib/alternatives/ --set ld $ALTERNATIVES_ROOT/usr/bin/ld.gold" + rlRun "alternatives --altdir $ALTERNATIVES_ROOT/etc/alternatives/ --admindir $ALTERNATIVES_ROOT/var/lib/alternatives/ --display ld" + rlPhaseEnd + + rlPhaseStartTest + rlRun "gcc v.c -fPIC -shared -olibv.so" + rlRun "gcc u.c -fPIC -shared -olibu.so" + rlRun "gcc t.c -D_GNU_SOURCE -L. -lu -lv -ldl -Wl,-rpath,`pwd` &> out" + rlLogInfo "$(cat out)" + rlAssertNotGrep "warning: hidden symbol .* is referenced" out + rlRun "./a.out" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "alternatives --altdir $ALTERNATIVES_ROOT/etc/alternatives/ --admindir $ALTERNATIVES_ROOT/var/lib/alternatives/ --auto ld" + rlRun "alternatives --altdir $ALTERNATIVES_ROOT/etc/alternatives/ --admindir $ALTERNATIVES_ROOT/var/lib/alternatives/ --display ld" + + buExitTmpDir + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/bugs/Bogus-warning-about-cross-object-references-to/u.c b/tests/bugs/Bogus-warning-about-cross-object-references-to/u.c new file mode 100644 index 0000000..b4bdcff --- /dev/null +++ b/tests/bugs/Bogus-warning-about-cross-object-references-to/u.c @@ -0,0 +1,7 @@ +#include + +void foo(void); +void bar(void) { + puts("In DSO: bar"); + foo(); +} diff --git a/tests/bugs/Bogus-warning-about-cross-object-references-to/v.c b/tests/bugs/Bogus-warning-about-cross-object-references-to/v.c new file mode 100644 index 0000000..0576bde --- /dev/null +++ b/tests/bugs/Bogus-warning-about-cross-object-references-to/v.c @@ -0,0 +1,5 @@ +#include + +void foo(void) { + puts("In DSO: foo"); +} diff --git a/tests/bugs/PIE-thread-produce-text-relocations-on-s390-x/main.fmf b/tests/bugs/PIE-thread-produce-text-relocations-on-s390-x/main.fmf new file mode 100644 index 0000000..fbe2134 --- /dev/null +++ b/tests/bugs/PIE-thread-produce-text-relocations-on-s390-x/main.fmf @@ -0,0 +1,22 @@ +summary: "PIE + __thread produce text relocations on s390(x)" + +description: | + Requires systemd without a workaround: + + # PIE is broken on s390 (#868839, #872148) + %ifnarch s390 s390x + %global _hardened_build 1 + %endif + + ^^ this is a workaround that makes bug disappear for this particular reproducer. + So, fetch systemd srpm, comment this condition out, rebuild, install, reboot, then + you can run this tests. One day I may make this part automatic but replacing systemd + wouldn't be seen as a good behaviour by other tests run after this task, so not yet. + +duration: 15m + +link+: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=872148 + +require+: + - elfutils diff --git a/tests/bugs/PIE-thread-produce-text-relocations-on-s390-x/reproducer6.c b/tests/bugs/PIE-thread-produce-text-relocations-on-s390-x/reproducer6.c new file mode 100644 index 0000000..29f574e --- /dev/null +++ b/tests/bugs/PIE-thread-produce-text-relocations-on-s390-x/reproducer6.c @@ -0,0 +1,20 @@ +/* + This reproducer is taken from https://sourceware.org/bugzilla/show_bug.cgi?id=6443 + Author is Jakub Jelinek + + gcc -O2 -pie -fpie -o reproducer6 reproducer6.c + eu-readelf -d reproducer6 | grep TEXTREL + test $? -eq 0 && echo FAIL || echo PASS +*/ + +__thread int a; +__thread int b __attribute((tls_model ("local-exec"))); +__thread int c __attribute((tls_model ("initial-exec"))); +__thread int d __attribute((tls_model ("local-dynamic"))); +__thread int e __attribute((tls_model ("global-dynamic"))); + +int +main (void) +{ + return a + b + c + d + e; +} diff --git a/tests/bugs/PIE-thread-produce-text-relocations-on-s390-x/test.sh b/tests/bugs/PIE-thread-produce-text-relocations-on-s390-x/test.sh new file mode 100755 index 0000000..428faad --- /dev/null +++ b/tests/bugs/PIE-thread-produce-text-relocations-on-s390-x/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/Regression/bz872148-PIE-thread-produce-text-relocations-on-s390-x +# Description: Test for BZ#872148 (PIE + __thread produce text relocations on s390(x)) +# 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 reproducer6.c + rlPhaseEnd + + rlPhaseStartTest + rlRun "gcc -O2 -pie -fpie -o reproducer6 reproducer6.c" + rlRun "eu-readelf -d reproducer6 > elfutils.log" + rlRun "readelf -d reproducer6 > binutils.log" + rlAssertNotGrep "TEXTREL" binutils.log + rlAssertNotGrep "TEXTREL" elfutils.log + rlPhaseEnd + + rlPhaseStartCleanup + buExitTmpDir + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/bugs/TLS-variable-wrongly-relocated-on-debug-info/ld-fail.c b/tests/bugs/TLS-variable-wrongly-relocated-on-debug-info/ld-fail.c new file mode 100644 index 0000000..8dcc1eb --- /dev/null +++ b/tests/bugs/TLS-variable-wrongly-relocated-on-debug-info/ld-fail.c @@ -0,0 +1,8 @@ +#include + +__thread const char *tls_var = "hello"; + +int main () +{ + return 0; +} diff --git a/tests/bugs/TLS-variable-wrongly-relocated-on-debug-info/main.fmf b/tests/bugs/TLS-variable-wrongly-relocated-on-debug-info/main.fmf new file mode 100644 index 0000000..c8f3b18 --- /dev/null +++ b/tests/bugs/TLS-variable-wrongly-relocated-on-debug-info/main.fmf @@ -0,0 +1,28 @@ +summary: TLS variable wrongly relocated on .debug_info + +duration: 5m + +link+: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=959422 + +require+: + - gdb + +adjust+: + - when: collection == gcc-toolset-13 + require+: + - gcc-toolset-13-gdb + environment+: + REQUIRES: gcc-toolset-13-gdb + + - when: collection == gcc-toolset-12 + require+: + - gcc-toolset-12-gdb + environment+: + REQUIRES: gcc-toolset-12-gdb + + - when: collection == gcc-toolset-11 + require+: + - gcc-toolset-11-gdb + environment+: + REQUIRES: gcc-toolset-11-gdb diff --git a/tests/bugs/TLS-variable-wrongly-relocated-on-debug-info/test.sh b/tests/bugs/TLS-variable-wrongly-relocated-on-debug-info/test.sh new file mode 100755 index 0000000..e8a270a --- /dev/null +++ b/tests/bugs/TLS-variable-wrongly-relocated-on-debug-info/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 /CoreOS/binutils/Regression/bz959422-TLS-variable-wrongly-relocated-on-debug-info +# Description: Test for BZ#959422 (TLS variable wrongly relocated on .debug_info) +# 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 ld-fail.c + rlPhaseEnd + + rlPhaseStartTest + rlRun "gcc -lpthread -g3 -O0 ld-fail.c -o ld-fail" + rlRun "gdb ./ld-fail -q -ex start -ex 'print tls_var' -ex cont -ex quit &> gdb.log" + rlLogInfo "$(cat gdb.log)" + rlRun "grep -P '\\\$1 = 0x[0-9a-f]{1,16} \"hello\"' gdb.log" + rlPhaseEnd + + 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 new file mode 100644 index 0000000..00e0896 --- /dev/null +++ b/tests/bugs/The-binutils-package-contains-the-windmc-1-manual/main.fmf @@ -0,0 +1,6 @@ +summary: The binutils package contains the windmc(1) manual + +duration: 5m + +link+: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=850832 diff --git a/tests/bugs/The-binutils-package-contains-the-windmc-1-manual/test.sh b/tests/bugs/The-binutils-package-contains-the-windmc-1-manual/test.sh new file mode 100755 index 0000000..0db8a85 --- /dev/null +++ b/tests/bugs/The-binutils-package-contains-the-windmc-1-manual/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 /CoreOS/binutils/Regression/bz850832-The-binutils-package-contains-the-windmc-1-manual +# Description: Test for BZ#850832 (The binutils package contains the windmc(1) manual) +# 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 + rlPhaseEnd + + rlPhaseStartTest + rlRun "rpm -ql $PACKAGES | grep windmc > windmc.txt" 0,1 + rlLogInfo "$(cat windmc.txt)" + rlRun "FILE_CNT=`cat windmc.txt | wc -l`" + if [ "$FILE_CNT" == "1" ]; then + rlFail "Either windmg manpage or binary is present - both options are wrong." + elif [ "$FILE_CNT" == "2" ]; then + rlLogWarning "Both windmc manpage and binary are present - this probably should not happen." + elif [ "$FILE_CNT" == "0" ]; then + rlPass "Windmc manpage nor binary are present" + else + rlLogWarning "Unexpected number of 'windmc' files present in binutils package - broken package/test?" + fi + rlPhaseEnd + + rlPhaseStartCleanup + buExitTmpDir + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/bugs/binutils-contains-empty-man-pages/main.fmf b/tests/bugs/binutils-contains-empty-man-pages/main.fmf new file mode 100644 index 0000000..c543977 --- /dev/null +++ b/tests/bugs/binutils-contains-empty-man-pages/main.fmf @@ -0,0 +1,13 @@ +summary: binutils contains empty man pages + +link+: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=916214 + +contact+: + - Miroslav Franc + +require+: + - man + - man-db + +duration: 30m diff --git a/tests/bugs/binutils-contains-empty-man-pages/test.sh b/tests/bugs/binutils-contains-empty-man-pages/test.sh new file mode 100755 index 0000000..9c319cb --- /dev/null +++ b/tests/bugs/binutils-contains-empty-man-pages/test.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/binutils/Regression/bz916214-binutils-contains-empty-man-pages +# Description: Test for BZ#916214 (binutils contains empty man pages) +# Author: Miroslav Franc +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 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. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +. /usr/share/beakerlib/beakerlib.sh || exit 1 +. "$TMT_TREE/tests/lib.sh" || exit 1 + +rlJournalStart + rlPhaseStartSetup + buTestHeader + buEnterTmpDir + rlPhaseEnd + + rlPhaseStartTest + rpm -qd $PACKAGES | grep 'man' | while read -r m; do + rlLog "$m" + man "$m" | col -b > man.txt + rlRun "[[ $(wc -c > sums.log + done + + rlLog "Do we have enough man pages?" + rlRun "[[ $(wc -l