2024-06-25 12:58:48 -05:00
|
|
|
// 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;
|
|
|
|
|
2024-07-28 17:13:50 -05:00
|
|
|
use run_make_support::{run, rustc};
|
|
|
|
|
2024-06-25 12:58:48 -05:00
|
|
|
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");
|
|
|
|
}
|