Skip to content

Commit 695857b

Browse files
committed
Auto merge of #147943 - matthiaskrgr:rollup-rd0gb6y, r=matthiaskrgr
Rollup of 3 pull requests Successful merges: - #147929 (compiletest: Don't set `TARGET` for non run-make tests) - #147930 (motor: Add new `set_times` stubs) - #147934 (compiletest: More directive handling tweaks) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 869fb46 + 8baad70 commit 695857b

File tree

10 files changed

+39
-50
lines changed

10 files changed

+39
-50
lines changed

library/std/src/sys/fs/motor.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,14 @@ pub fn set_perm(path: &Path, perm: FilePermissions) -> io::Result<()> {
324324
moto_rt::fs::set_perm(path, perm.rt_perm).map_err(map_motor_error)
325325
}
326326

327+
pub fn set_times(_p: &Path, _times: FileTimes) -> io::Result<()> {
328+
unsupported()
329+
}
330+
331+
pub fn set_times_nofollow(_p: &Path, _times: FileTimes) -> io::Result<()> {
332+
unsupported()
333+
}
334+
327335
pub fn readlink(_p: &Path) -> io::Result<PathBuf> {
328336
unsupported()
329337
}

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.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,6 @@ mod directives {
256256
pub const NO_AUTO_CHECK_CFG: &'static str = "no-auto-check-cfg";
257257
pub const ADD_CORE_STUBS: &'static str = "add-core-stubs";
258258
pub const CORE_STUBS_COMPILE_FLAGS: &'static str = "core-stubs-compile-flags";
259-
// This isn't a real directive, just one that is probably mistyped often
260-
pub const INCORRECT_COMPILER_FLAGS: &'static str = "compiler-flags";
261259
pub const DISABLE_GDB_PRETTY_PRINTERS: &'static str = "disable-gdb-pretty-printers";
262260
pub const COMPARE_OUTPUT_BY_LINES: &'static str = "compare-output-by-lines";
263261
}
@@ -418,9 +416,6 @@ impl TestProps {
418416
}
419417
self.compile_flags.extend(flags);
420418
}
421-
if config.parse_name_value_directive(ln, INCORRECT_COMPILER_FLAGS).is_some() {
422-
panic!("`compiler-flags` directive should be spelled `compile-flags`");
423-
}
424419

425420
if let Some(range) = parse_edition_range(config, ln) {
426421
self.edition = Some(range.edition_to_test(config.edition));
@@ -504,7 +499,7 @@ impl TestProps {
504499
&mut self.check_test_line_numbers_match,
505500
);
506501

507-
self.update_pass_mode(ln, test_revision, config);
502+
self.update_pass_mode(ln, config);
508503
self.update_fail_mode(ln, config);
509504

510505
config.set_name_directive(ln, IGNORE_PASS, &mut self.ignore_pass);
@@ -686,9 +681,6 @@ impl TestProps {
686681
panic!("`{}-fail` directive is only supported in UI tests", mode);
687682
}
688683
};
689-
if config.mode == TestMode::Ui && config.parse_name_directive(ln, "compile-fail") {
690-
panic!("`compile-fail` directive is useless in UI tests");
691-
}
692684
let fail_mode = if config.parse_name_directive(ln, "check-fail") {
693685
check_ui("check");
694686
Some(FailMode::Check)
@@ -714,18 +706,15 @@ impl TestProps {
714706
}
715707
}
716708

717-
fn update_pass_mode(
718-
&mut self,
719-
ln: &DirectiveLine<'_>,
720-
revision: Option<&str>,
721-
config: &Config,
722-
) {
709+
fn update_pass_mode(&mut self, ln: &DirectiveLine<'_>, config: &Config) {
723710
let check_no_run = |s| match (config.mode, s) {
724711
(TestMode::Ui, _) => (),
725712
(TestMode::Crashes, _) => (),
726713
(TestMode::Codegen, "build-pass") => (),
727714
(TestMode::Incremental, _) => {
728-
if revision.is_some() && !self.revisions.iter().all(|r| r.starts_with("cfail")) {
715+
// FIXME(Zalathar): This only detects forbidden directives that are
716+
// declared _after_ the incompatible `//@ revisions:` directive(s).
717+
if self.revisions.iter().any(|r| !r.starts_with("cfail")) {
729718
panic!("`{s}` directive is only supported in `cfail` incremental tests")
730719
}
731720
}
@@ -812,6 +801,11 @@ fn check_directive<'a>(
812801
.map(|remark| remark.trim_start().split(' ').next().unwrap())
813802
.filter(|token| KNOWN_DIRECTIVE_NAMES.contains(token));
814803

804+
// FIXME(Zalathar): Consider emitting specialized error/help messages for
805+
// bogus directive names that are similar to real ones, e.g.:
806+
// - *`compiler-flags` => `compile-flags`
807+
// - *`compile-fail` => `check-fail` or `build-fail`
808+
815809
CheckDirectiveResult { is_known_directive, trailing_directive }
816810
}
817811

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
@@ -605,6 +605,8 @@ fn ignore_arch() {
605605
("i686-unknown-linux-gnu", "x86"),
606606
("nvptx64-nvidia-cuda", "nvptx64"),
607607
("thumbv7m-none-eabi", "thumb"),
608+
("i586-unknown-linux-gnu", "x86"),
609+
("i586-unknown-linux-gnu", "i586"),
608610
];
609611
for (target, arch) in archs {
610612
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: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
//@ assembly-output: emit-asm
22
// 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
3+
// (As of #136758, this test cross-compiles to selected i686 targets only, which have SSE.)
74
// Force frame pointers to make ASM more consistent between targets
85
//@ compile-flags: -C force-frame-pointers
96
// 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)