Explicit check of prettyprinters

Due to coexistence of system libstdc++ with GCC Toolset (GTS) GCCs
in RHEL and the problem described in RHEL-50290, the prettyprinters
of system libstdc++ will be kept updated to latest GTS GCC.
Therefore some more focused testing of the prettyprinters is desired.
Let's run the upstream prettyprinters tests on installed GCC
explicitly. Should be especially helpful when testing new GTS GCC but
since the test is general enough, we can use it in Fedora for system
GCC.
This commit is contained in:
Václav Kadlčík 2025-03-24 14:44:25 +01:00
commit b37647ab83
3 changed files with 162 additions and 0 deletions

View file

@ -0,0 +1,10 @@
--- ./libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc.orig 2025-03-24 05:44:37.770576897 -0400
+++ ./libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc 2025-03-24 05:44:50.232576897 -0400
@@ -78,7 +78,6 @@
// { dg-final { regexp-test am {std::any containing std::(__debug::)?map with 3 elements = {\[1\] = 2, \[3\] = 4, \[5\] = 6}} } }
struct local_type { int i = 99; };
any al = local_type{};
-// { dg-final { note-test al {std::any containing local_type = {[contained value] = {i = 99}}} } }
struct S { operator int() { throw 42; }};
variant<float, int, string_view> v0;

View file

@ -0,0 +1,36 @@
summary: Run the prettyprinters tests of the upstream testsuite
contact: Vaclav Kadlcik <vkadlcik@redhat.com>
component:
- gcc
enabled: true
test: ${WITH_SCL:-bash} ./runtest.sh
tag:
- NoRHIVOS
framework: beakerlib
require+:
- gcc
- gcc-c++
- rpm-build
- dejagnu
- xz
recommend:
- dnf-utils
- yum-utils
- glibc-devel.i686
- libstdc++-debuginfo
duration: 1h
adjust+:
- enabled: false
when: distro == rhel-9 and distro ~< rhel-9.6
continue: false
- enabled: false
when: distro == rhel-9.6 and collection is not defined
continue: false
- enabled: false
when: distro == rhel-8 and distro ~< rhel-8.10
continue: false
- enabled: false
when: distro < rhel-8
continue: false
extra-summary: /tools/gcc/Sanity/suite_gcc
extra-task: /tools/gcc/Sanity/suite_gcc

View file

@ -0,0 +1,116 @@
#!/usr/bin/env bash
# Load libraries
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "${0%/*}"/../../lib/common.sh || exit 1
GCC="${GCC:-$(type -P gcc)}"
GCC_RPM_NAME=$(rpm --qf '%{name}' -qf "$GCC")
PACKAGES="${GCC_RPM_NAME} ${GCC_RPM_NAME}-c++ rpm-build dejagnu"
print_site_exp () {
echo 'set rootme "."' && \
echo 'set tmpdir "'"$PWD"'"' && \
echo 'set CFLAGS ""' && \
echo 'set CXXFLAGS ""' && \
echo 'set GCC_UNDER_TEST "gcc"' && \
echo 'set GXX_UNDER_TEST "g++"' && \
echo 'set GFORTRAN_UNDER_TEST "gfortran"' && \
echo 'set OBJC_UNDER_TEST "no"'
}
print_dts_exp () {
# The patched sources of GTS GCC give special care to the libstdc++
# testsuite because GTS GCC doesn't ship its own libstdc++ but uses
# *system* libstdc++. However we update system libstdc++ prettyprinters
# to be on par with GTS needs (RHEL-50290). Let's revert that care
# normally given to the GTS libstdc++ testsuite; specifically, let's
# pretend that system GCC is of the same version as the GTS GCC we are
# testing.
echo 'proc get_dts_base_major_version { } {' && \
echo " return $(gcc -dumpversion | cut -d. -f1)" && \
echo '}'
}
rlJournalStart
rlPhaseStartSetup
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "GCC=$GCC"
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
# We optionally need to skip checking for the presence of the metapackage
# because that would pull in all the dependent toolset subrpms. We do not
# always want that, especially in CI.
_COLLECTIONS="$COLLECTIONS"
if ! test -z "$SKIP_COLLECTION_METAPACKAGE_CHECK"; then
for c in $SKIP_COLLECTION_METAPACKAGE_CHECK; do
rlLogInfo "ignoring metapackage check for collection $c"
COLLECTIONS=$(shopt -s extglob && echo "${COLLECTIONS//$c/}"); export COLLECTIONS
done
fi
rlLogInfo "(without skipped) COLLECTIONS=$COLLECTIONS"
rlAssertRpm --all
export COLLECTIONS="$_COLLECTIONS"
rlRun "TmpDir=\$(mktemp --tmpdir=/home --directory)"
# shellcheck disable=SC2154
rlRun "cp files/* $TmpDir"
rlRun "pushd $TmpDir"
rlRun 'debuginfo-install -y libstdc++' 0-255 # best effort only
rlFetchSrcForInstalled "$GCC_RPM_NAME" || yumdownloader --source "$GCC_RPM_NAME"
rlRun 'ls ./*.src.rpm'
rlRun 'yum-builddep -y --skip-unavailable ./*.src.rpm' 0-255 # best effort only
rlRun 'mkdir rpmbuild'
rlRun "rpm --define='_topdir $PWD/rpmbuild' -i ./*.src.rpm"
rlRun "rpmbuild --define='_topdir $PWD/rpmbuild' -bp --nodeps rpmbuild/SPECS/*.spec"
# Find the root od the extracted sources. Varies with rpmbuild.
# shellcheck disable=SC2012
CONFIGURE=$(ls -d rpmbuild/BUILD/gcc-*/gcc-*/configure rpmbuild/BUILD/gcc-*/configure 2>/dev/null | head -n 1)
SRCROOT=${CONFIGURE%/*}
rlLogInfo "SRCROOT=$SRCROOT"
if [[ "$GCC_RPM_NAME" == *toolset* ]]; then
# GTS/DTS actually uses the system libstdc++ SO. For some fine
# tuning in the test suite we need to know the major version
# of GCC it belogs to. It's usually set in the following "exp"
# file but not always so let's just override it.
rlRun "print_dts_exp >$SRCROOT/libstdc++-v3/testsuite/lib/dts.exp"
rlAssertGrep 'return [0-9]' "$SRCROOT/libstdc++-v3/testsuite/lib/dts.exp"
fi
# Exclude known problematic tests
# RHEL-82258
if rlIsRHEL 8.10 && [[ "$GCC_RPM_NAME" = gcc ]]; then
rlRun "patch -d $SRCROOT -p0 <$PWD/rhel-8.10__gcc.patch"
fi
rlPhaseEnd
rlPhaseStartTest
rlRun 'print_site_exp >site.exp'
rlRun "runtest --srcdir $SRCROOT/libstdc++-v3/testsuite --tool libstdc++ --target_board=unix/-fstack-protector-strong prettyprinters.exp"
rlRun 'ls ./*.sum ./*.log'
for i in ./*.log; do
rlAssertGrep '^# of expected passes[[:space:]]*[1-9]' "$i"
rlAssertNotGrep '^FAIL:' "$i"
rlAssertNotGrep '^UNRESOLVED:' "$i"
done
for i in ./*.{sum,log}; do
rlRun "xz $i"
rlFileSubmit "$i.xz" "$i.xz"
done
rlFileSubmit site.exp site.exp
rlPhaseEnd
rlPhaseStartCleanup
rlRun popd
rlRun "rm -r $TmpDir"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd