Skip to content

Commit 1a51ab4

Browse files
Auto merge of #147896 - Zalathar:target, r=<try>
(EXPERIMENT) compiletest: Don't set `TARGET` for non-run-make tests try-job: dist-i586-gnu-i586-i686-musl
2 parents ebe145e + 9347126 commit 1a51ab4

File tree

8 files changed

+20
-35
lines changed

8 files changed

+20
-35
lines changed

src/tools/compiletest/src/common.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -701,10 +701,13 @@ impl Config {
701701
}
702702

703703
pub fn matches_arch(&self, arch: &str) -> bool {
704-
self.target_cfg().arch == arch ||
705-
// Matching all the thumb variants as one can be convenient.
706-
// (thumbv6m, thumbv7em, thumbv7m, etc.)
707-
(arch == "thumb" && self.target.starts_with("thumb"))
704+
self.target_cfg().arch == arch
705+
|| {
706+
// Matching all the thumb variants as one can be convenient.
707+
// (thumbv6m, thumbv7em, thumbv7m, etc.)
708+
arch == "thumb" && self.target.starts_with("thumb")
709+
}
710+
|| (arch == "i586" && self.target.starts_with("i586-"))
708711
}
709712

710713
pub fn matches_os(&self, os: &str) -> bool {

src/tools/compiletest/src/directives/cfg.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ fn parse_cfg_name_directive<'a>(
166166
message: "when the architecture is part of the Thumb family"
167167
}
168168

169+
// The "arch" of `i586-` targets is "x86", so for more specific matching
170+
// we have to resort to a string-prefix check.
171+
condition! {
172+
name: "i586",
173+
condition: config.matches_arch("i586"),
174+
message: "when the subarchitecture is i586",
175+
}
176+
169177
condition! {
170178
name: "apple",
171179
condition: config.target.contains("apple"),

src/tools/compiletest/src/directives/directive_names.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ pub(crate) const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
7070
"ignore-gnu",
7171
"ignore-haiku",
7272
"ignore-horizon",
73+
"ignore-i586",
7374
"ignore-i686-pc-windows-gnu",
7475
"ignore-i686-pc-windows-msvc",
7576
"ignore-illumos",

src/tools/compiletest/src/directives/tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,8 @@ fn ignore_arch() {
620620
("i686-unknown-linux-gnu", "x86"),
621621
("nvptx64-nvidia-cuda", "nvptx64"),
622622
("thumbv7m-none-eabi", "thumb"),
623+
("i586-unknown-linux-gnu", "x86"),
624+
("i586-unknown-linux-gnu", "i586"),
623625
];
624626
for (target, arch) in archs {
625627
let config: Config = cfg().target(target).build();

src/tools/compiletest/src/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -525,11 +525,6 @@ fn run_tests(config: Arc<Config>) {
525525
// SAFETY: at this point we're still single-threaded.
526526
unsafe { env::set_var("__COMPAT_LAYER", "RunAsInvoker") };
527527

528-
// Let tests know which target they're running as.
529-
//
530-
// SAFETY: at this point we're still single-threaded.
531-
unsafe { env::set_var("TARGET", &config.target) };
532-
533528
let mut configs = Vec::new();
534529
if let TestMode::DebugInfo = config.mode {
535530
// Debugging emscripten code doesn't make sense today

tests/assembly-llvm/x86-return-float.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
//@ assembly-output: emit-asm
2-
// FIXME(#114479): LLVM miscompiles loading and storing `f32` and `f64` when SSE is disabled.
3-
// There's no compiletest directive to ignore a test on i586 only, so just always explicitly enable
4-
// SSE2.
5-
// Use the same target CPU as `i686` so that LLVM orders the instructions in the same order.
6-
//@ compile-flags: -Ctarget-feature=+sse2 -Ctarget-cpu=pentium4
72
// Force frame pointers to make ASM more consistent between targets
83
//@ compile-flags: -C force-frame-pointers
94
// At opt-level=3, LLVM can merge two movss into one movsd, and we aren't testing for that.

tests/ui/abi/homogenous-floats-target-feature-mixup.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//@ run-pass
88
//@ needs-subprocess
99
//@ ignore-backends: gcc
10+
//@ ignore-i586 (no SSE2)
1011

1112
#![allow(overflowing_literals)]
1213
#![allow(unused_variables)]
@@ -19,16 +20,6 @@ fn main() {
1920
return test::main(&level)
2021
}
2122

22-
match std::env::var("TARGET") {
23-
Ok(s) => {
24-
// Skip this tests on i586-unknown-linux-gnu where sse2 is disabled
25-
if s.contains("i586") {
26-
return
27-
}
28-
}
29-
Err(_) => return,
30-
}
31-
3223
let me = env::current_exe().unwrap();
3324
for level in ["sse", "avx", "avx512"].iter() {
3425
let status = Command::new(&me).arg(level).status().unwrap();

tests/ui/target-feature/target-feature-detection.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,12 @@
22
//! specifically `sse2` on x86/x86_64 platforms, and correctly reports absent features.
33
44
//@ run-pass
5+
//@ ignore-i586 (no SSE2)
56

67
#![allow(stable_features)]
78
#![feature(cfg_target_feature)]
89

9-
use std::env;
10-
1110
fn main() {
12-
match env::var("TARGET") {
13-
Ok(s) => {
14-
// Skip this tests on i586-unknown-linux-gnu where sse2 is disabled
15-
if s.contains("i586") {
16-
return;
17-
}
18-
}
19-
Err(_) => return,
20-
}
2111
if cfg!(any(target_arch = "x86", target_arch = "x86_64")) {
2212
assert!(
2313
cfg!(target_feature = "sse2"),

0 commit comments

Comments
 (0)