From c09595c10f19004dfc42d29a68d34dd9e7d9039c Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 7 Jul 2026 19:13:39 +0200 Subject: [PATCH 1/2] fix(macOS): respect MTU on macOS in udp-large-recv test-case --- lib/wasix/tests/wasm_tests/mod.rs | 15 +++++++++++++++ .../wasm_tests/socket/udp-large-recv/build.sh | 12 ++++++++++++ .../tests/wasm_tests/socket/udp-large-recv/main.c | 5 +---- 3 files changed, 28 insertions(+), 4 deletions(-) create mode 100755 lib/wasix/tests/wasm_tests/socket/udp-large-recv/build.sh diff --git a/lib/wasix/tests/wasm_tests/mod.rs b/lib/wasix/tests/wasm_tests/mod.rs index 4a6a1aa7a1fe..eb1f3b0471c4 100644 --- a/lib/wasix/tests/wasm_tests/mod.rs +++ b/lib/wasix/tests/wasm_tests/mod.rs @@ -24,6 +24,10 @@ //! The harness also sets `WASMER_BACKEND` to the engine name (`cranelift`, `v8`, //! etc.) before every build so shell scripts can tune compile-time parameters per backend. //! +//! It also sets `WASMER_HOST_OS` to the host operating system (`macOS`, `Linux`, +//! or `Windows`) before every build, so `build.sh` scripts can tune compile-time +//! parameters (e.g. via `-D` defines) per host OS. +//! //! `Env:{key}={value}` sets an environment variable before running. //! //! `ExpectedStdout:{line}` appends one expected stdout line. @@ -655,6 +659,16 @@ fn rustc_command(toolchain: Option<&str>) -> Command { } } +fn host_os_name() -> &'static str { + if cfg!(target_os = "macos") { + "macOS" + } else if cfg!(target_os = "windows") { + "Windows" + } else { + "Linux" + } +} + fn run_build_script(config: &Config) -> anyhow::Result { // First, copy the test source directory to the 'build' subfolder that will // be unique for each configuration of a test. @@ -720,6 +734,7 @@ fn run_build_script(config: &Config) -> anyhow::Result { cmd.env(k, v); } cmd.env("WASMER_BACKEND", config.engine.name()); + cmd.env("WASMER_HOST_OS", host_os_name()); let output = cmd.output()?; if !output.status.success() { diff --git a/lib/wasix/tests/wasm_tests/socket/udp-large-recv/build.sh b/lib/wasix/tests/wasm_tests/socket/udp-large-recv/build.sh new file mode 100755 index 000000000000..7cda4a533594 --- /dev/null +++ b/lib/wasix/tests/wasm_tests/socket/udp-large-recv/build.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +##ExpectedStdout: large UDP datagram receive works +set -euo pipefail + +# macOS's loopback interface has a 16KiB MTU and does not fragment oversized +# UDP datagrams (unlike Linux's 64KiB loopback MTU), so shrink the payload. +PAYLOAD_SIZE=20480 +if [ "${WASMER_HOST_OS:-}" = "macOS" ]; then + PAYLOAD_SIZE=8192 +fi + +$CC main.c -o main -DPAYLOAD_SIZE="$PAYLOAD_SIZE" diff --git a/lib/wasix/tests/wasm_tests/socket/udp-large-recv/main.c b/lib/wasix/tests/wasm_tests/socket/udp-large-recv/main.c index 468dfa682aa9..ec1651ae58ec 100644 --- a/lib/wasix/tests/wasm_tests/socket/udp-large-recv/main.c +++ b/lib/wasix/tests/wasm_tests/socket/udp-large-recv/main.c @@ -1,5 +1,3 @@ -//#ExpectedStdout: large UDP datagram receive works - #include #include #include @@ -8,8 +6,7 @@ #include #include -#define PAYLOAD_SIZE 20480 - +// build.sh passes -DPAYLOAD_SIZE based on $WASMER_HOST_OS. static uint8_t sendbuf[PAYLOAD_SIZE]; static uint8_t recvbuf[PAYLOAD_SIZE]; From 9e3b0f84c90a60047f80f77e4939844b62299c40 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 8 Jul 2026 09:30:00 +0200 Subject: [PATCH 2/2] disable one flaky test --- .../tests/wasm_tests/socket/stream-tcp-writev-partial/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/wasix/tests/wasm_tests/socket/stream-tcp-writev-partial/main.c b/lib/wasix/tests/wasm_tests/socket/stream-tcp-writev-partial/main.c index e1e7ff7d5c0c..27547deb51b2 100644 --- a/lib/wasix/tests/wasm_tests/socket/stream-tcp-writev-partial/main.c +++ b/lib/wasix/tests/wasm_tests/socket/stream-tcp-writev-partial/main.c @@ -1,4 +1,6 @@ //#ExpectedStdout: stream TCP writev returns partial success after peer close +//#Ignored: flaky test (#6785) + /* * Regression test for stream-socket fd_write partial success. *