MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / test_rust_alloc_tracking

Function test_rust_alloc_tracking

crates/memtrack/tests/rust_tests.rs:14–32  ·  view source on GitHub ↗
(
    #[case] name: &str,
    #[case] features: &[&str],
)

Source from the content-addressed store, hash-verified

12#[case("mimalloc", &["with-mimalloc"])]
13#[test_log::test]
14fn test_rust_alloc_tracking(
15 #[case] name: &str,
16 #[case] features: &[&str],
17) -> Result<(), Box<dyn std::error::Error>> {
18 let crate_path = Path::new("testdata/alloc_rust");
19 let binary = shared::compile_rust_binary(crate_path, "alloc_rust", features)?;
20
21 // Try to find a static allocator in the binary, then attach to it as well
22 // This is needed because the CWD is different, which breaks the heuristics.
23 let allocators = AllocatorLib::from_path_static(&binary)
24 .map(|a| vec![a])
25 .unwrap_or_default();
26
27 let (events, thread_handle) = shared::track_binary_with_opts(&binary, &allocators)?;
28 assert_events_with_marker!(name, &events);
29
30 thread_handle.join().unwrap();
31 Ok(())
32}

Callers

nothing calls this directly

Calls 2

compile_rust_binaryFunction · 0.85
track_binary_with_optsFunction · 0.85

Tested by

no test coverage detected