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

Function test_cpp_alloc_tracking

crates/memtrack/tests/cpp_tests.rs:56–71  ·  view source on GitHub ↗
(#[case] target: &str)

Source from the content-addressed store, hash-verified

54#[case("alloc_cpp_tcmalloc_dynamic")]
55#[test_log::test]
56fn test_cpp_alloc_tracking(#[case] target: &str) -> Result<(), Box<dyn std::error::Error>> {
57 let project_path = Path::new("testdata/alloc_cpp");
58 let binary = compile_cpp_project(project_path, target)?;
59
60 // Try to find a static allocator in the binary, then attach to it as well
61 // This is needed because the CWD is different, which breaks the heuristics.
62 let allocators = AllocatorLib::from_path_static(&binary)
63 .map(|a| vec![a])
64 .unwrap_or_default();
65
66 let (events, thread_handle) = shared::track_binary_with_opts(&binary, &allocators)?;
67 assert_events_with_marker!(target, &events);
68
69 thread_handle.join().unwrap();
70 Ok(())
71}

Callers

nothing calls this directly

Calls 2

compile_cpp_projectFunction · 0.85
track_binary_with_optsFunction · 0.85

Tested by

no test coverage detected