authorbors <bors@rust-lang.org> 2024-10-09 12:20:11 UTC
committerbors <bors@rust-lang.org> 2024-10-09 12:20:11 UTC
loga1eceec00b2684f947481696ae2322e20d59db60
tree90dbe4b2378f89d0b80cd26cfa56d017597e825d
parent4203c686136428ab10e2765a00886b7c2909a477
parent7a0e8bd1fd9998765ac99a640566c57eeda9882e

Auto merge of #131429 - Zalathar:needs-profiler-runtime, r=jieyouxu

Rename directive `needs-profiler-support` to `needs-profiler-runtime` The rest of the compiler mostly refers to this as `profiler_runtime`, so having a directive named `needs-profiler-support` was causing a lot of confusion. r? jieyouxu

19 files changed, 35 insertions(+), 37 deletions(-)

src/bootstrap/src/core/build_steps/test.rs+1-1
......@@ -2082,7 +2082,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
20822082 }
20832083
20842084 if builder.config.profiler_enabled(target) {
2085 cmd.arg("--profiler-support");
2085 cmd.arg("--profiler-runtime");
20862086 }
20872087
20882088 cmd.env("RUST_TEST_TMPDIR", builder.tempdir());
src/tools/compiletest/src/command-list.rs+1-1
......@@ -129,7 +129,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
129129 "needs-git-hash",
130130 "needs-llvm-components",
131131 "needs-llvm-zstd",
132 "needs-profiler-support",
132 "needs-profiler-runtime",
133133 "needs-relocation-model-pic",
134134 "needs-run-enabled",
135135 "needs-rust-lld",
src/tools/compiletest/src/common.rs+2-2
......@@ -385,8 +385,8 @@ pub struct Config {
385385 pub git_merge_commit_email: String,
386386
387387 /// True if the profiler runtime is enabled for this target.
388 /// Used by the "needs-profiler-support" header in test files.
389 pub profiler_support: bool,
388 /// Used by the "needs-profiler-runtime" directive in test files.
389 pub profiler_runtime: bool,
390390}
391391
392392impl Config {
src/tools/compiletest/src/header.rs+1-1
......@@ -851,7 +851,7 @@ fn iter_header(
851851 // FIXME(jieyouxu): I feel like there's a better way to do this, leaving for later.
852852 if mode == Mode::CoverageRun {
853853 let extra_directives: &[&str] = &[
854 "needs-profiler-support",
854 "needs-profiler-runtime",
855855 // FIXME(pietroalbini): this test currently does not work on cross-compiled targets
856856 // because remote-test is not capable of sending back the *.profraw files generated by
857857 // the LLVM instrumentation.
src/tools/compiletest/src/header/needs.rs+3-5
......@@ -100,9 +100,9 @@ pub(super) fn handle_needs(
100100 ignore_reason: "ignored on targets without unwinding support",
101101 },
102102 Need {
103 name: "needs-profiler-support",
104 condition: cache.profiler_support,
105 ignore_reason: "ignored when profiler support is disabled",
103 name: "needs-profiler-runtime",
104 condition: config.profiler_runtime,
105 ignore_reason: "ignored when the profiler runtime is not available",
106106 },
107107 Need {
108108 name: "needs-force-clang-based-tests",
......@@ -220,7 +220,6 @@ pub(super) struct CachedNeedsConditions {
220220 sanitizer_memtag: bool,
221221 sanitizer_shadow_call_stack: bool,
222222 sanitizer_safestack: bool,
223 profiler_support: bool,
224223 xray: bool,
225224 rust_lld: bool,
226225 dlltool: bool,
......@@ -247,7 +246,6 @@ impl CachedNeedsConditions {
247246 sanitizer_memtag: sanitizers.contains(&Sanitizer::Memtag),
248247 sanitizer_shadow_call_stack: sanitizers.contains(&Sanitizer::ShadowCallStack),
249248 sanitizer_safestack: sanitizers.contains(&Sanitizer::Safestack),
250 profiler_support: config.profiler_support,
251249 xray: config.target_cfg().xray,
252250
253251 // For tests using the `needs-rust-lld` directive (e.g. for `-Clink-self-contained=+linker`),
src/tools/compiletest/src/header/tests.rs+13-13
......@@ -69,7 +69,7 @@ struct ConfigBuilder {
6969 llvm_version: Option<String>,
7070 git_hash: bool,
7171 system_llvm: bool,
72 profiler_support: bool,
72 profiler_runtime: bool,
7373}
7474
7575impl ConfigBuilder {
......@@ -113,8 +113,8 @@ impl ConfigBuilder {
113113 self
114114 }
115115
116 fn profiler_support(&mut self, s: bool) -> &mut Self {
117 self.profiler_support = s;
116 fn profiler_runtime(&mut self, is_available: bool) -> &mut Self {
117 self.profiler_runtime = is_available;
118118 self
119119 }
120120
......@@ -162,8 +162,8 @@ impl ConfigBuilder {
162162 if self.system_llvm {
163163 args.push("--system-llvm".to_owned());
164164 }
165 if self.profiler_support {
166 args.push("--profiler-support".to_owned());
165 if self.profiler_runtime {
166 args.push("--profiler-runtime".to_owned());
167167 }
168168
169169 args.push("--rustc-path".to_string());
......@@ -368,12 +368,12 @@ fn sanitizers() {
368368}
369369
370370#[test]
371fn profiler_support() {
372 let config: Config = cfg().profiler_support(false).build();
373 assert!(check_ignore(&config, "//@ needs-profiler-support"));
371fn profiler_runtime() {
372 let config: Config = cfg().profiler_runtime(false).build();
373 assert!(check_ignore(&config, "//@ needs-profiler-runtime"));
374374
375 let config: Config = cfg().profiler_support(true).build();
376 assert!(!check_ignore(&config, "//@ needs-profiler-support"));
375 let config: Config = cfg().profiler_runtime(true).build();
376 assert!(!check_ignore(&config, "//@ needs-profiler-runtime"));
377377}
378378
379379#[test]
......@@ -573,12 +573,12 @@ fn families() {
573573
574574#[test]
575575fn ignore_coverage() {
576 // Indicate profiler support so that "coverage-run" tests aren't skipped.
577 let config = cfg().mode("coverage-map").profiler_support(true).build();
576 // Indicate profiler runtime availability so that "coverage-run" tests aren't skipped.
577 let config = cfg().mode("coverage-map").profiler_runtime(true).build();
578578 assert!(check_ignore(&config, "//@ ignore-coverage-map"));
579579 assert!(!check_ignore(&config, "//@ ignore-coverage-run"));
580580
581 let config = cfg().mode("coverage-run").profiler_support(true).build();
581 let config = cfg().mode("coverage-run").profiler_runtime(true).build();
582582 assert!(!check_ignore(&config, "//@ ignore-coverage-map"));
583583 assert!(check_ignore(&config, "//@ ignore-coverage-run"));
584584}
src/tools/compiletest/src/lib.rs+2-2
......@@ -153,7 +153,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
153153 .optflag("", "force-rerun", "rerun tests even if the inputs are unchanged")
154154 .optflag("", "only-modified", "only run tests that result been modified")
155155 .optflag("", "nocapture", "")
156 .optflag("", "profiler-support", "is the profiler runtime enabled for this target")
156 .optflag("", "profiler-runtime", "is the profiler runtime enabled for this target")
157157 .optflag("h", "help", "show this message")
158158 .reqopt("", "channel", "current Rust channel", "CHANNEL")
159159 .optflag(
......@@ -355,7 +355,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
355355 nightly_branch: matches.opt_str("nightly-branch").unwrap(),
356356 git_merge_commit_email: matches.opt_str("git-merge-commit-email").unwrap(),
357357
358 profiler_support: matches.opt_present("profiler-support"),
358 profiler_runtime: matches.opt_present("profiler-runtime"),
359359 }
360360}
361361
src/tools/compiletest/src/main.rs+1-1
......@@ -22,7 +22,7 @@ fn main() {
2222 eprintln!("warning: `tidy` is not installed; diffs will not be generated");
2323 }
2424
25 if !config.profiler_support && config.mode == Mode::CoverageRun {
25 if !config.profiler_runtime && config.mode == Mode::CoverageRun {
2626 let actioned = if config.bless { "blessed" } else { "checked" };
2727 eprintln!(
2828 r#"
tests/run-make/cross-lang-lto-pgo-smoketest-clang/rmake.rs+1-1
......@@ -9,7 +9,7 @@
99// RUSTBUILD_FORCE_CLANG_BASED_TESTS and only runs tests which contain "clang" in their
1010// name.
1111
12//@ needs-profiler-support
12//@ needs-profiler-runtime
1313// FIXME(Oneirical): Except that due to the reliance on llvm-profdata, this test
1414// never runs, because `x86_64-gnu-debug` does not have the `profiler_builtins` crate.
1515
tests/run-make/optimization-remarks-dir-pgo/rmake.rs+1-1
......@@ -4,7 +4,7 @@
44// the output remark files.
55// See https://github.com/rust-lang/rust/pull/114439
66
7//@ needs-profiler-support
7//@ needs-profiler-runtime
88//@ ignore-cross-compile
99
1010use run_make_support::{
tests/run-make/pgo-branch-weights/rmake.rs+1-1
......@@ -7,7 +7,7 @@
77// If the test passes, the expected function call count was added to the use-phase LLVM-IR.
88// See https://github.com/rust-lang/rust/pull/66631
99
10//@ needs-profiler-support
10//@ needs-profiler-runtime
1111//@ ignore-cross-compile
1212
1313use std::path::Path;
tests/run-make/pgo-gen-lto/rmake.rs+1-1
......@@ -2,7 +2,7 @@
22// should be generated.
33// See https://github.com/rust-lang/rust/pull/48346
44
5//@ needs-profiler-support
5//@ needs-profiler-runtime
66// Reason: this exercises LTO profiling
77//@ ignore-cross-compile
88// Reason: the compiled binary is executed
tests/run-make/pgo-gen/rmake.rs+1-1
......@@ -3,7 +3,7 @@
33// optimizes code. This test checks that these files are generated.
44// See https://github.com/rust-lang/rust/pull/48346
55
6//@ needs-profiler-support
6//@ needs-profiler-runtime
77//@ ignore-cross-compile
88
99use run_make_support::{cwd, has_extension, has_prefix, run, rustc, shallow_find_files};
tests/run-make/pgo-indirect-call-promotion/rmake.rs+1-1
......@@ -5,7 +5,7 @@
55// whether it can make a direct call instead of the indirect call.
66// See https://github.com/rust-lang/rust/pull/66631
77
8//@ needs-profiler-support
8//@ needs-profiler-runtime
99// Reason: llvm_profdata is used
1010//@ ignore-cross-compile
1111// Reason: the compiled binary is executed
tests/run-make/pgo-use/rmake.rs+1-1
......@@ -5,7 +5,7 @@
55// be marked as cold.
66// See https://github.com/rust-lang/rust/pull/60262
77
8//@ needs-profiler-support
8//@ needs-profiler-runtime
99//@ ignore-cross-compile
1010
1111use run_make_support::{
tests/run-make/profile/rmake.rs+1-1
......@@ -6,7 +6,7 @@
66// See https://github.com/rust-lang/rust/pull/42433
77
88//@ ignore-cross-compile
9//@ needs-profiler-support
9//@ needs-profiler-runtime
1010
1111use run_make_support::{path, run, rustc};
1212
tests/run-make/track-pgo-dep-info/rmake.rs+1-1
......@@ -6,7 +6,7 @@
66
77//@ ignore-cross-compile
88// Reason: the binary is executed
9//@ needs-profiler-support
9//@ needs-profiler-runtime
1010
1111use run_make_support::{llvm_profdata, rfs, run, rustc};
1212
tests/ui/coverage-attr/bad-attr-ice.rs+1-1
......@@ -1,7 +1,7 @@
11#![cfg_attr(feat, feature(coverage_attribute))]
22//@ revisions: feat nofeat
33//@ compile-flags: -Cinstrument-coverage
4//@ needs-profiler-support
4//@ needs-profiler-runtime
55
66// Malformed `#[coverage(..)]` attributes should not cause an ICE when built
77// with `-Cinstrument-coverage`.
tests/ui/issues/issue-85461.rs+1-1
......@@ -1,6 +1,6 @@
11//@ compile-flags: -Cinstrument-coverage -Ccodegen-units=4 --crate-type dylib -Copt-level=0
22//@ build-pass
3//@ needs-profiler-support
3//@ needs-profiler-runtime
44//@ needs-dynamic-linking
55
66// Regression test for #85461 where MSVC sometimes fails to link instrument-coverage binaries