Skip to content

Commit bf80990

Browse files
authored
Skip the rlimited-memory test under QEMU (#9626)
After the rework of the QEMU memory management, which landed in v8.0.0 and introduced interval trees instead of individual page descriptors - similar to how the Linux kernel does it - it became possible to run the WASMTIME_TEST_NO_HOG_MEMORY tests under it. The only exception is the rlimited-memory test, which relies on the underlying OS enforcing the RLIMIT_DATA limit. QEMU chose to ignore this limit, because it interferes with its JIT. Skip this test when using emulation.
1 parent 3e0b7e5 commit bf80990

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/rlimited-memory.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,20 @@ fn custom_limiter_detect_os_oom_failure() -> Result<()> {
4343
return Ok(());
4444
}
4545

46+
// Skip this test if it looks like we're in a cross-compiled situation,
47+
// and we're emulating this test for a different platform. In that
48+
// scenario QEMU ignores the data rlimit, which this test relies on. See
49+
// QEMU commits 5dfa88f7162f ("linux-user: do setrlimit selectively") and
50+
// 055d92f8673c ("linux-user: do prlimit selectively") for more
51+
// information.
52+
if std::env::vars()
53+
.filter(|(k, _v)| k.starts_with("CARGO_TARGET") && k.ends_with("RUNNER"))
54+
.count()
55+
> 0
56+
{
57+
return Ok(());
58+
}
59+
4660
// Default behavior of on-demand memory allocation so that a
4761
// memory grow will hit Linux for a larger mmap.
4862
let mut config = Config::new();

0 commit comments

Comments
 (0)