From 80ee2b7248d54575f497edfc45fabddea61d129f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Prchl=C3=ADk?= Date: Fri, 26 Jan 2024 13:43:19 +0100 Subject: [PATCH] Update and fix based on recent gcc-toolset-13 regression runs --- .../main.fmf | 8 ++++++++ .../test.sh | 18 +++++++++++++----- tests/dts-probe-binaries/main.fmf | 8 ++++++++ tests/dts-probe-binaries/test.sh | 13 ++++++++++--- tests/lib.sh | 1 + tests/main.fmf | 15 +++++++++++++++ 6 files changed, 55 insertions(+), 8 deletions(-) diff --git a/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/main.fmf b/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/main.fmf index c4202d8..52b9682 100644 --- a/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/main.fmf +++ b/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/main.fmf @@ -7,3 +7,11 @@ contact+: link+: - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=241252 + +environment+: + DWARF5: "yes" + +adjust+: + - when: distro == rhel-8 and collection == gcc-toolset-13 + environment+: + DWARF5: "no" diff --git a/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/test.sh b/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/test.sh index b9e4187..3071505 100755 --- a/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/test.sh +++ b/tests/bugs/Add-.debug_pubtypes-and-.debug_ranges-to-builtin-ld-linker-script/test.sh @@ -28,8 +28,15 @@ rlJournalStart rlPhaseStartSetup buTestHeader + rlLogInfo "DWARF5=$DWARF5" buEnterTmpDir buCopyReproducers "x.i y.i" + + if [ "$DWARF5" = "yes" ]; then + rlRun "SECTION_NAME=debug_rnglists" + else + rlRun "SECTION_NAME=debug_ranges" + fi rlPhaseEnd rlPhaseStartTest @@ -37,14 +44,15 @@ rlJournalStart rlRun "gcc -c -O2 -fpic -o y.o y.i -g" 0 "Compile test case 'y'" rlRun "gcc -Wl,--unique -o x [xy].o" 0 "Link 'x' and 'y'" - # Note: debug_ranges replaced by debug_rnglist (since DWARF 5 in Fedora 34) rlLogInfo 'x.o + y.o:' - rlLogInfo "$( readelf -WS [xy].o | grep debug_rnglist | grep PROGBITS )" + rlRun "readelf -WS [xy].o" + rlRun "readelf -WS x" + rlLogInfo "$( readelf -WS [xy].o | grep $SECTION_NAME | grep PROGBITS )" rlLogInfo 'x:' - rlLogInfo "$( readelf -WS x | grep debug_rnglist )" + rlLogInfo "$( readelf -WS x | grep $SECTION_NAME )" - if [ $( readelf -WS [xy].o | grep debug_rnglist | grep PROGBITS | wc -l ) -eq 2 ] \ - && [ $( readelf -WS x | grep debug_rnglist | wc -l ) -eq 1 ]; then + if [ $( readelf -WS [xy].o | grep $SECTION_NAME | grep PROGBITS | wc -l ) -eq 2 ] \ + && [ $( readelf -WS x | grep $SECTION_NAME | wc -l ) -eq 1 ]; then rlPass "Debug ranges sections were merged" else rlFail "Debug ranges sections were not merged" diff --git a/tests/dts-probe-binaries/main.fmf b/tests/dts-probe-binaries/main.fmf index 53bc93d..ca9e208 100644 --- a/tests/dts-probe-binaries/main.fmf +++ b/tests/dts-probe-binaries/main.fmf @@ -24,6 +24,14 @@ require+: environment+: REQUIRES: "binutils gcc gcc-c++ glibc gdb" + # Older format of undefined symbols, the second `@` has been dropped in + # https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=3f2e9699234ca31d083bc93ea6e03903f10baeaf + LEGACY_UNDEFINED_SYMBOLS: "no" + adjust+: - when: collection is not defined enabled: false + + - when: distro == rhel-8 and collection == gcc-toolset-13 + environment+: + LEGACY_UNDEFINED_SYMBOLS: "yes" diff --git a/tests/dts-probe-binaries/test.sh b/tests/dts-probe-binaries/test.sh index 6b4c997..f2a12ef 100755 --- a/tests/dts-probe-binaries/test.sh +++ b/tests/dts-probe-binaries/test.sh @@ -61,6 +61,7 @@ rlJournalStart rlLogInfo "READELF=$READELF" rlLogInfo "SIZE=$SIZE" rlLogInfo "STRINGS=$STRINGS" + rlLogInfo "LEGACY_UNDEFINED_SYMBOLS=$LEGACY_UNDEFINED_SYMBOLS" buEnterTmpDir @@ -184,7 +185,7 @@ fi rlAssertGrep "virtual2.C" o fi rlAssertGrep "_ZN1BD1Ev" o - if [ "$COLLECTIONS" != "devtoolset-11" ]; then + if [ "$TOOLSET" != "devtoolset-11" ]; then rlAssertGrep ".dynstr" o fi # On PPC, we have .toc instead. @@ -196,8 +197,14 @@ fi if [ "`rlGetPrimaryArch`" != "ppc64" ] || [ ! rlIsRHEL 7 ]; then rlAssertGrep "__gmon_start__" u fi - rlAssertGrep "printf@GLIBC" u - rlAssertGrep "__libc_start_main@GLIBC" u + # Older format, the second `@` has been dropped in https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=3f2e9699234ca31d083bc93ea6e03903f10baeaf + if [ "$LEGACY_UNDEFINED_SYMBOLS" = "yes" ]; then + rlAssertGrep "printf@@GLIBC" u + rlAssertGrep "__libc_start_main@@GLIBC" u + else + rlAssertGrep "printf@GLIBC" u + rlAssertGrep "__libc_start_main@GLIBC" u + fi # Try -P --size-sort. rlRun "nm -P --size-sort localplt > p" if test $(uname -m) = "ppc64" -a $(rlGetDistroRelease) -gt 5; then diff --git a/tests/lib.sh b/tests/lib.sh index 9c75473..30e15bd 100644 --- a/tests/lib.sh +++ b/tests/lib.sh @@ -34,6 +34,7 @@ function buTestHeader () { rlLogInfo "PACKAGES=$PACKAGES" rlLogInfo "REQUIRES=$REQUIRES" rlLogInfo "COLLECTIONS=$COLLECTIONS" + rlLogInfo "TOOLSET=$TOOLSET" rlLogInfo "COLLECTION_PACKAGES=$COLLECTION_PACKAGES" rlLogInfo "LD=$_LD" rlLogInfo "GCC=$_GCC" diff --git a/tests/main.fmf b/tests/main.fmf index 93cf80c..3ede59e 100644 --- a/tests/main.fmf +++ b/tests/main.fmf @@ -65,7 +65,12 @@ adjust+: # Environments: # # * `PACKAGES` shall be only `binutils` or its collection variant and nothing else + # * `TOOLSET` shall be either the collection name when testing a collection build, + # or left unset. Note that `COLLECTIONS` is left unset completely, it's not used + # by any test # * `_REQUIRES` lists the default requirements - `gcc`, `gcc-c++` and so on + # * `WITH_SCL` shall be set to `scl enable ...` command to enable the collection before + # running the test script itself, or left unset for non-collection environments # * `BINUTILS_PACKAGE`, `GCC_PACKAGE` list packages providing active binutils and gcc # in the test environment. `BINUTILS_PACKAGE` is usually the same as `PACKAGES` but # but complements `GCC_PACKAGE` @@ -100,6 +105,7 @@ adjust+: - gcc-toolset-13-gcc-plugin-annobin environment+: PACKAGES: gcc-toolset-13-binutils + TOOLSET: gcc-toolset-13 _REQUIRES: gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ gcc-toolset-13-gcc-plugin-annobin glibc WITH_SCL: scl enable gcc-toolset-13 BINUTILS_PACKAGE: gcc-toolset-13-binutils @@ -117,6 +123,7 @@ adjust+: - gcc-toolset-12-gcc-plugin-annobin environment+: PACKAGES: gcc-toolset-12-binutils + TOOLSET: gcc-toolset-12 _REQUIRES: gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-gcc-plugin-annobin glibc WITH_SCL: scl enable gcc-toolset-12 BINUTILS_PACKAGE: gcc-toolset-12-binutils @@ -153,6 +160,7 @@ adjust+: - gcc-toolset-13-gcc-plugin-annobin environment+: PACKAGES: gcc-toolset-13-binutils + TOOLSET: gcc-toolset-13 _REQUIRES: gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ gcc-toolset-13-gcc-plugin-annobin glibc WITH_SCL: scl enable gcc-toolset-13 BINUTILS_PACKAGE: gcc-toolset-13-binutils @@ -169,6 +177,7 @@ adjust+: - gcc-toolset-13-gcc-plugin-annobin environment+: PACKAGES: gcc-toolset-13-binutils + TOOLSET: gcc-toolset-13 _REQUIRES: gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ gcc-toolset-13-gcc-plugin-annobin glibc WITH_SCL: scl enable gcc-toolset-13 BINUTILS_PACKAGE: gcc-toolset-13-binutils @@ -187,6 +196,7 @@ adjust+: - gcc-toolset-12-annobin-plugin-gcc environment+: PACKAGES: gcc-toolset-12-binutils + TOOLSET: gcc-toolset-12 _REQUIRES: gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-gcc-plugin-annobin gcc-toolset-12-annobin-plugin-gcc glibc WITH_SCL: scl enable gcc-toolset-12 BINUTILS_PACKAGE: gcc-toolset-12-binutils @@ -221,6 +231,7 @@ adjust+: - devtoolset-13-gcc-c++ environment+: PACKAGES: devtoolset-13-binutils + TOOLSET: devtoolset-13 _REQUIRES: devtoolset-13-gcc devtoolset-13-gcc-c++ glibc WITH_SCL: scl enable devtoolset-13 BINUTILS_PACKAGE: devtoolset-13-binutils @@ -258,6 +269,7 @@ adjust+: - gcc-toolset-13-gcc-plugin-annobin environment+: PACKAGES: gcc-toolset-13-binutils + TOOLSET: gcc-toolset-13 _REQUIRES: gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ gcc-toolset-13-gcc-plugin-annobin glibc WITH_SCL: scl enable gcc-toolset-13 BINUTILS_PACKAGE: gcc-toolset-13-binutils @@ -294,6 +306,7 @@ adjust+: - gcc-toolset-13-gcc-plugin-annobin environment+: PACKAGES: gcc-toolset-13-binutils + TOOLSET: gcc-toolset-13 _REQUIRES: gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ gcc-toolset-13-gcc-plugin-annobin glibc WITH_SCL: scl enable gcc-toolset-13 BINUTILS_PACKAGE: gcc-toolset-13-binutils @@ -310,6 +323,7 @@ adjust+: - gcc-toolset-13-gcc-plugin-annobin environment+: PACKAGES: gcc-toolset-13-binutils + TOOLSET: gcc-toolset-13 _REQUIRES: gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ gcc-toolset-13-gcc-plugin-annobin glibc WITH_SCL: scl enable gcc-toolset-13 BINUTILS_PACKAGE: gcc-toolset-13-binutils @@ -328,6 +342,7 @@ adjust+: - gcc-toolset-12-annobin-plugin-gcc environment+: PACKAGES: gcc-toolset-12-binutils + TOOLSET: gcc-toolset-12 _REQUIRES: gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-gcc-plugin-annobin gcc-toolset-12-annobin-plugin-gcc glibc WITH_SCL: scl enable gcc-toolset-12 BINUTILS_PACKAGE: gcc-toolset-12-binutils