rust/tests/run-make/profile/rmake.rs
Nicholas Nethercote 84ac80f192 Reformat use declarations.
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
2024-07-29 08:26:52 +10:00

24 lines
941 B
Rust

// This test revolves around the rustc flag -Z profile, which should
// generate a .gcno file (initial profiling information) as well
// as a .gcda file (branch counters). The path where these are emitted
// should also be configurable with -Z profile-emit. This test checks
// that the files are produced, and then that the latter flag is respected.
// See https://github.com/rust-lang/rust/pull/42433
//@ ignore-cross-compile
//@ needs-profiler-support
use std::path::Path;
use run_make_support::{run, rustc};
fn main() {
rustc().arg("-g").arg("-Zprofile").input("test.rs").run();
run("test");
assert!(Path::new("test.gcno").exists(), "no .gcno file");
assert!(Path::new("test.gcda").exists(), "no .gcda file");
rustc().arg("-g").arg("-Zprofile").arg("-Zprofile-emit=abc/abc.gcda").input("test.rs").run();
run("test");
assert!(Path::new("abc/abc.gcda").exists(), "gcda file not emitted to defined path");
}