std module smoke test

This commit is contained in:
Václav Kadlčík 2025-01-22 07:47:33 +01:00
commit 4af65b50e1
4 changed files with 85 additions and 0 deletions

View file

@ -0,0 +1 @@
Hello, world

View file

@ -0,0 +1,6 @@
import std;
using namespace std::literals;
int main() {
std::println("Hello, {}", "world"s);
return 0;
}

View file

@ -0,0 +1,25 @@
summary: std module smoke test
enabled: true
adjust+:
- enabled: false
when: distro < fedora-42
continue: false
- enabled: false
when: distro < rhel-11 and collection is not defined
continue: false
- enabled: false
when: distro < centos-stream-11 and collection is not defined
continue: false
- enabled: false
when: collection == gcc-toolset-14, gcc-toolset-13, devtoolset-13
continue: false
contact: Vaclav Kadlcik <vkadlcik@redhat.com>
component:
- gcc
test: ${WITH_SCL:-bash} ./runtest.sh
framework: beakerlib
require+:
- gcc-c++
duration: 10m
extra-summary: /tools/gcc/Sanity/std_module-smoke
extra-task: /tools/gcc/Sanity/std_module-smoke

View file

@ -0,0 +1,53 @@
#!/usr/bin/env bash
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "${0%/*}"/../../lib/common.sh || exit 1
# Relevancy: GCC > 14
GCC=${GCC:-$(type -P gcc)}
GCC_RPM_NAME=$(rpm --qf '%{name}' -qf "$GCC")
GXX_RPM_NAME=${GCC_RPM_NAME}-c++
# shellcheck disable=SC2034
PACKAGES="${GCC_RPM_NAME} ${GXX_RPM_NAME}"
rlJournalStart
rlPhaseStartSetup
rlLogInfo "GCC=$GCC"
rlLogInfo "GCC_RPM_NAME=$GCC_RPM_NAME"
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 -d)"
# shellcheck disable=SC2154
rlRun "cp files/* $TmpDir"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
rlRun 'g++ -std=c++23 -fsearch-include-path bits/std.cc -fmodules-ts hello.cpp'
rlRun './a.out >stdout.txt 2>stderr.txt'
rlAssertNotDiffer stdout.txt expected_stdout.txt
rlAssertNotDiffer stderr.txt /dev/null
rlPhaseEnd
rlPhaseStartCleanup
rlRun popd
rlRun "rm -r $TmpDir"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd