Skip to content

Commit 54c4762

Browse files
committed
fix remaining tests
1 parent 91be8ca commit 54c4762

File tree

4 files changed

+22
-14
lines changed

4 files changed

+22
-14
lines changed

src/bootstrap/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ impl Step for CompiletestTest {
694694
/// Runs `cargo test` for compiletest.
695695
fn run(self, builder: &Builder<'_>) {
696696
let host = self.host;
697-
let compiler = builder.compiler(0, host);
697+
let compiler = builder.compiler(1, host);
698698

699699
// We need `ToolStd` for the locally-built sysroot because
700700
// compiletest uses unstable features of the `test` crate.

src/tools/compiletest/src/common.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ impl TargetCfgs {
490490
#[serde(rename_all = "kebab-case")]
491491
pub struct TargetCfg {
492492
pub(crate) arch: String,
493-
#[serde(default)]
493+
#[serde(default = "default_os")]
494494
pub(crate) os: String,
495495
#[serde(default)]
496496
pub(crate) env: String,
@@ -506,6 +506,10 @@ pub struct TargetCfg {
506506
panic: PanicStrategy,
507507
}
508508

509+
fn default_os() -> String {
510+
"none".into()
511+
}
512+
509513
#[derive(Eq, PartialEq, Clone, Debug, Default, serde::Deserialize)]
510514
#[serde(rename_all = "kebab-case")]
511515
pub enum Endian {

src/tools/compiletest/src/header/cfg.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@ pub(super) fn parse_cfg_name_directive<'a>(
7070
message: "when the target is {name}"
7171
}
7272
condition! {
73-
name: &target_cfg.os,
73+
name: &[
74+
Some(&*target_cfg.os),
75+
// If something is ignored for emscripten, it likely also needs to be
76+
// ignored for wasm32-unknown-unknown.
77+
(config.target == "wasm32-unknown-unknown").then_some("emscripten"),
78+
],
7479
allowed_names: &target_cfgs.all_oses,
7580
message: "when the operative system is {name}"
7681
}
@@ -100,16 +105,9 @@ pub(super) fn parse_cfg_name_directive<'a>(
100105
message: "when the target family is {name}"
101106
}
102107

103-
// If something is ignored for emscripten, it likely also needs to be
104-
// ignored for wasm32-unknown-unknown.
105108
// `wasm32-bare` is an alias to refer to just wasm32-unknown-unknown
106109
// (in contrast to `wasm32` which also matches non-bare targets like
107110
// asmjs-unknown-emscripten).
108-
condition! {
109-
name: "emscripten",
110-
condition: config.target == "wasm32-unknown-unknown",
111-
message: "when the target is WASM",
112-
}
113111
condition! {
114112
name: "wasm32-bare",
115113
condition: config.target == "wasm32-unknown-unknown",
@@ -144,7 +142,7 @@ pub(super) fn parse_cfg_name_directive<'a>(
144142
}
145143
condition! {
146144
name: config.stage_id.split('-').next().unwrap(),
147-
allowed_names: &["stable", "beta", "nightly"],
145+
allowed_names: &["stage0", "stage1", "stage2"],
148146
message: "when the bootstrapping stage is {name}",
149147
}
150148
condition! {
@@ -287,6 +285,12 @@ impl<T: CustomMatches> CustomMatches for &[T] {
287285
}
288286
}
289287

288+
impl<const N: usize, T: CustomMatches> CustomMatches for [T; N] {
289+
fn custom_matches(&self, name: &str) -> bool {
290+
self.iter().any(|m| m.custom_matches(name))
291+
}
292+
}
293+
290294
impl<T: CustomMatches> CustomMatches for Option<T> {
291295
fn custom_matches(&self, name: &str) -> bool {
292296
match self {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn config() -> Config {
4747
"--src-base=",
4848
"--build-base=",
4949
"--sysroot-base=",
50-
"--stage-id=stage2",
50+
"--stage-id=stage2-x86_64-unknown-linux-gnu",
5151
"--cc=c",
5252
"--cxx=c++",
5353
"--cflags=",
@@ -174,7 +174,7 @@ fn ignore_target() {
174174
assert!(check_ignore(&config, "// ignore-gnu"));
175175
assert!(check_ignore(&config, "// ignore-64bit"));
176176

177-
assert!(!check_ignore(&config, "// ignore-i686"));
177+
assert!(!check_ignore(&config, "// ignore-x86"));
178178
assert!(!check_ignore(&config, "// ignore-windows"));
179179
assert!(!check_ignore(&config, "// ignore-msvc"));
180180
assert!(!check_ignore(&config, "// ignore-32bit"));
@@ -200,7 +200,7 @@ fn only_target() {
200200
#[test]
201201
fn stage() {
202202
let mut config = config();
203-
config.stage_id = "stage1".to_owned();
203+
config.stage_id = "stage1-x86_64-unknown-linux-gnu".to_owned();
204204

205205
assert!(check_ignore(&config, "// ignore-stage1"));
206206
assert!(!check_ignore(&config, "// ignore-stage2"));

0 commit comments

Comments
 (0)