Porting tests

This commit is contained in:
Miloš Prchlík 2023-10-13 14:22:57 +02:00
commit 1fc77a5fc1
15 changed files with 431 additions and 0 deletions

View file

@ -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

View file

@ -0,0 +1,16 @@
#include <stdio.h>
#include <dlfcn.h>
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();
}

View file

@ -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 <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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
. /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

View file

@ -0,0 +1,7 @@
#include <stdio.h>
void foo(void);
void bar(void) {
puts("In DSO: bar");
foo();
}

View file

@ -0,0 +1,5 @@
#include <stdio.h>
void foo(void) {
puts("In DSO: foo");
}

View file

@ -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

View file

@ -0,0 +1,20 @@
/*
This reproducer is taken from https://sourceware.org/bugzilla/show_bug.cgi?id=6443
Author is Jakub Jelinek <jakub@redhat.com>
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;
}

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/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 <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 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

View file

@ -0,0 +1,8 @@
#include <pthread.h>
__thread const char *tls_var = "hello";
int main ()
{
return 0;
}

View file

@ -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

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 /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 <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 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

View file

@ -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

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 /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 <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
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

View file

@ -0,0 +1,13 @@
summary: binutils contains empty man pages
link+:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=916214
contact+:
- Miroslav Franc <mfranc@redhat.com>
require+:
- man
- man-db
duration: 30m

View file

@ -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 <mfranc@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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 <man.txt) -ge 2000 ]]"
rlRun "[[ $(wc -l <man.txt) -ge 50 ]]"
rlAssertGrep NAME man.txt
rlAssertGrep SYNOPSIS man.txt
rlAssertGrep DESCRIPTION man.txt
rlAssertGrep OPTIONS man.txt
rlAssertGrep COPYRIGHT man.txt
rlAssertGrep 'Free Software Foundation' man.txt
rlAssertGrep binutils man.txt
md5sum man.txt >> sums.log
done
rlLog "Do we have enough man pages?"
rlRun "[[ $(wc -l <sums.log) -ge 14 ]]"
rlLog "Are they all different?"
rlRun "[[ $(sort sums.log | uniq | wc -l) -eq $(wc -l <sums.log) ]]"
unset i
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd