| author | bors <bors@rust-lang.org> 2024-10-09 12:20:11 UTC |
| committer | bors <bors@rust-lang.org> 2024-10-09 12:20:11 UTC |
| log | a1eceec00b2684f947481696ae2322e20d59db60 |
| tree | 90dbe4b2378f89d0b80cd26cfa56d017597e825d |
| parent | 4203c686136428ab10e2765a00886b7c2909a477 |
| parent | 7a0e8bd1fd9998765ac99a640566c57eeda9882e |
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? jieyouxu19 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 |
| 2082 | 2082 | } |
| 2083 | 2083 | |
| 2084 | 2084 | if builder.config.profiler_enabled(target) { |
| 2085 | cmd.arg("--profiler-support"); | |
| 2085 | cmd.arg("--profiler-runtime"); | |
| 2086 | 2086 | } |
| 2087 | 2087 | |
| 2088 | 2088 | 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] = &[ |
| 129 | 129 | "needs-git-hash", |
| 130 | 130 | "needs-llvm-components", |
| 131 | 131 | "needs-llvm-zstd", |
| 132 | "needs-profiler-support", | |
| 132 | "needs-profiler-runtime", | |
| 133 | 133 | "needs-relocation-model-pic", |
| 134 | 134 | "needs-run-enabled", |
| 135 | 135 | "needs-rust-lld", |
src/tools/compiletest/src/common.rs+2-2| ... | ... | @@ -385,8 +385,8 @@ pub struct Config { |
| 385 | 385 | pub git_merge_commit_email: String, |
| 386 | 386 | |
| 387 | 387 | /// 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, | |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | impl Config { |
src/tools/compiletest/src/header.rs+1-1| ... | ... | @@ -851,7 +851,7 @@ fn iter_header( |
| 851 | 851 | // FIXME(jieyouxu): I feel like there's a better way to do this, leaving for later. |
| 852 | 852 | if mode == Mode::CoverageRun { |
| 853 | 853 | let extra_directives: &[&str] = &[ |
| 854 | "needs-profiler-support", | |
| 854 | "needs-profiler-runtime", | |
| 855 | 855 | // FIXME(pietroalbini): this test currently does not work on cross-compiled targets |
| 856 | 856 | // because remote-test is not capable of sending back the *.profraw files generated by |
| 857 | 857 | // the LLVM instrumentation. |
src/tools/compiletest/src/header/needs.rs+3-5| ... | ... | @@ -100,9 +100,9 @@ pub(super) fn handle_needs( |
| 100 | 100 | ignore_reason: "ignored on targets without unwinding support", |
| 101 | 101 | }, |
| 102 | 102 | 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", | |
| 106 | 106 | }, |
| 107 | 107 | Need { |
| 108 | 108 | name: "needs-force-clang-based-tests", |
| ... | ... | @@ -220,7 +220,6 @@ pub(super) struct CachedNeedsConditions { |
| 220 | 220 | sanitizer_memtag: bool, |
| 221 | 221 | sanitizer_shadow_call_stack: bool, |
| 222 | 222 | sanitizer_safestack: bool, |
| 223 | profiler_support: bool, | |
| 224 | 223 | xray: bool, |
| 225 | 224 | rust_lld: bool, |
| 226 | 225 | dlltool: bool, |
| ... | ... | @@ -247,7 +246,6 @@ impl CachedNeedsConditions { |
| 247 | 246 | sanitizer_memtag: sanitizers.contains(&Sanitizer::Memtag), |
| 248 | 247 | sanitizer_shadow_call_stack: sanitizers.contains(&Sanitizer::ShadowCallStack), |
| 249 | 248 | sanitizer_safestack: sanitizers.contains(&Sanitizer::Safestack), |
| 250 | profiler_support: config.profiler_support, | |
| 251 | 249 | xray: config.target_cfg().xray, |
| 252 | 250 | |
| 253 | 251 | // 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 { |
| 69 | 69 | llvm_version: Option<String>, |
| 70 | 70 | git_hash: bool, |
| 71 | 71 | system_llvm: bool, |
| 72 | profiler_support: bool, | |
| 72 | profiler_runtime: bool, | |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | impl ConfigBuilder { |
| ... | ... | @@ -113,8 +113,8 @@ impl ConfigBuilder { |
| 113 | 113 | self |
| 114 | 114 | } |
| 115 | 115 | |
| 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; | |
| 118 | 118 | self |
| 119 | 119 | } |
| 120 | 120 | |
| ... | ... | @@ -162,8 +162,8 @@ impl ConfigBuilder { |
| 162 | 162 | if self.system_llvm { |
| 163 | 163 | args.push("--system-llvm".to_owned()); |
| 164 | 164 | } |
| 165 | if self.profiler_support { | |
| 166 | args.push("--profiler-support".to_owned()); | |
| 165 | if self.profiler_runtime { | |
| 166 | args.push("--profiler-runtime".to_owned()); | |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | args.push("--rustc-path".to_string()); |
| ... | ... | @@ -368,12 +368,12 @@ fn sanitizers() { |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | #[test] |
| 371 | fn profiler_support() { | |
| 372 | let config: Config = cfg().profiler_support(false).build(); | |
| 373 | assert!(check_ignore(&config, "//@ needs-profiler-support")); | |
| 371 | fn profiler_runtime() { | |
| 372 | let config: Config = cfg().profiler_runtime(false).build(); | |
| 373 | assert!(check_ignore(&config, "//@ needs-profiler-runtime")); | |
| 374 | 374 | |
| 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")); | |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | #[test] |
| ... | ... | @@ -573,12 +573,12 @@ fn families() { |
| 573 | 573 | |
| 574 | 574 | #[test] |
| 575 | 575 | fn 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(); | |
| 578 | 578 | assert!(check_ignore(&config, "//@ ignore-coverage-map")); |
| 579 | 579 | assert!(!check_ignore(&config, "//@ ignore-coverage-run")); |
| 580 | 580 | |
| 581 | let config = cfg().mode("coverage-run").profiler_support(true).build(); | |
| 581 | let config = cfg().mode("coverage-run").profiler_runtime(true).build(); | |
| 582 | 582 | assert!(!check_ignore(&config, "//@ ignore-coverage-map")); |
| 583 | 583 | assert!(check_ignore(&config, "//@ ignore-coverage-run")); |
| 584 | 584 | } |
src/tools/compiletest/src/lib.rs+2-2| ... | ... | @@ -153,7 +153,7 @@ pub fn parse_config(args: Vec<String>) -> Config { |
| 153 | 153 | .optflag("", "force-rerun", "rerun tests even if the inputs are unchanged") |
| 154 | 154 | .optflag("", "only-modified", "only run tests that result been modified") |
| 155 | 155 | .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") | |
| 157 | 157 | .optflag("h", "help", "show this message") |
| 158 | 158 | .reqopt("", "channel", "current Rust channel", "CHANNEL") |
| 159 | 159 | .optflag( |
| ... | ... | @@ -355,7 +355,7 @@ pub fn parse_config(args: Vec<String>) -> Config { |
| 355 | 355 | nightly_branch: matches.opt_str("nightly-branch").unwrap(), |
| 356 | 356 | git_merge_commit_email: matches.opt_str("git-merge-commit-email").unwrap(), |
| 357 | 357 | |
| 358 | profiler_support: matches.opt_present("profiler-support"), | |
| 358 | profiler_runtime: matches.opt_present("profiler-runtime"), | |
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | 361 |
src/tools/compiletest/src/main.rs+1-1| ... | ... | @@ -22,7 +22,7 @@ fn main() { |
| 22 | 22 | eprintln!("warning: `tidy` is not installed; diffs will not be generated"); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | if !config.profiler_support && config.mode == Mode::CoverageRun { | |
| 25 | if !config.profiler_runtime && config.mode == Mode::CoverageRun { | |
| 26 | 26 | let actioned = if config.bless { "blessed" } else { "checked" }; |
| 27 | 27 | eprintln!( |
| 28 | 28 | r#" |
tests/run-make/cross-lang-lto-pgo-smoketest-clang/rmake.rs+1-1| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | // RUSTBUILD_FORCE_CLANG_BASED_TESTS and only runs tests which contain "clang" in their |
| 10 | 10 | // name. |
| 11 | 11 | |
| 12 | //@ needs-profiler-support | |
| 12 | //@ needs-profiler-runtime | |
| 13 | 13 | // FIXME(Oneirical): Except that due to the reliance on llvm-profdata, this test |
| 14 | 14 | // never runs, because `x86_64-gnu-debug` does not have the `profiler_builtins` crate. |
| 15 | 15 |
tests/run-make/optimization-remarks-dir-pgo/rmake.rs+1-1| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | // the output remark files. |
| 5 | 5 | // See https://github.com/rust-lang/rust/pull/114439 |
| 6 | 6 | |
| 7 | //@ needs-profiler-support | |
| 7 | //@ needs-profiler-runtime | |
| 8 | 8 | //@ ignore-cross-compile |
| 9 | 9 | |
| 10 | 10 | use run_make_support::{ |
tests/run-make/pgo-branch-weights/rmake.rs+1-1| ... | ... | @@ -7,7 +7,7 @@ |
| 7 | 7 | // If the test passes, the expected function call count was added to the use-phase LLVM-IR. |
| 8 | 8 | // See https://github.com/rust-lang/rust/pull/66631 |
| 9 | 9 | |
| 10 | //@ needs-profiler-support | |
| 10 | //@ needs-profiler-runtime | |
| 11 | 11 | //@ ignore-cross-compile |
| 12 | 12 | |
| 13 | 13 | use std::path::Path; |
tests/run-make/pgo-gen-lto/rmake.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | // should be generated. |
| 3 | 3 | // See https://github.com/rust-lang/rust/pull/48346 |
| 4 | 4 | |
| 5 | //@ needs-profiler-support | |
| 5 | //@ needs-profiler-runtime | |
| 6 | 6 | // Reason: this exercises LTO profiling |
| 7 | 7 | //@ ignore-cross-compile |
| 8 | 8 | // Reason: the compiled binary is executed |
tests/run-make/pgo-gen/rmake.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | // optimizes code. This test checks that these files are generated. |
| 4 | 4 | // See https://github.com/rust-lang/rust/pull/48346 |
| 5 | 5 | |
| 6 | //@ needs-profiler-support | |
| 6 | //@ needs-profiler-runtime | |
| 7 | 7 | //@ ignore-cross-compile |
| 8 | 8 | |
| 9 | 9 | use 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 @@ |
| 5 | 5 | // whether it can make a direct call instead of the indirect call. |
| 6 | 6 | // See https://github.com/rust-lang/rust/pull/66631 |
| 7 | 7 | |
| 8 | //@ needs-profiler-support | |
| 8 | //@ needs-profiler-runtime | |
| 9 | 9 | // Reason: llvm_profdata is used |
| 10 | 10 | //@ ignore-cross-compile |
| 11 | 11 | // Reason: the compiled binary is executed |
tests/run-make/pgo-use/rmake.rs+1-1| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | // be marked as cold. |
| 6 | 6 | // See https://github.com/rust-lang/rust/pull/60262 |
| 7 | 7 | |
| 8 | //@ needs-profiler-support | |
| 8 | //@ needs-profiler-runtime | |
| 9 | 9 | //@ ignore-cross-compile |
| 10 | 10 | |
| 11 | 11 | use run_make_support::{ |
tests/run-make/profile/rmake.rs+1-1| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | // See https://github.com/rust-lang/rust/pull/42433 |
| 7 | 7 | |
| 8 | 8 | //@ ignore-cross-compile |
| 9 | //@ needs-profiler-support | |
| 9 | //@ needs-profiler-runtime | |
| 10 | 10 | |
| 11 | 11 | use run_make_support::{path, run, rustc}; |
| 12 | 12 |
tests/run-make/track-pgo-dep-info/rmake.rs+1-1| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | |
| 7 | 7 | //@ ignore-cross-compile |
| 8 | 8 | // Reason: the binary is executed |
| 9 | //@ needs-profiler-support | |
| 9 | //@ needs-profiler-runtime | |
| 10 | 10 | |
| 11 | 11 | use run_make_support::{llvm_profdata, rfs, run, rustc}; |
| 12 | 12 |
tests/ui/coverage-attr/bad-attr-ice.rs+1-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | #![cfg_attr(feat, feature(coverage_attribute))] |
| 2 | 2 | //@ revisions: feat nofeat |
| 3 | 3 | //@ compile-flags: -Cinstrument-coverage |
| 4 | //@ needs-profiler-support | |
| 4 | //@ needs-profiler-runtime | |
| 5 | 5 | |
| 6 | 6 | // Malformed `#[coverage(..)]` attributes should not cause an ICE when built |
| 7 | 7 | // with `-Cinstrument-coverage`. |
tests/ui/issues/issue-85461.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@ compile-flags: -Cinstrument-coverage -Ccodegen-units=4 --crate-type dylib -Copt-level=0 |
| 2 | 2 | //@ build-pass |
| 3 | //@ needs-profiler-support | |
| 3 | //@ needs-profiler-runtime | |
| 4 | 4 | //@ needs-dynamic-linking |
| 5 | 5 | |
| 6 | 6 | // Regression test for #85461 where MSVC sometimes fails to link instrument-coverage binaries |