fix(ci): skip mimalloc FFI and disable isolation for Miri (#621)

- Add cfg(not(miri)) guards to mimalloc module, global allocator, and
  allocator-memory-limits code paths so Miri falls back to the default
  system allocator instead of calling unsupported FFI functions.
- Set MIRIFLAGS="-Zmiri-disable-isolation" in the workflow so tests
  that perform file I/O can run under Miri.
- Skip units/parse tests under Miri due to Float-vs-BigInt Number
  representation mismatch with Miri's soft-float emulation.

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
Anand Krishnamoorthi
2026-03-11 15:13:51 -05:00
committed by GitHub
parent b8e15f46f3
commit ee3dff9a3d
9 changed files with 34 additions and 19 deletions
+4 -4
View File
@@ -2,7 +2,7 @@
// Licensed under the MIT License.
use crate::rvm::program::Program;
#[cfg(feature = "allocator-memory-limits")]
#[cfg(all(feature = "allocator-memory-limits", not(miri)))]
use crate::utils::limits;
use crate::utils::limits::{
fallback_execution_timer_config, monotonic_now, ExecutionTimer, ExecutionTimerConfig,
@@ -11,7 +11,7 @@ use crate::utils::limits::{
use crate::value::Value;
use crate::CompiledPolicy;
use alloc::collections::{btree_map::Entry, BTreeMap, VecDeque};
#[cfg(feature = "allocator-memory-limits")]
#[cfg(all(feature = "allocator-memory-limits", not(miri)))]
use alloc::format;
use alloc::string::String;
use alloc::sync::Arc;
@@ -467,7 +467,7 @@ impl RegoVM {
Ok(())
}
#[cfg(feature = "allocator-memory-limits")]
#[cfg(all(feature = "allocator-memory-limits", not(miri)))]
pub(super) fn memory_check(&mut self) -> Result<()> {
limits::check_memory_limit_if_needed().map_err(|err| match err {
LimitError::MemoryLimitExceeded { usage, limit } => VmError::MemoryLimitExceeded {
@@ -482,7 +482,7 @@ impl RegoVM {
})
}
#[cfg(not(feature = "allocator-memory-limits"))]
#[cfg(any(miri, not(feature = "allocator-memory-limits")))]
pub(super) fn memory_check(&mut self) -> Result<()> {
Ok(())
}