Restore tests/ sub-directory and use correct sources.

Resolves: #2178963
This commit is contained in:
Nick Clifton 2023-03-20 12:03:19 +00:00
parent 7d63a9f46f
commit 16919e55c8
9 changed files with 189 additions and 39 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ SOURCES/binutils-2.30.tar.xz
SOURCES/standards.info.gz
/binutils-2.30.tar.xz
/standards.info.gz
/binutils-2.19.50.0.1-output-format.sed

View File

@ -1,38 +0,0 @@
# Generate OUTPUT_FORMAT line for .so files from the system linker output.
# Imported from glibc/Makerules.
/ld.*[ ]-E[BL]/b f
/collect.*[ ]-E[BL]/b f
/OUTPUT_FORMAT[^)]*$/{N
s/\n[ ]*/ /
}
t o
: o
s/^.*OUTPUT_FORMAT(\([^,]*\), \1, \1).*$/OUTPUT_FORMAT(\1)/
t q
s/^.*OUTPUT_FORMAT(\([^,]*\), \([^,]*\), \([^,]*\)).*$/\1,\2,\3/
t s
s/^.*OUTPUT_FORMAT(\([^,)]*\).*$)/OUTPUT_FORMAT(\1)/
t q
d
: s
s/"//g
G
s/\n//
s/^\([^,]*\),\([^,]*\),\([^,]*\),B/OUTPUT_FORMAT(\2)/p
s/^\([^,]*\),\([^,]*\),\([^,]*\),L/OUTPUT_FORMAT(\3)/p
s/^\([^,]*\),\([^,]*\),\([^,]*\)/OUTPUT_FORMAT(\1)/p
/,/s|^|*** BUG in libc/scripts/output-format.sed *** |p
q
: q
s/"//g
p
q
: f
s/^.*[ ]-E\([BL]\)[ ].*$/,\1/
t h
s/^.*[ ]-E\([BL]\)$/,\1/
t h
d
: h
h

View File

@ -43,7 +43,7 @@
Summary: A GNU collection of binary utilities
Name: binutils%{?name_cross}%{?_with_debug:-debug}
Version: 2.30
Release: 119%{?dist}
Release: 120%{?dist}
License: GPLv3+
URL: https://sourceware.org/binutils
@ -1319,6 +1319,9 @@ exit 0
#----------------------------------------------------------------------------
%changelog
* Mon Mar 20 2023 Nick Clifton <nickc@redhat.com> - 2.30-120
- Restore tests/ sub-directory and use correct sources. (#2178963)
* Mon Sep 05 2022 Nick Clifton <nickc@redhat.com> - 2.30-119
- NVR Bump in order to allow rebuild now that the rhel-8.8.0-candidate tag is available.

View File

@ -1,2 +1,3 @@
SHA512 (binutils-2.30.tar.xz) = e747ea20d8d79fcd21b9d9f6695059caa7189d60f19256da398e34b789fea9a133c32b192e9693b5828d27683739b0198431bf8b3e39fb3b04884cf89d9aa839
SHA512 (binutils-2.19.50.0.1-output-format.sed) = 2f8686b0c8af13c98cda056824c2820416f6e2d003f70b78ccf5314525b9ee3684d421dfa83e638a2d42d06ea4d4bdaf5226b64d6ec26f7ff59c44ffb2a23dd2
SHA512 (standards.info.gz) = 52452ec58c9b0045abeb1f7fb29d56a62cd4042edbb5e1685dad5f6932731ace2bf05ec238b2e8d3d851114a2718b511dfc721c996bee8721a873314de7c7358

40
tests/test_assembler Normal file
View File

@ -0,0 +1,40 @@
#!/bin/sh
# Checks that as works
. /usr/share/beakerlib/beakerlib.sh
# Set the full test name
TEST="/AppStream/binutils/Sanity/assembler"
# Package being tested
PACKAGE="binutils"
rlJournalStart
# Setup phase: Prepare test directory
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun 'TmpDir=$(mktemp -d)' 0 'Creating tmp directory' # no-reboot
rlRun "pushd $TmpDir"
rlPhaseEnd
# Test phase: Test the assembler
# FIXME: This is way too simplistic. The assembler testsuite does a much
# more thorough job, but that has already been run as part of the binutils
# build process, and besides we do not have access to an unpacked source
# tree here.
rlPhaseStartTest
rlRun "echo nop >nop.s" 0 "Create a test assembler source file"
rlRun "as nop.s -o nop.o" 0 "Assemble the test file"
rlAssertExists "nop.o"
rlPhaseEnd
# Cleanup phase: Remove test directory
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalEnd
# Print the test report
rlJournalPrintText

41
tests/test_bfd_linker Normal file
View File

@ -0,0 +1,41 @@
#!/bin/sh
# Checks that as works
. /usr/share/beakerlib/beakerlib.sh
# Set the full test name
TEST="/AppStream/binutils/Sanity/ld.bfd"
# Package being tested
PACKAGE="binutils"
rlJournalStart
# Setup phase: Prepare test directory
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun 'TmpDir=$(mktemp -d)' 0 'Creating tmp directory' # no-reboot
rlRun "pushd $TmpDir"
rlPhaseEnd
# Test phase: Test the BFD linker
# FIXME: This is way too simplistic. The linker testsuite does a much
# more thorough job, but that has already been run as part of the binutils
# build process, and besides we do not have access to an unpacked source
# tree here.
rlPhaseStartTest
rlRun "echo nop >nop.s" 0 "Create a test assembler source file"
rlRun "as nop.s -o nop.o" 0 "Assemble the test file"
rlRun "ld.bfd -e 0 nop.o -o nop.exe" 0 "Link the test file"
rlAssertExists "nop.exe"
rlPhaseEnd
# Cleanup phase: Remove test directory
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalEnd
# Print the test report
rlJournalPrintText

45
tests/test_binutils Normal file
View File

@ -0,0 +1,45 @@
#!/bin/sh
# Checks that as works
. /usr/share/beakerlib/beakerlib.sh
# Set the full test name
TEST="/AppStream/binutils/Sanity/binutils"
# Package being tested
PACKAGE="binutils"
rlJournalStart
# Setup phase: Prepare test directory
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun 'TmpDir=$(mktemp -d)' 0 'Creating tmp directory' # no-reboot
rlRun "pushd $TmpDir"
rlPhaseEnd
# Test phase: Test the binutils utilities
# FIXME: This is way too simplistic. The binutils testsuite does a much
# more thorough job, but that has already been run as part of the binutils
# build process, and besides we do not have access to an unpacked source
# tree here.
rlPhaseStartTest
rlRun "echo nop >nop.s" 0 "Create a test assembler source file"
rlRun "as nop.s -o nop.o" 0 "Assemble the test file"
rlRun "objdump -D -r -x -W -t nop.o >objdump.out" 0 "Examine the file with objdump"
rlAssertExists "objdump.out"
rlRun "readelf -a -W --wide nop.o >readelf.out" 0 "Examine the file with readelf"
rlAssertExists "readelf.out"
rlRun "nm nop.o >nm.out" 0 "Examine the file with nm"
rlAssertExists "nm.out"
rlPhaseEnd
# Cleanup phase: Remove test directory
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalEnd
# Print the test report
rlJournalPrintText

41
tests/test_gold_linker Normal file
View File

@ -0,0 +1,41 @@
#!/bin/sh
# Checks that as works
. /usr/share/beakerlib/beakerlib.sh
# Set the full test name
TEST="/AppStream/binutils/Sanity/ld.gold"
# Package being tested
PACKAGE="binutils"
rlJournalStart
# Setup phase: Prepare test directory
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun 'TmpDir=$(mktemp -d)' 0 'Creating tmp directory' # no-reboot
rlRun "pushd $TmpDir"
rlPhaseEnd
# Test phase: Test the GOLD linker
# FIXME: This is way too simplistic. The linker testsuite does a much
# more thorough job, but that has already been run as part of the binutils
# build process, and besides we do not have access to an unpacked source
# tree here.
rlPhaseStartTest
rlRun "echo nop >nop.s" 0 "Create a test assembler source file"
rlRun "as nop.s -o nop.o" 0 "Assemble the test file"
rlRun "ld.gold -e 0 nop.o -o nop.exe" 0 "Link the test file"
rlAssertExists "nop.exe"
rlPhaseEnd
# Cleanup phase: Remove test directory
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalEnd
# Print the test report
rlJournalPrintText

16
tests/tests.yml Normal file
View File

@ -0,0 +1,16 @@
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- atomic
- classic
- container
tests:
- test_assembler
- test_bfd_linker
- test_gold_linker
- test_binutils
required_packages:
- findutils # beakerlib needs find command
- binutils # We need it to test it
- gcc # To build some test cases