rewrite profile to rmake

This commit is contained in:
Oneirical 2024-06-25 13:58:48 -04:00
parent a1555eb0d6
commit b15e72a9ed
3 changed files with 22 additions and 14 deletions

View File

@ -113,7 +113,6 @@ run-make/pgo-indirect-call-promotion/Makefile
run-make/pointer-auth-link-with-c/Makefile
run-make/print-calling-conventions/Makefile
run-make/print-target-list/Makefile
run-make/profile/Makefile
run-make/prune-link-args/Makefile
run-make/raw-dylib-alt-calling-convention/Makefile
run-make/raw-dylib-c/Makefile

View File

@ -1,13 +0,0 @@
# needs-profiler-support
# ignore-cross-compile
include ../tools.mk
all:
$(RUSTC) -g -Z profile test.rs
$(call RUN,test) || exit 1
[ -e "$(TMPDIR)/test.gcno" ] || (echo "No .gcno file"; exit 1)
[ -e "$(TMPDIR)/test.gcda" ] || (echo "No .gcda file"; exit 1)
$(RUSTC) -g -Z profile -Z profile-emit=$(TMPDIR)/abc/abc.gcda test.rs
$(call RUN,test) || exit 1
[ -e "$(TMPDIR)/abc/abc.gcda" ] || (echo "gcda file not emitted to defined path"; exit 1)

View File

@ -0,0 +1,22 @@
// 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 run_make_support::{run, rustc};
use std::path::Path;
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");
}