Skip to content

Commit c6c29bf

Browse files
committed
compiletest: remove needs-git-hash directive
Previously, `tests/run-make/version-verbose-commit-hash` relied upon information from *bootstrap* to determine if git-hash was available. However, this is flawed: if bootstrap's git-hash logic fails, the test that tries to check that the rustc is built with git-hash information may never run, because it's gated via `//@ needs-git-hash` that trusts bootstrap's information! Instead, we have to bypass bootstrap and communicate between CI jobs and the run-make test directly.
1 parent d88ffcd commit c6c29bf

File tree

5 files changed

+0
-33
lines changed

5 files changed

+0
-33
lines changed

src/tools/compiletest/src/common.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,6 @@ pub struct Config {
357357
/// The current Rust channel
358358
pub channel: String,
359359

360-
/// Whether adding git commit information such as the commit hash has been enabled for building
361-
pub git_hash: bool,
362-
363360
/// The default Rust edition
364361
pub edition: Option<String>,
365362

src/tools/compiletest/src/directive-list.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
135135
"needs-dynamic-linking",
136136
"needs-enzyme",
137137
"needs-force-clang-based-tests",
138-
"needs-git-hash",
139138
"needs-llvm-components",
140139
"needs-llvm-zstd",
141140
"needs-profiler-runtime",

src/tools/compiletest/src/header/needs.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,6 @@ pub(super) fn handle_needs(
129129
condition: cache.dlltool,
130130
ignore_reason: "ignored when dlltool for the current architecture is not present",
131131
},
132-
Need {
133-
name: "needs-git-hash",
134-
condition: config.git_hash,
135-
ignore_reason: "ignored when git hashes have been omitted for building",
136-
},
137132
Need {
138133
name: "needs-dynamic-linking",
139134
condition: config.target_cfg().dynamic_linking,

src/tools/compiletest/src/header/tests.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ struct ConfigBuilder {
7575
stage: Option<u32>,
7676
stage_id: Option<String>,
7777
llvm_version: Option<String>,
78-
git_hash: bool,
7978
system_llvm: bool,
8079
profiler_runtime: bool,
8180
rustc_debug_assertions: bool,
@@ -118,11 +117,6 @@ impl ConfigBuilder {
118117
self
119118
}
120119

121-
fn git_hash(&mut self, b: bool) -> &mut Self {
122-
self.git_hash = b;
123-
self
124-
}
125-
126120
fn system_llvm(&mut self, s: bool) -> &mut Self {
127121
self.system_llvm = s;
128122
self
@@ -184,9 +178,6 @@ impl ConfigBuilder {
184178
args.push(llvm_version.clone());
185179
}
186180

187-
if self.git_hash {
188-
args.push("--git-hash".to_owned());
189-
}
190181
if self.system_llvm {
191182
args.push("--system-llvm".to_owned());
192183
}
@@ -427,15 +418,6 @@ fn debugger() {
427418
assert!(check_ignore(&config, "//@ ignore-lldb"));
428419
}
429420

430-
#[test]
431-
fn git_hash() {
432-
let config: Config = cfg().git_hash(false).build();
433-
assert!(check_ignore(&config, "//@ needs-git-hash"));
434-
435-
let config: Config = cfg().git_hash(true).build();
436-
assert!(!check_ignore(&config, "//@ needs-git-hash"));
437-
}
438-
439421
#[test]
440422
fn sanitizers() {
441423
// Target that supports all sanitizers:

src/tools/compiletest/src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,6 @@ pub fn parse_config(args: Vec<String>) -> Config {
166166
.optflag("", "profiler-runtime", "is the profiler runtime enabled for this target")
167167
.optflag("h", "help", "show this message")
168168
.reqopt("", "channel", "current Rust channel", "CHANNEL")
169-
.optflag(
170-
"",
171-
"git-hash",
172-
"run tests which rely on commit version being compiled into the binaries",
173-
)
174169
.optopt("", "edition", "default Rust edition", "EDITION")
175170
.reqopt("", "git-repository", "name of the git repository", "ORG/REPO")
176171
.reqopt("", "nightly-branch", "name of the git branch for nightly", "BRANCH")
@@ -381,7 +376,6 @@ pub fn parse_config(args: Vec<String>) -> Config {
381376
has_html_tidy,
382377
has_enzyme,
383378
channel: matches.opt_str("channel").unwrap(),
384-
git_hash: matches.opt_present("git-hash"),
385379
edition: matches.opt_str("edition"),
386380

387381
cc: matches.opt_str("cc").unwrap(),

0 commit comments

Comments
 (0)