Skip to content

Commit 3cc59ae

Browse files
authored
Rollup merge of rust-lang#125226 - madsmtm:fix-mac-catalyst-tests, r=workingjubilee
Make more of the test suite run on Mac Catalyst Combined with rust-lang#125225, the only failing parts of the test suite are in `tests/rustdoc-js`, `tests/rustdoc-js-std` and `tests/debuginfo`. Tested with: ```console ./x test --target=aarch64-apple-ios-macabi library/std ./x test --target=aarch64-apple-ios-macabi --skip=tests/rustdoc-js --skip=tests/rustdoc-js-std --skip=tests/debuginfo tests ``` Will probably put up a PR later to enable _running_ on (not just compiling for) Mac Catalyst in CI, though not sure where exactly I should do so? `src/ci/github-actions/jobs.yml`? Note that I've deliberately _not_ enabled stack overflow handlers on iOS/tvOS/watchOS/visionOS (see rust-lang#25872), but rather just skipped those tests, as it uses quite a few APIs that I'd be weary about getting rejected by the App Store (note that Swift doesn't do it on those platforms either). r? ``@workingjubilee`` CC ``@thomcc`` ``@rustbot`` label O-ios O-apple
2 parents 7e441a1 + e6b9bb7 commit 3cc59ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+120
-100
lines changed

library/std/src/fs/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@ fn metadata_access_times() {
14311431
assert_eq!(check!(a.modified()), check!(a.modified()));
14321432
assert_eq!(check!(b.accessed()), check!(b.modified()));
14331433

1434-
if cfg!(target_os = "macos") || cfg!(target_os = "windows") {
1434+
if cfg!(target_vendor = "apple") || cfg!(target_os = "windows") {
14351435
check!(a.created());
14361436
check!(b.created());
14371437
}

library/std/src/sys/pal/unix/stack_overflow.rs

+8
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,14 @@ mod imp {
491491
}
492492
}
493493

494+
// This is intentionally not enabled on iOS/tvOS/watchOS/visionOS, as it uses
495+
// several symbols that might lead to rejections from the App Store, namely
496+
// `sigaction`, `sigaltstack`, `sysctlbyname`, `mmap`, `munmap` and `mprotect`.
497+
//
498+
// This might be overly cautious, though it is also what Swift does (and they
499+
// usually have fewer qualms about forwards compatibility, since the runtime
500+
// is shipped with the OS):
501+
// <https://github.com/apple/swift/blob/swift-5.10-RELEASE/stdlib/public/runtime/CrashHandlerMacOS.cpp>
494502
#[cfg(not(any(
495503
target_os = "linux",
496504
target_os = "freebsd",

src/bootstrap/src/utils/dylib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
pub fn dylib_path_var() -> &'static str {
66
if cfg!(target_os = "windows") {
77
"PATH"
8-
} else if cfg!(target_os = "macos") {
8+
} else if cfg!(target_vendor = "apple") {
99
"DYLD_LIBRARY_PATH"
1010
} else if cfg!(target_os = "haiku") {
1111
"LIBRARY_PATH"

src/tools/compiletest/src/header.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
747747
"ignore-aarch64",
748748
"ignore-aarch64-unknown-linux-gnu",
749749
"ignore-android",
750+
"ignore-apple",
750751
"ignore-arm",
751752
"ignore-avr",
752753
"ignore-beta",
@@ -829,7 +830,6 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
829830
"ignore-x32",
830831
"ignore-x86",
831832
"ignore-x86_64",
832-
"ignore-x86_64-apple-darwin",
833833
"ignore-x86_64-unknown-linux-gnu",
834834
"incremental",
835835
"known-bug",
@@ -876,6 +876,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
876876
"only-32bit",
877877
"only-64bit",
878878
"only-aarch64",
879+
"only-apple",
879880
"only-arm",
880881
"only-avr",
881882
"only-beta",

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

+6
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@ pub(super) fn parse_cfg_name_directive<'a>(
159159
message: "when the architecture is part of the Thumb family"
160160
}
161161

162+
condition! {
163+
name: "apple",
164+
condition: config.target.contains("apple"),
165+
message: "when the target vendor is Apple"
166+
}
167+
162168
// Technically the locally built compiler uses the "dev" channel rather than the "nightly"
163169
// channel, even though most people don't know or won't care about it. To avoid confusion, we
164170
// treat the "dev" channel as the "nightly" channel when processing the directive.

src/tools/compiletest/src/runtest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fn get_lib_name(lib: &str, aux_type: AuxType) -> Option<String> {
9898
AuxType::Lib => Some(format!("lib{}.rlib", lib)),
9999
AuxType::Dylib => Some(if cfg!(windows) {
100100
format!("{}.dll", lib)
101-
} else if cfg!(target_os = "macos") {
101+
} else if cfg!(target_vendor = "apple") {
102102
format!("lib{}.dylib", lib)
103103
} else {
104104
format!("lib{}.so", lib)

src/tools/compiletest/src/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl PathBufExt for PathBuf {
5757
pub fn dylib_env_var() -> &'static str {
5858
if cfg!(windows) {
5959
"PATH"
60-
} else if cfg!(target_os = "macos") {
60+
} else if cfg!(target_vendor = "apple") {
6161
"DYLD_LIBRARY_PATH"
6262
} else if cfg!(target_os = "haiku") {
6363
"LIBRARY_PATH"

src/tools/tidy/src/issues.txt

-1
Original file line numberDiff line numberDiff line change
@@ -2122,7 +2122,6 @@ ui/issues/issue-33687.rs
21222122
ui/issues/issue-33770.rs
21232123
ui/issues/issue-3389.rs
21242124
ui/issues/issue-33941.rs
2125-
ui/issues/issue-33992.rs
21262125
ui/issues/issue-34047.rs
21272126
ui/issues/issue-34074.rs
21282127
ui/issues/issue-34209.rs

src/tools/tidy/src/ui_tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::path::{Path, PathBuf};
1515
const ENTRY_LIMIT: u32 = 900;
1616
// FIXME: The following limits should be reduced eventually.
1717

18-
const ISSUES_ENTRY_LIMIT: u32 = 1676;
18+
const ISSUES_ENTRY_LIMIT: u32 = 1674;
1919

2020
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
2121
"rs", // test source files

tests/assembly/stack-protector/stack-protector-heuristics-effect.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ revisions: all strong basic none missing
22
//@ assembly-output: emit-asm
3-
//@ ignore-macos slightly different policy on stack protection of arrays
3+
//@ ignore-apple slightly different policy on stack protection of arrays
44
//@ ignore-msvc stack check code uses different function names
55
//@ ignore-nvptx64 stack protector is not supported
66
//@ ignore-wasm32-bare
@@ -17,12 +17,9 @@
1717
// See comments on https://github.com/rust-lang/rust/issues/114903.
1818

1919
#![crate_type = "lib"]
20-
2120
#![allow(incomplete_features)]
22-
2321
#![feature(unsized_locals, unsized_fn_params)]
2422

25-
2623
// CHECK-LABEL: emptyfn:
2724
#[no_mangle]
2825
pub fn emptyfn() {

tests/assembly/x86_64-array-pair-load-store-merge.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel
33
//@ only-x86_64
44
//@ ignore-sgx
5-
//@ ignore-macos (manipulates rsp too)
5+
//@ ignore-apple (manipulates rsp too)
66

77
// Depending on various codegen choices, this might end up copying
88
// a `<2 x i8>`, an `i16`, or two `i8`s.

tests/assembly/x86_64-function-return.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//@ [keep-thunk-extern] compile-flags: -Zfunction-return=keep -Zfunction-return=thunk-extern
1010
//@ [thunk-extern-keep] compile-flags: -Zfunction-return=thunk-extern -Zfunction-return=keep
1111
//@ only-x86_64
12-
//@ ignore-x86_64-apple-darwin Symbol is called `___x86_return_thunk` (Darwin's extra underscore)
12+
//@ ignore-apple Symbol is called `___x86_return_thunk` (Darwin's extra underscore)
1313
//@ ignore-sgx Tests incompatible with LVI mitigations
1414

1515
#![crate_type = "lib"]

tests/codegen/gdb_debug_script_load.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
//@ ignore-windows
3-
//@ ignore-macos
3+
//@ ignore-apple
44
//@ ignore-wasm
55
//@ ignore-emscripten
66

tests/codegen/instrument-coverage/testprog.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//@ [LINUX] filecheck-flags: -DINSTR_PROF_COVFUN=__llvm_covfun
1212
//@ [LINUX] filecheck-flags: '-DCOMDAT_IF_SUPPORTED=, comdat'
1313

14-
//@ [DARWIN] only-macos
14+
//@ [DARWIN] only-apple
1515
//@ [DARWIN] filecheck-flags: -DINSTR_PROF_DATA=__DATA,__llvm_prf_data,regular,live_support
1616
//@ [DARWIN] filecheck-flags: -DINSTR_PROF_NAME=__DATA,__llvm_prf_names
1717
//@ [DARWIN] filecheck-flags: -DINSTR_PROF_CNTS=__DATA,__llvm_prf_cnts
@@ -49,7 +49,7 @@ where
4949

5050
pub fn wrap_with<F, T>(inner: T, should_wrap: bool, wrapper: F)
5151
where
52-
F: FnOnce(&T)
52+
F: FnOnce(&T),
5353
{
5454
if should_wrap {
5555
wrapper(&inner)

tests/codegen/issues/issue-44056-macos-tls-align.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
//@ only-macos
2+
//@ only-apple
33
//@ compile-flags: -O
44

55
#![crate_type = "rlib"]

tests/codegen/mainsubprogram.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
// before 4.0, formerly backported to the Rust LLVM fork.
33

44
//@ ignore-windows
5-
//@ ignore-macos
5+
//@ ignore-apple
66
//@ ignore-wasi
77

88
//@ compile-flags: -g -C no-prepopulate-passes
99

1010
// CHECK-LABEL: @main
1111
// CHECK: {{.*}}DISubprogram{{.*}}name: "main",{{.*}}DI{{(SP)?}}FlagMainSubprogram{{.*}}
1212

13-
pub fn main() {
14-
}
13+
pub fn main() {}

tests/codegen/mainsubprogramstart.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ ignore-windows
2-
//@ ignore-macos
2+
//@ ignore-apple
33
//@ ignore-wasi wasi codegens the main symbol differently
44

55
//@ compile-flags: -g -C no-prepopulate-passes

tests/codegen/pgo-counter-bias.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Test that __llvm_profile_counter_bias does not get internalized by lto.
22

3-
//@ ignore-macos -runtime-counter-relocation not honored on Mach-O
3+
//@ ignore-apple -runtime-counter-relocation not honored on Mach-O
44
//@ compile-flags: -Cprofile-generate -Cllvm-args=-runtime-counter-relocation -Clto=fat
55
//@ needs-profiler-support
66
//@ no-prefer-dynamic

tests/run-make/c-dynamic-dylib/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# ignore-cross-compile
55
include ../tools.mk
66

7-
# ignore-macos
7+
# ignore-apple
88
#
99
# This hits an assertion in the linker on older versions of osx apparently
1010

tests/run-make/c-dynamic-rlib/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# ignore-cross-compile
55
include ../tools.mk
66

7-
# ignore-macos
7+
# ignore-apple
88
#
99
# This hits an assertion in the linker on older versions of osx apparently
1010

tests/run-make/emit-stack-sizes/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
include ../tools.mk
22

33
# ignore-windows
4-
# ignore-macos
4+
# ignore-apple
55
#
66
# This feature only works when the output object format is ELF so we ignore
7-
# macOS and Windows
7+
# Apple and Windows
88

99
# check that the .stack_sizes section is generated
1010
all:

tests/run-make/fpic/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
include ../tools.mk
33

44
# ignore-windows
5-
# ignore-macos
5+
# ignore-apple
66

77
# Test for #39529.
88
# `-z text` causes ld to error if there are any non-PIC sections

tests/run-make/link-framework/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# only-macos
1+
# only-apple
22
#
33
# Check that linking to a framework actually makes it to the linker.
44

tests/run-make/macos-fat-archive/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# only-macos
1+
# only-apple
22

33
include ../tools.mk
44

tests/run-make/native-link-modifier-verbatim-linker/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ignore-cross-compile
2-
# ignore-macos
2+
# ignore-apple
33

44
include ../tools.mk
55

tests/run-make/used-cdylib-macos/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
include ../tools.mk
22

3-
# only-macos
3+
# only-apple
44
#
55
# This checks that `#[used]` passes through to the linker on
6-
# darwin. This is subject to change in the future, see
6+
# Apple targets. This is subject to change in the future, see
77
# https://github.com/rust-lang/rust/pull/93718 for discussion
88

99
all:

tests/run-pass-valgrind/exit-flushes.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ ignore-wasm32 no subprocess support
22
//@ ignore-sgx no processes
3-
//@ ignore-macos this needs valgrind 3.11 or higher; see
3+
//@ ignore-apple this needs valgrind 3.11 or higher; see
44
// https://github.com/rust-lang/rust/pull/30365#issuecomment-165763679
55

66
use std::env;
@@ -11,8 +11,7 @@ fn main() {
1111
print!("hello!");
1212
exit(0);
1313
} else {
14-
let out = Command::new(env::args().next().unwrap()).arg("foo")
15-
.output().unwrap();
14+
let out = Command::new(env::args().next().unwrap()).arg("foo").output().unwrap();
1615
assert!(out.status.success());
1716
assert_eq!(String::from_utf8(out.stdout).unwrap(), "hello!");
1817
assert_eq!(String::from_utf8(out.stderr).unwrap(), "");

tests/ui/abi/stack-probes-lto.rs

+4
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,9 @@
1010
//@ compile-flags: -C lto
1111
//@ no-prefer-dynamic
1212
//@ ignore-nto Crash analysis impossible at SIGSEGV in QNX Neutrino
13+
//@ ignore-ios Stack probes are enabled, but the SIGSEGV handler isn't
14+
//@ ignore-tvos Stack probes are enabled, but the SIGSEGV handler isn't
15+
//@ ignore-watchos Stack probes are enabled, but the SIGSEGV handler isn't
16+
//@ ignore-visionos Stack probes are enabled, but the SIGSEGV handler isn't
1317

1418
include!("stack-probes.rs");

tests/ui/abi/stack-probes.rs

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
//@ ignore-sgx no processes
99
//@ ignore-fuchsia no exception handler registered for segfault
1010
//@ ignore-nto Crash analysis impossible at SIGSEGV in QNX Neutrino
11+
//@ ignore-ios Stack probes are enabled, but the SIGSEGV handler isn't
12+
//@ ignore-tvos Stack probes are enabled, but the SIGSEGV handler isn't
13+
//@ ignore-watchos Stack probes are enabled, but the SIGSEGV handler isn't
14+
//@ ignore-visionos Stack probes are enabled, but the SIGSEGV handler isn't
1115

1216
use std::env;
1317
use std::mem::MaybeUninit;

tests/ui/backtrace/apple-no-dsymutil.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
//@ compile-flags:-Cstrip=none
44
//@ compile-flags:-g -Csplit-debuginfo=unpacked
5-
//@ only-macos
5+
//@ only-apple
66

77
use std::process::Command;
88
use std::str;

tests/ui/deployment-target/macos-target.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ only-macos
1+
//@ only-apple
22
//@ compile-flags: --print deployment-target
33
//@ normalize-stdout-test: "\d+\." -> "$$CURRENT_MAJOR_VERSION."
44
//@ normalize-stdout-test: "\d+" -> "$$CURRENT_MINOR_VERSION"

tests/ui/intrinsics/intrinsic-alignment.rs

+15-14
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,21 @@ mod rusti {
1010
}
1111
}
1212

13-
#[cfg(any(target_os = "android",
14-
target_os = "dragonfly",
15-
target_os = "emscripten",
16-
target_os = "freebsd",
17-
target_os = "fuchsia",
18-
target_os = "hurd",
19-
target_os = "illumos",
20-
target_os = "linux",
21-
target_os = "macos",
22-
target_os = "netbsd",
23-
target_os = "openbsd",
24-
target_os = "solaris",
25-
target_os = "vxworks",
26-
target_os = "nto",
13+
#[cfg(any(
14+
target_os = "android",
15+
target_os = "dragonfly",
16+
target_os = "emscripten",
17+
target_os = "freebsd",
18+
target_os = "fuchsia",
19+
target_os = "hurd",
20+
target_os = "illumos",
21+
target_os = "linux",
22+
target_os = "netbsd",
23+
target_os = "openbsd",
24+
target_os = "solaris",
25+
target_os = "vxworks",
26+
target_os = "nto",
27+
target_vendor = "apple",
2728
))]
2829
mod m {
2930
#[cfg(target_arch = "x86")]

tests/ui/issues/issue-45731.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,24 @@
22
#![allow(unused_variables)]
33
//@ compile-flags:--test -g
44

5-
#[cfg(target_os = "macos")]
5+
#[cfg(target_vendor = "apple")]
66
#[test]
77
fn simple_test() {
8-
use std::{env, panic, fs};
8+
use std::{env, fs, panic};
99

1010
// Find our dSYM and replace the DWARF binary with an empty file
1111
let mut dsym_path = env::current_exe().unwrap();
1212
let executable_name = dsym_path.file_name().unwrap().to_str().unwrap().to_string();
1313
assert!(dsym_path.pop()); // Pop executable
1414
dsym_path.push(format!("{}.dSYM/Contents/Resources/DWARF/{0}", executable_name));
1515
{
16-
let file = fs::OpenOptions::new().read(false).write(true).truncate(true).create(false)
17-
.open(&dsym_path).unwrap();
16+
let file = fs::OpenOptions::new()
17+
.read(false)
18+
.write(true)
19+
.truncate(true)
20+
.create(false)
21+
.open(&dsym_path)
22+
.unwrap();
1823
}
1924

2025
env::set_var("RUST_BACKTRACE", "1");

0 commit comments

Comments
 (0)