diff --git a/tests/Sanity/rust-wasi-smoke-test/main.fmf b/tests/Sanity/rust-wasi-smoke-test/main.fmf index 259de1d..8786e9e 100644 --- a/tests/Sanity/rust-wasi-smoke-test/main.fmf +++ b/tests/Sanity/rust-wasi-smoke-test/main.fmf @@ -1,7 +1,5 @@ summary: Compile and run a wasi app from rust description: Test the WASI targets currently shipped with rust -require+: - - rust-std-static-wasm32-wasi duration: 5m tier: 1 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=1980082 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" require+: - 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" enabled: false diff --git a/tests/Sanity/rust-wasi-smoke-test/runtest.sh b/tests/Sanity/rust-wasi-smoke-test/runtest.sh index fa0b880..27a2c2b 100755 --- a/tests/Sanity/rust-wasi-smoke-test/runtest.sh +++ b/tests/Sanity/rust-wasi-smoke-test/runtest.sh @@ -28,7 +28,7 @@ # Include Beaker environment . /usr/share/beakerlib/beakerlib.sh || exit 1 -PACKAGES="$(rpm -qf $(which rustc))" +PACKAGES="$(rpm -qf "$(which rustc)")" PACKAGES+=" $(rlGetYAMLdeps)" # TMT will decide which targets to install depending on the distro/arch context. @@ -43,12 +43,11 @@ rlJournalStart rlPhaseStartSetup rlAssertRpm --all rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" - # Because we need a specific nodejs version (>=16) that supports WASI. - # In RHEL 8 we need to do it via modules, which tmt does not support, - # so we need to do it right in the script. - if rlIsRHEL 8; then - # nodejs-16 has support for wasi. - rlRun "yum -y module switch-to nodejs:16" + 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 # Example taken from WASI documentation: diff --git a/tests/Sanity/rust-wasm-smoke-test/main.fmf b/tests/Sanity/rust-wasm-smoke-test/main.fmf index fb79999..ed3f40e 100644 --- a/tests/Sanity/rust-wasm-smoke-test/main.fmf +++ b/tests/Sanity/rust-wasm-smoke-test/main.fmf @@ -2,7 +2,6 @@ summary: rust wasm smoke test description: 'Test that the rust wasm target is enabled and can compile correctly' require+: - rust-std-static-wasm32-unknown-unknown - - nodejs duration: 5m tier: 1 tag: @@ -19,6 +18,10 @@ adjust+: enabled: false when: distro < rhel-8 continue: false + - because: "nodejs needs to be installed differently in RHEL-8" + require+: + - "nodejs" + when: distro != rhel-8 extra-nitrate: TC#0611164 extra-summary: /tools/rust/Sanity/rust-wasm-smoke-test extra-task: /tools/rust/Sanity/rust-wasm-smoke-test diff --git a/tests/Sanity/rust-wasm-smoke-test/runtest.sh b/tests/Sanity/rust-wasm-smoke-test/runtest.sh index 2de8b84..40a82d2 100755 --- a/tests/Sanity/rust-wasm-smoke-test/runtest.sh +++ b/tests/Sanity/rust-wasm-smoke-test/runtest.sh @@ -28,12 +28,19 @@ # Include Beaker environment . /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 rlPhaseStartSetup rlAssertRpm --all 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 test.js $TmpDir" rlRun "pushd $TmpDir"