Porting tests

This commit is contained in:
Miloš Prchlík 2023-09-06 14:47:29 +02:00
commit a1e413563c
20 changed files with 392 additions and 9 deletions

View file

@ -0,0 +1,4 @@
static void fun2(){int i=0;}
void fun1(){int i=0;}
void fun3(){}
int main(){ fun1(); fun2(); return 0;}

View file

@ -0,0 +1,7 @@
summary: "[FJ7.4 Bug] [REG] The results of gprof command"
description: |
[FJ7.4 Bug]: [REG] The results of gprof command with some options differ between RHEL7.4 beta and RHEL7.3.
duration: 5m
link+:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=1465318

View file

@ -0,0 +1,68 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/binutils/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command
# Description: Test for BZ#1465318 ([FJ7.4 Bug] [REG] The results of gprof command)
# Author: Milos Prchlik <mprchlik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2017 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
buEnterTmpDir
buCopyReproducers gprof.file.c
rlRun "gcc -pg -g gprof.file.c -o gprof.file"
rlRun "./gprof.file"
rlAssertExists "gmon.out"
rlPhaseEnd
rlPhaseStartTest
rlRun "gprof -A gprof.file > option-large_A"
rlRun "gprof -C gprof.file > option-large_C"
rlRun "gprof -l gprof.file > option-l"
rlLogInfo "$(cat option-large_A)"
rlLogInfo "$(cat option-large_C)"
rlLogInfo "$(cat option-l)"
rlRun "grep -E '##### -> +void fun3\(\)\{\}' option-large_A"
rlRun "grep -E '1 -> +void fun1\(\)\{int i=0;\}' option-large_A"
rlRun "grep -E 'gprof.file.c:2: \(fun1:0x[0-9a-z]+\) 1 executions' option-large_C"
rlRun "grep -E '0.00 +0.00 +0.00 +1 +0.00 +0.00 +fun1 \(gprof.file.c:2 @ [0-9a-z]+\)' option-l"
rlRun "grep -E '\[1\] +0.0 +0.00 +0.00 +1 +fun1 \(gprof.file.c:2 @ [0-9a-z]+\) \[1\]' option-l"
rlRun "grep -E '\[1\] fun1 \(gprof.file.c:2 @ [0-9a-z]+\) \[2\] fun2 \(gprof.file.c:1 @ [0-9a-z]+\)' option-l"
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,4 @@
int main(int argc, char **argv)
{
return 0;
}

View file

@ -0,0 +1,7 @@
summary: "[LLNL 7.5 FEAT] RFE create an option to"
description: |
[LLNL 7.5 FEAT] RFE create an option to permanently link in audit library into an executable (glibc)
duration: 15m
link+:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=1439350

View file

@ -0,0 +1,56 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/glibc/Regression/bz1439350-LLNL-7-5-FEAT-RFE-create-an-option-to
# Description: Test for BZ#1439350 ([LLNL 7.5 FEAT] RFE create an option to)
# Author: Milos Prchlik <mprchlik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2018 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
buEnterTmpDir
buCopyReproducers main.c
rlPhaseEnd
rlPhaseStartTest
rlRun "gcc -o main main.c -Wl,-Paudit.so.1 -z globalaudit &> gcc.out"
rlLogInfo "$(cat gcc.out)"
rlRun "egrep 'globalaudit ignored' gcc.out" 1
rlRun "readelf -d main | grep AUDIT &> readelf.out"
rlLogInfo "$(cat readelf.out)"
rlRun "egrep 'Dependency audit library: \[audit.so.1\]' readelf.out"
rlRun "egrep 'Flags: GLOBAUDIT' readelf.out"
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,7 @@
summary: Rust TLS accesses are badly initialized
description: |
Rust TLS accesses are badly initialized
duration: 15m
link+:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=1433075

View file

@ -0,0 +1,13 @@
#include <stdlib.h>
#include <stdio.h>
static __thread int a;
static int *c;
int main(int argc, char *argv[])
{
a = 2;
c = &a;
printf("c=%d\n", *c);
return 0;
}

View file

@ -0,0 +1,60 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/binutils/Regression/bz1433075-Rust-TLS-accesses-are-badly-initialized
# Description: Test for BZ#1433075 (Rust TLS accesses are badly initialized)
# Author: Milos Prchlik <mprchlik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2017 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
buEnterTmpDir
buCopyReproducers repr.c
rlPhaseEnd
rlPhaseStartTest
rlRun "gcc -o repr1 -fPIC repr.c"
rlRun "./repr1"
rlRun "gcc -o repr2 -fPIC -pie repr.c"
rlRun "./repr2"
rlRun "gcc -o repr3 -ftls-model=local-dynamic -fPIC repr.c"
rlRun "./repr3"
rlRun "gcc -o repr4 -ftls-model=local-dynamic -fPIC -pie repr.c"
rlRun "./repr4"
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,14 @@
summary: binutils ld removes some R_X86_64_JUMP_SLOT
description: |
ld removes some R_X86_64_JUMP_SLOT relocations
contact:
- Milos Prchlik <mprchlik@redhat.com>
- Edjunior Machado <emachado@redhat.com>
duration: 5m
# Configurable fields
recommend:
- sed
link+:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=1624776

View file

@ -0,0 +1,3 @@
.text
mov malloc@GOTPCREL(%rip), %rax
jmp malloc@plt

View file

@ -0,0 +1,59 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/binutils/Regression/bz1624776-binutils-ld-removes-some-R-X86-64-JUMP-SLOT
# Description: Test for BZ#1624776 (binutils ld removes some R_X86_64_JUMP_SLOT)
# Author: Edjunior Machado <emachado@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2018 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
buEnterTmpDir
buCopyReproducers reloc.s
rlPhaseEnd
rlPhaseStartTest
rlRun "as -o reloc.o reloc.s"
rlAssertExists "reloc.o"
rlRun "ld -o reloc.so -shared reloc.o"
rlAssertExists "reloc.so"
# Conserve the non-zero return value through the pipe
set -o pipefail
rlRun "readelf -rW reloc.so |& tee readelf.out" 0 "Checking out reloc.so relocation section"
rlRun "sed -n '/.rela.dyn/,/^$/p' readelf.out | grep R_X86_64_GLOB_DAT" 0 "Relocation section .rela.dyn should contain R_X86_64_GLOB_DAT entry"
rlRun "sed -n '/.rela.plt/,/^$/p' readelf.out | grep R_X86_64_JUMP_SLOT" 0 "Relocation section .rela.plt should contain R_X86_64_JUMP_SLOT entry"
rlFileSubmit readelf.out
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -1,7 +1,6 @@
summary: Test for BZ#1785294 (binutils support secondary relocation sections)
summary: binutils support secondary relocation sections
description: |
Bug summary: binutils: support secondary relocation sections [rhel 7.9]
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1785294
support secondary relocation sections
contact:
- Milos Prchlik <mprchlik@redhat.com>
- Edjunior Machado <emachado@redhat.com>

View file

@ -35,10 +35,9 @@ rlJournalStart
rlPhaseStartSetup
buTestHeader
testdir="$(pwd)"
buEnterTmpDir
rlRun "cp -v $testdir/w.c $TmpDir"
buCopyReproducers w.c
rlPhaseEnd
rlPhaseStartTest

View file

@ -0,0 +1,8 @@
summary: "ld should allow 'lea foo@GOT, %ecx'"
description: |
ld should allow "lea foo@GOT, %ecx"
duration: 15m
# Configurable fields
link+:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=1573872

View file

@ -0,0 +1,17 @@
.text
.globl bar
.type bar, @function
bar:
call __x86.get_pc_thunk.ax
addl $_GLOBAL_OFFSET_TABLE_, %eax
lea foo@GOT, %ecx
mov (%eax,%ecx,1), %eax
ret
.section .text.__x86.get_pc_thunk.ax,"axG",@progbits,__x86.get_pc_thunk.ax,comdat
.globl __x86.get_pc_thunk.ax
.hidden __x86.get_pc_thunk.ax
.type __x86.get_pc_thunk.ax, @function
__x86.get_pc_thunk.ax:
movl (%esp), %eax
ret
.section .note.GNU-stack,"",@progbits

View file

@ -0,0 +1,51 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/binutils/Regression/bz1573872-ld-should-allow-lea-foo-GOT-ecx
# Description: Test for BZ#1573872 (ld should allow "lea foo@GOT, %ecx")
# Author: Milos Prchlik <mprchlik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2018 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
buEnterTmpDir
buCopyReproducers reproducer.S
rlPhaseEnd
rlPhaseStartTest
rlRun "gcc -B./ -m32 -c -o reproducer.o reproducer.S"
rlRun "ld -melf_i386 -shared -o libx.so reproducer.o"
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -34,10 +34,9 @@ rlJournalStart
rlPhaseStartSetup
buTestHeader
testdir="$(pwd)"
buEnterTmpDir
rlRun "cp -v $testdir/main.c $testdir/foo.c $TmpDir"
buCopyReproducers "main.c foo.c"
rlPhaseEnd
rlPhaseStartTest

View file

@ -62,11 +62,10 @@ rlJournalStart
rlLogInfo "SIZE=$SIZE"
rlLogInfo "STRINGS=$STRINGS"
testdir="$(pwd)"
buEnterTmpDir
# Copy the GDB commands file and testcase.
rlRun "cp -v $testdir/check-localplt.c $testdir/m.c $testdir/popcnt.c $testdir/virtual2.C $TmpDir"
buCopyReproducers "check-localplt.c m.c popcnt.c virtual2.C"
rlPhaseEnd
rlPhaseStartTest "Prepare a DTS binary."

View file

@ -5,6 +5,8 @@
BU_TMPDIR_PARENT="${BU_TMPDIR_PARENT:-/tmp}"
BU_TEST_USER="${BU_TEST_USER:-buUser}"
BU_SOURCE_DIR="${BU_SOURCE_DIR:-$(pwd)}"
function buEnterTestUser () {
username="${1:-$BU_TEST_USER}"
@ -119,3 +121,10 @@ function buBuildSRPM () {
rlRun " rpmbuild -bb --define=\"_topdir $TmpDir\" $SPECFILE"
fi
}
function buCopyReproducers () {
for filename in $1; do
rlRun "cp $BU_SOURCE_DIR/$filename $TmpDir/"
done
}