Skip to content

Commit

Permalink
Skip the rlimited-memory test under QEMU (#9626)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
iii-i authored Nov 20, 2024
1 parent 3e0b7e5 commit bf80990
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/rlimited-memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ fn custom_limiter_detect_os_oom_failure() -> Result<()> {
return Ok(());
}

// Skip this test if it looks like we're in a cross-compiled situation,
// and we're emulating this test for a different platform. In that
// scenario QEMU ignores the data rlimit, which this test relies on. See
// QEMU commits 5dfa88f7162f ("linux-user: do setrlimit selectively") and
// 055d92f8673c ("linux-user: do prlimit selectively") for more
// information.
if std::env::vars()
.filter(|(k, _v)| k.starts_with("CARGO_TARGET") && k.ends_with("RUNNER"))
.count()
> 0
{
return Ok(());
}

// Default behavior of on-demand memory allocation so that a
// memory grow will hit Linux for a larger mmap.
let mut config = Config::new();
Expand Down

0 comments on commit bf80990

Please sign in to comment.