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

Function assert_stack_snapshot

crates/memtrack/tests/stack_tests.rs:91–109  ·  view source on GitHub ↗
(
    test_case: &AllocationTestCase,
    stack_capture: bool,
    snapshot_name: &str,
)

Source from the content-addressed store, hash-verified

89];
90
91fn assert_stack_snapshot(
92 test_case: &AllocationTestCase,
93 stack_capture: bool,
94 snapshot_name: &str,
95) -> Result<(), Box<dyn std::error::Error>> {
96 let temp_dir = TempDir::new()?;
97 let binary = shared::compile_c_source(test_case.source, test_case.name, temp_dir.path())?;
98 let options = TrackerOptions::builder()
99 .stack_capture(stack_capture)
100 .build();
101 let (events, thread_handle) = shared::track_command(Command::new(binary), options)?;
102
103 insta::assert_debug_snapshot!(snapshot_name, format_events(&events));
104
105 thread_handle
106 .join()
107 .expect("tracker teardown thread panicked");
108 Ok(())
109}
110
111#[test_with::env(GITHUB_ACTIONS)]
112#[rstest]

Callers 2

test_stack_captureFunction · 0.85

Calls 4

compile_c_sourceFunction · 0.85
pathMethod · 0.80
track_commandFunction · 0.70
buildMethod · 0.45

Tested by

no test coverage detected