diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 2050189cead..0cb3275d7e9 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -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 diff --git a/tests/run-make/profile/Makefile b/tests/run-make/profile/Makefile deleted file mode 100644 index 7919b18ba74..00000000000 --- a/tests/run-make/profile/Makefile +++ /dev/null @@ -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) diff --git a/tests/run-make/profile/rmake.rs b/tests/run-make/profile/rmake.rs new file mode 100644 index 00000000000..8d41978baec --- /dev/null +++ b/tests/run-make/profile/rmake.rs @@ -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"); +}