Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions crates/data_privacy_macros_impl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ homepage = { workspace = true }
include = { workspace = true }
repository = "https://github.com/microsoft/oxidizer/tree/main/crates/data_privacy_macros_impl"

[package.metadata.anvil.miri]
exclude = true

[package.metadata.cargo_check_external_types]
allowed_external_types = ["proc_macro2::TokenStream", "syn::error::Error", "syn::error::Result"]

Expand Down
3 changes: 3 additions & 0 deletions crates/fundle_macros_impl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ homepage = { workspace = true }
include = { workspace = true }
repository = "https://github.com/microsoft/oxidizer/tree/main/crates/fundle_macros_impl"

[package.metadata.anvil.miri]
exclude = true

[package.metadata.cargo_check_external_types]
allowed_external_types = ["proc_macro2::*", "syn::error::*"]

Expand Down
4 changes: 4 additions & 0 deletions crates/internity/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,10 @@ fn foreign_sym_resolves_to_none_without_panicking() {
/// missing — so asserting the prefix property on every mid-flight snapshot
/// guards the cross-shard consistency of `build_reader`.
#[cfg(not(all(miri, windows)))]
#[cfg_attr(
miri_strict_provenance,
ignore = "parking_lot_core uses integer-to-pointer casts on Unix, which strict-provenance Miri rejects"
)]
#[test]
fn freeze_races_writer_and_stays_prefix_consistent() {
use std::collections::BTreeSet;
Expand Down
3 changes: 3 additions & 0 deletions crates/internity_macros_impl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ homepage = { workspace = true }
include = { workspace = true }
repository = "https://github.com/microsoft/oxidizer/tree/main/crates/internity_macros_impl"

[package.metadata.anvil.miri]
exclude = true

[package.metadata.cargo_check_external_types]
allowed_external_types = [
"proc_macro2::*",
Expand Down
70 changes: 51 additions & 19 deletions crates/multitude/tests/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3205,13 +3205,17 @@ mod drop_slice_over_u16_max_succeeds {

const TOO_LONG: usize = (u16::MAX as usize) + 1;

// These tests verify a runtime length boundary rather than memory safety.
// Native CI retains the full boundary coverage without Miri's per-element cost.
#[cfg_attr(miri, ignore)]
#[test]
fn try_alloc_slice_clone_drop_over_u16_succeeds() {
let a = Arena::new();
let v: std::vec::Vec<D> = (0..TOO_LONG).map(|i| D(i as u8)).collect();
assert_eq!(a.try_alloc_slice_clone(&v[..]).unwrap().len(), TOO_LONG);
}

#[cfg_attr(miri, ignore)]
#[test]
fn try_alloc_slice_fill_with_drop_over_u16_succeeds() {
let a = Arena::new();
Expand All @@ -3221,6 +3225,7 @@ mod drop_slice_over_u16_max_succeeds {
);
}

#[cfg_attr(miri, ignore)]
#[test]
fn try_alloc_slice_fill_iter_drop_over_u16_succeeds() {
let a = Arena::new();
Expand Down Expand Up @@ -3597,6 +3602,7 @@ mod alloc_slice_overflow_paths {
// type lowers to a single capacity allocation plus a bulk
// initializing loop — much cheaper than `(0..N).map(...).collect()`
// which runs the closure N times.
#[cfg_attr(miri, ignore)]
#[test]
fn alloc_slice_clone_drop_over_u16_succeeds() {
let v: std::vec::Vec<D> = std::vec![D(0); u16::MAX as usize + 1];
Expand All @@ -3605,13 +3611,15 @@ mod alloc_slice_overflow_paths {
assert_eq!(s.len(), u16::MAX as usize + 1);
}

#[cfg_attr(miri, ignore)]
#[test]
fn alloc_slice_fill_with_drop_over_u16_succeeds() {
let arena = Arena::new();
let s = arena.alloc_slice_fill_with::<D, _>(u16::MAX as usize + 1, |i| D(i as u8));
assert_eq!(s.len(), u16::MAX as usize + 1);
}

#[cfg_attr(miri, ignore)]
#[test]
fn alloc_slice_fill_iter_drop_over_u16_succeeds() {
let arena = Arena::new();
Expand Down Expand Up @@ -3694,6 +3702,22 @@ mod oversized_paths_coverage {
fn drop(&mut self) {}
}

#[cfg(miri)]
const OVERSIZED_DROP_LEN: usize = 513;
#[cfg(not(miri))]
const OVERSIZED_DROP_LEN: usize = 3000;

fn oversized_drop_arena() -> Arena {
#[cfg(miri)]
{
Arena::builder().max_normal_alloc(4 * 1024).build()
}
#[cfg(not(miri))]
{
Arena::new()
}
}

// 24 KiB single value with Drop ⇒ oversized-local value arm
// (`alloc_value.rs` 433-436).
#[derive(Clone)]
Expand All @@ -3717,36 +3741,40 @@ mod oversized_paths_coverage {
use core::sync::atomic::{AtomicUsize, Ordering};
let counter = AtomicUsize::new(0);
{
let arena = Arena::new();
let out = arena.alloc_slice_fill_with(3000, |_| CountedDrop(&counter));
assert_eq!(out.len(), 3000);
let arena = oversized_drop_arena();
let out = arena.alloc_slice_fill_with(OVERSIZED_DROP_LEN, |_| CountedDrop(&counter));
assert_eq!(out.len(), OVERSIZED_DROP_LEN);
assert_eq!(counter.load(Ordering::SeqCst), 0, "no drops before teardown");
}
assert_eq!(counter.load(Ordering::SeqCst), 3000, "every element dropped at arena teardown");
assert_eq!(
counter.load(Ordering::SeqCst),
OVERSIZED_DROP_LEN,
"every element dropped at arena teardown"
);
}

#[test]
fn alloc_slice_clone_oversized_drop() {
let arena = Arena::new();
let src: Vec<DropU64> = (0..3000).map(DropU64).collect();
let arena = oversized_drop_arena();
let src: Vec<DropU64> = (0..OVERSIZED_DROP_LEN).map(|i| DropU64(i as u64)).collect();
let out = arena.alloc_slice_clone(&src);
assert_eq!(out.len(), 3000);
assert_eq!(out[2999].0, 2999);
assert_eq!(out.len(), OVERSIZED_DROP_LEN);
assert_eq!(out[OVERSIZED_DROP_LEN - 1].0, (OVERSIZED_DROP_LEN - 1) as u64);
}

#[test]
fn alloc_slice_fill_with_oversized_drop() {
let arena = Arena::new();
let out = arena.alloc_slice_fill_with(3000, |i| DropU64(i as u64));
assert_eq!(out.len(), 3000);
assert_eq!(out[2999].0, 2999);
let arena = oversized_drop_arena();
let out = arena.alloc_slice_fill_with(OVERSIZED_DROP_LEN, |i| DropU64(i as u64));
assert_eq!(out.len(), OVERSIZED_DROP_LEN);
assert_eq!(out[OVERSIZED_DROP_LEN - 1].0, (OVERSIZED_DROP_LEN - 1) as u64);
}

#[test]
fn alloc_slice_fill_iter_oversized_drop() {
let arena = Arena::new();
let out = arena.alloc_slice_fill_iter((0_u32..3000).map(|i| DropU64(u64::from(i))));
assert_eq!(out.len(), 3000);
let arena = oversized_drop_arena();
let out = arena.alloc_slice_fill_iter((0..OVERSIZED_DROP_LEN).map(|i| DropU64(i as u64)));
assert_eq!(out.len(), OVERSIZED_DROP_LEN);
assert_eq!(out[0].0, 0);
}

Expand Down Expand Up @@ -3785,11 +3813,11 @@ mod oversized_paths_coverage {
use core::mem::MaybeUninit;

use multitude::Arc;
let arena = Arena::new();
let arena = oversized_drop_arena();
// A Drop element type routes through `impl_alloc_uninit_slice_arc`;
// 3000 × 8 B = 24 KiB exceeds the fresh arena's current chunk, so
// the slice lands in a one-shot oversized chunk.
let len = 3000_usize;
// the configured element count exceeds the normal allocation threshold,
// so the slice lands in a one-shot oversized chunk.
let len = OVERSIZED_DROP_LEN;
let s = arena.alloc_uninit_slice_arc::<DropU64>(len);
// SAFETY: `s` is the unique handle, so we have exclusive write access.
unsafe {
Expand Down Expand Up @@ -4242,6 +4270,7 @@ mod alloc_drop_behavior_2 {
assert_eq!(&*s, &[1, 2, 3, 4, 5]);
}

#[cfg_attr(miri, ignore)]
#[test]
fn slice_shared_long_no_drop_succeeds() {
let arena = multitude::Arena::new();
Expand Down Expand Up @@ -4540,6 +4569,7 @@ mod alloc_hot_path_behavior {
}
}

#[cfg_attr(miri, ignore)]
#[test]
fn arena_2266_slice_len_boundary() {
let arena = Arena::new();
Expand Down Expand Up @@ -4892,6 +4922,7 @@ mod alloc_hot_path_behavior {
assert_eq!(drops, 0, "empty Drop slices should not produce drops");
}

#[cfg_attr(miri, ignore)]
#[test]
fn arena_2266_large_nondrop_slice() {
let arena = Arena::new();
Expand All @@ -4918,6 +4949,7 @@ mod alloc_hot_path_behavior {
assert_eq!(drops, 0, "empty Drop arc slices should not produce drops");
}

#[cfg_attr(miri, ignore)]
#[test]
fn large_nondrop_shared_slice() {
// A non-Copy, non-Drop wrapper exercises initialized shared slices.
Expand Down
3 changes: 3 additions & 0 deletions crates/multitude_macros_impl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ homepage = { workspace = true }
include = { workspace = true }
repository = "https://github.com/microsoft/oxidizer/tree/main/crates/multitude_macros_impl"

[package.metadata.anvil.miri]
exclude = true

[package.metadata.cargo_check_external_types]
allowed_external_types = [
"proc_macro2::*",
Expand Down
3 changes: 3 additions & 0 deletions crates/observed_macros_impl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ homepage = { workspace = true }
include = { workspace = true }
repository = "https://github.com/microsoft/oxidizer/tree/main/crates/observed_macros_impl"

[package.metadata.anvil.miri]
exclude = true

[package.metadata.cargo_check_external_types]
allowed_external_types = ["proc_macro2::*", "syn::*"]

Expand Down
3 changes: 3 additions & 0 deletions crates/ohno_macros_impl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ homepage = { workspace = true }
include = { workspace = true }
repository = "https://github.com/microsoft/oxidizer/tree/main/crates/ohno_macros_impl"

[package.metadata.anvil.miri]
exclude = true

[package.metadata.cargo_check_external_types]
allowed_external_types = ["proc_macro2::*", "syn::*"]

Expand Down
7 changes: 6 additions & 1 deletion crates/routerama/src/dyn_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,18 @@ mod tests {

use super::*;

#[cfg(miri)]
const DEEP_TRIE_SEGMENTS: usize = 512;
#[cfg(not(miri))]
const DEEP_TRIE_SEGMENTS: usize = 4_096;
Comment thread
st-dev-gh marked this conversation as resolved.

#[test]
fn failed_build_discards_deep_source_trie_iteratively() {
std::thread::Builder::new()
.stack_size(64 * 1024)
.spawn(|| {
let mut path = String::new();
for index in 0..4_096 {
for index in 0..DEEP_TRIE_SEGMENTS {
let _ = write!(path, "/segment{index}");
}

Expand Down
3 changes: 3 additions & 0 deletions crates/templated_uri_macros_impl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ homepage = { workspace = true }
include = { workspace = true }
repository = "https://github.com/microsoft/oxidizer/tree/main/crates/templated_uri_macros_impl"

[package.metadata.anvil.miri]
exclude = true

[package.metadata.docs.rs]
all-features = true

Expand Down
3 changes: 3 additions & 0 deletions crates/thread_aware_macros_impl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ homepage = { workspace = true }
include = { workspace = true }
repository = "https://github.com/microsoft/oxidizer/tree/main/crates/thread_aware_macros_impl"

[package.metadata.anvil.miri]
exclude = true

[package.metadata.cargo_check_external_types]
allowed_external_types = [
"proc_macro2::*",
Expand Down
3 changes: 1 addition & 2 deletions justfiles/anvil/checks/miri-race-coverage.just
Comment thread
st-dev-gh marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
anvil-miri-race-coverage: anvil-miri-race-coverage-validate-prereqs
$ErrorActionPreference = 'Stop'
if ($env:ANVIL_INCLUDE_AFFECTED -eq '--skip') { exit 0 }
$pkg = @(if ($env:ANVIL_INCLUDE_AFFECTED) { -split $env:ANVIL_INCLUDE_AFFECTED } else { '--workspace' })
$day = (Get-Date).Day
$low = (2 * $day) - 1
$high = (2 * $day) + 1
$env:MIRIFLAGS = "-Zmiri-many-seeds=$low..$high $($env:MIRIFLAGS)".Trim()
$env:RUSTFLAGS = "--cfg miri_race_coverage $($env:RUSTFLAGS)".Trim()
Write-Host "anvil-miri-race-coverage: seed window $low..$high (day $day)"
& cargo '+{{ rust_nightly }}' miri test --all-features --tests @pkg
& "{{just_executable()}}" _anvil-miri-test
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

# Install prerequisites for the `anvil-miri-race-coverage` recipe.
Expand Down
3 changes: 1 addition & 2 deletions justfiles/anvil/checks/miri-strict-provenance.just
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
anvil-miri-strict-provenance: anvil-miri-strict-provenance-validate-prereqs
$ErrorActionPreference = 'Stop'
if ($env:ANVIL_INCLUDE_AFFECTED -eq '--skip') { exit 0 }
$pkg = @(if ($env:ANVIL_INCLUDE_AFFECTED) { -split $env:ANVIL_INCLUDE_AFFECTED } else { '--workspace' })
$env:MIRIFLAGS = "-Zmiri-strict-provenance $($env:MIRIFLAGS)".Trim()
$env:RUSTFLAGS = "--cfg miri_strict_provenance $($env:RUSTFLAGS)".Trim()
& cargo '+{{ rust_nightly }}' miri test --all-features --tests @pkg
& "{{just_executable()}}" _anvil-miri-test
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

# Install prerequisites for the `anvil-miri-strict-provenance` recipe.
Expand Down
3 changes: 1 addition & 2 deletions justfiles/anvil/checks/miri-tree-borrows.just
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@
anvil-miri-tree-borrows: anvil-miri-tree-borrows-validate-prereqs
$ErrorActionPreference = 'Stop'
if ($env:ANVIL_INCLUDE_AFFECTED -eq '--skip') { exit 0 }
$pkg = @(if ($env:ANVIL_INCLUDE_AFFECTED) { -split $env:ANVIL_INCLUDE_AFFECTED } else { '--workspace' })
$env:MIRIFLAGS = "-Zmiri-tree-borrows $($env:MIRIFLAGS)".Trim()
$env:RUSTFLAGS = "--cfg miri_tree_borrows $($env:RUSTFLAGS)".Trim()
& cargo '+{{ rust_nightly }}' miri test --all-features --tests @pkg
& "{{just_executable()}}" _anvil-miri-test
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

# The three nightly-miri profiles share the same toolchain prereqs
Expand Down
Loading
Loading