Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Jesus Checa Hidalgo
f979788630 Update wasm/wasi tests
This commit contains the following changes:
* Remove wasm32-wasi package requirement in rust-1.84 and newer
* Compatibility fixes for nodejs in older RHEL, which is used
to test wasi.
2025-01-10 10:25:02 +01:00
4 changed files with 26 additions and 12 deletions

View file

@ -1,7 +1,5 @@
summary: Compile and run a wasi app from rust summary: Compile and run a wasi app from rust
description: Test the WASI targets currently shipped with rust description: Test the WASI targets currently shipped with rust
require+:
- rust-std-static-wasm32-wasi
duration: 5m duration: 5m
tier: 1 tier: 1
tag: tag:
@ -10,10 +8,17 @@ link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1980080 - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1980080
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1980082 - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1980082
adjust+: adjust+:
- because: "wasm32-wasi target not available after rust 1.84"
require+:
- rust-std-static-wasm32-wasi
when: distro == fedora and distro < fedora-42 or
distro == rhel-8 and distro < rhel-8.10 or
distro == rhel-9 and distro < rhel-9.6
- because: "wasm32-wasip1 target added in rust 1.78" - because: "wasm32-wasip1 target added in rust 1.78"
require+: require+:
- rust-std-static-wasm32-wasip1 - rust-std-static-wasm32-wasip1
when: distro >= fedora-39,rhel-9.5,rhel-10 when: distro >= fedora-39,rhel-8.10,rhel-9.5,rhel-10
- because: "WASI target not supported in s390x older RHEL" - because: "WASI target not supported in s390x older RHEL"
enabled: false enabled: false

View file

@ -28,7 +28,7 @@
# Include Beaker environment # Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1 . /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGES="$(rpm -qf $(which rustc))" PACKAGES="$(rpm -qf "$(which rustc)")"
PACKAGES+=" $(rlGetYAMLdeps)" PACKAGES+=" $(rlGetYAMLdeps)"
# TMT will decide which targets to install depending on the distro/arch context. # TMT will decide which targets to install depending on the distro/arch context.
@ -43,12 +43,11 @@ rlJournalStart
rlPhaseStartSetup rlPhaseStartSetup
rlAssertRpm --all rlAssertRpm --all
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
# Because we need a specific nodejs version (>=16) that supports WASI. if rlIsRHEL 8 9; then
# In RHEL 8 we need to do it via modules, which tmt does not support, # In RHEL 8 and 9 nodejs is shipped in different versions using modules.
# so we need to do it right in the script. # We always want to use the latest version.
if rlIsRHEL 8; then rlRun "NODE_VER=\"$(dnf module info nodejs | sed -n -E 's|^Stream\s+:\s*([0-9]+).*|\1|p' | sort | tail -1)\""
# nodejs-16 has support for wasi. rlRun "yum -y module switch-to nodejs:$NODE_VER"
rlRun "yum -y module switch-to nodejs:16"
rlRun "yum -y module install nodejs" rlRun "yum -y module install nodejs"
fi fi
# Example taken from WASI documentation: # Example taken from WASI documentation:

View file

@ -2,7 +2,6 @@ summary: rust wasm smoke test
description: 'Test that the rust wasm target is enabled and can compile correctly' description: 'Test that the rust wasm target is enabled and can compile correctly'
require+: require+:
- rust-std-static-wasm32-unknown-unknown - rust-std-static-wasm32-unknown-unknown
- nodejs
duration: 5m duration: 5m
tier: 1 tier: 1
tag: tag:
@ -19,6 +18,10 @@ adjust+:
enabled: false enabled: false
when: distro < rhel-8 when: distro < rhel-8
continue: false continue: false
- because: "nodejs needs to be installed differently in RHEL-8"
require+:
- "nodejs"
when: distro != rhel-8
extra-nitrate: TC#0611164 extra-nitrate: TC#0611164
extra-summary: /tools/rust/Sanity/rust-wasm-smoke-test extra-summary: /tools/rust/Sanity/rust-wasm-smoke-test
extra-task: /tools/rust/Sanity/rust-wasm-smoke-test extra-task: /tools/rust/Sanity/rust-wasm-smoke-test

View file

@ -28,12 +28,19 @@
# Include Beaker environment # Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1 . /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGES="$(rpm -qf $(which rustc)) rust-std-static-wasm32-unknown-unknown" PACKAGES="$(rpm -qf "$(which rustc)") rust-std-static-wasm32-unknown-unknown"
rlJournalStart rlJournalStart
rlPhaseStartSetup rlPhaseStartSetup
rlAssertRpm --all rlAssertRpm --all
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
if rlIsRHEL 8 9; then
# In RHEL 8 and 9 nodejs is shipped in different versions using modules.
# We always want to use the latest version.
rlRun "NODE_VER=\"$(dnf module info nodejs | sed -n -E 's|^Stream\s+:\s*([0-9]+).*|\1|p' | sort | tail -1)\""
rlRun "yum -y module switch-to nodejs:$NODE_VER"
rlRun "yum -y module install nodejs"
fi
rlRun "cp lib.rs $TmpDir" rlRun "cp lib.rs $TmpDir"
rlRun "cp test.js $TmpDir" rlRun "cp test.js $TmpDir"
rlRun "pushd $TmpDir" rlRun "pushd $TmpDir"