2024-06-25 12:22:02 -05:00
|
|
|
// -C profile-generate, when used with rustc, is supposed to output
|
|
|
|
// profile files (.profraw) after running a binary to analyze how the compiler
|
|
|
|
// optimizes code. This test checks that these files are generated.
|
|
|
|
// See https://github.com/rust-lang/rust/pull/48346
|
|
|
|
|
|
|
|
//@ needs-profiler-support
|
|
|
|
//@ ignore-cross-compile
|
|
|
|
|
2024-06-27 12:51:53 -05:00
|
|
|
use run_make_support::{cwd, has_extension, has_prefix, run, rustc, shallow_find_files};
|
2024-06-25 12:22:02 -05:00
|
|
|
|
|
|
|
fn main() {
|
2024-06-27 12:51:53 -05:00
|
|
|
rustc().arg("-g").profile_generate(cwd()).input("test.rs").run();
|
2024-06-25 12:22:02 -05:00
|
|
|
run("test");
|
2024-06-27 12:51:53 -05:00
|
|
|
let profraw_files = shallow_find_files(cwd(), |path| {
|
|
|
|
has_prefix(path, "default") && has_extension(path, "profraw")
|
|
|
|
});
|
|
|
|
assert!(!profraw_files.is_empty(), "no .profraw file generated");
|
2024-06-25 12:22:02 -05:00
|
|
|
}
|