From 16919e55c8fe599dc988b3a2b4b83eb1706185da Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 20 Mar 2023 12:03:19 +0000 Subject: [PATCH] Restore tests/ sub-directory and use correct sources. Resolves: #2178963 --- .gitignore | 1 + binutils-2.19.50.0.1-output-format.sed | 38 ---------------------- binutils.spec | 5 ++- sources | 1 + tests/test_assembler | 40 +++++++++++++++++++++++ tests/test_bfd_linker | 41 +++++++++++++++++++++++ tests/test_binutils | 45 ++++++++++++++++++++++++++ tests/test_gold_linker | 41 +++++++++++++++++++++++ tests/tests.yml | 16 +++++++++ 9 files changed, 189 insertions(+), 39 deletions(-) delete mode 100644 binutils-2.19.50.0.1-output-format.sed create mode 100644 tests/test_assembler create mode 100644 tests/test_bfd_linker create mode 100644 tests/test_binutils create mode 100644 tests/test_gold_linker create mode 100644 tests/tests.yml diff --git a/.gitignore b/.gitignore index e2a85e5..3e680ac 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/binutils-2.19.50.0.1-output-format.sed b/binutils-2.19.50.0.1-output-format.sed deleted file mode 100644 index fd770cb..0000000 --- a/binutils-2.19.50.0.1-output-format.sed +++ /dev/null @@ -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 diff --git a/binutils.spec b/binutils.spec index 4134250..5e74b3e 100644 --- a/binutils.spec +++ b/binutils.spec @@ -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 - 2.30-120 +- Restore tests/ sub-directory and use correct sources. (#2178963) + * Mon Sep 05 2022 Nick Clifton - 2.30-119 - NVR Bump in order to allow rebuild now that the rhel-8.8.0-candidate tag is available. diff --git a/sources b/sources index a4a9bf0..86d0b1e 100644 --- a/sources +++ b/sources @@ -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 diff --git a/tests/test_assembler b/tests/test_assembler new file mode 100644 index 0000000..da7cbb8 --- /dev/null +++ b/tests/test_assembler @@ -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 diff --git a/tests/test_bfd_linker b/tests/test_bfd_linker new file mode 100644 index 0000000..7aac51c --- /dev/null +++ b/tests/test_bfd_linker @@ -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 diff --git a/tests/test_binutils b/tests/test_binutils new file mode 100644 index 0000000..a51e2de --- /dev/null +++ b/tests/test_binutils @@ -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 diff --git a/tests/test_gold_linker b/tests/test_gold_linker new file mode 100644 index 0000000..3560be5 --- /dev/null +++ b/tests/test_gold_linker @@ -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 diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..b55a22d --- /dev/null +++ b/tests/tests.yml @@ -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