Make more of the test suite run on Mac Catalyst

This adds the `only-apple`/`ignore-apple` compiletest directive, and
uses that basically everywhere instead of `only-macos`/`ignore-macos`.

Some of the updates in `run-make` are a bit redundant, as they use
`ignore-cross-compile` and won't run on iOS - but using Apple in these
is still more correct, so I've made that change anyhow.
This commit is contained in:
Mads Marquart 2024-05-27 15:17:18 +02:00
parent 37ae2b68b1
commit e6b9bb7b72
41 changed files with 98 additions and 93 deletions

View File

@ -1431,7 +1431,7 @@ fn metadata_access_times() {
assert_eq!(check!(a.modified()), check!(a.modified()));
assert_eq!(check!(b.accessed()), check!(b.modified()));
if cfg!(target_os = "macos") || cfg!(target_os = "windows") {
if cfg!(target_vendor = "apple") || cfg!(target_os = "windows") {
check!(a.created());
check!(b.created());
}

View File

@ -5,7 +5,7 @@
pub fn dylib_path_var() -> &'static str {
if cfg!(target_os = "windows") {
"PATH"
} else if cfg!(target_os = "macos") {
} else if cfg!(target_vendor = "apple") {
"DYLD_LIBRARY_PATH"
} else if cfg!(target_os = "haiku") {
"LIBRARY_PATH"

View File

@ -747,6 +747,7 @@ pub fn line_directive<'line>(
"ignore-aarch64",
"ignore-aarch64-unknown-linux-gnu",
"ignore-android",
"ignore-apple",
"ignore-arm",
"ignore-avr",
"ignore-beta",
@ -829,7 +830,6 @@ pub fn line_directive<'line>(
"ignore-x32",
"ignore-x86",
"ignore-x86_64",
"ignore-x86_64-apple-darwin",
"ignore-x86_64-unknown-linux-gnu",
"incremental",
"known-bug",
@ -876,6 +876,7 @@ pub fn line_directive<'line>(
"only-32bit",
"only-64bit",
"only-aarch64",
"only-apple",
"only-arm",
"only-avr",
"only-beta",

View File

@ -159,6 +159,12 @@ macro_rules! condition {
message: "when the architecture is part of the Thumb family"
}
condition! {
name: "apple",
condition: config.target.contains("apple"),
message: "when the target vendor is Apple"
}
// Technically the locally built compiler uses the "dev" channel rather than the "nightly"
// channel, even though most people don't know or won't care about it. To avoid confusion, we
// treat the "dev" channel as the "nightly" channel when processing the directive.

View File

@ -98,7 +98,7 @@ fn get_lib_name(lib: &str, aux_type: AuxType) -> Option<String> {
AuxType::Lib => Some(format!("lib{}.rlib", lib)),
AuxType::Dylib => Some(if cfg!(windows) {
format!("{}.dll", lib)
} else if cfg!(target_os = "macos") {
} else if cfg!(target_vendor = "apple") {
format!("lib{}.dylib", lib)
} else {
format!("lib{}.so", lib)

View File

@ -57,7 +57,7 @@ fn with_extra_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf {
pub fn dylib_env_var() -> &'static str {
if cfg!(windows) {
"PATH"
} else if cfg!(target_os = "macos") {
} else if cfg!(target_vendor = "apple") {
"DYLD_LIBRARY_PATH"
} else if cfg!(target_os = "haiku") {
"LIBRARY_PATH"

View File

@ -2122,7 +2122,6 @@ ui/issues/issue-33687.rs
ui/issues/issue-33770.rs
ui/issues/issue-3389.rs
ui/issues/issue-33941.rs
ui/issues/issue-33992.rs
ui/issues/issue-34047.rs
ui/issues/issue-34074.rs
ui/issues/issue-34209.rs

View File

@ -15,7 +15,7 @@
const ENTRY_LIMIT: u32 = 900;
// FIXME: The following limits should be reduced eventually.
const ISSUES_ENTRY_LIMIT: u32 = 1676;
const ISSUES_ENTRY_LIMIT: u32 = 1674;
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
"rs", // test source files

View File

@ -1,6 +1,6 @@
//@ revisions: all strong basic none missing
//@ assembly-output: emit-asm
//@ ignore-macos slightly different policy on stack protection of arrays
//@ ignore-apple slightly different policy on stack protection of arrays
//@ ignore-msvc stack check code uses different function names
//@ ignore-nvptx64 stack protector is not supported
//@ ignore-wasm32-bare
@ -17,12 +17,9 @@
// See comments on https://github.com/rust-lang/rust/issues/114903.
#![crate_type = "lib"]
#![allow(incomplete_features)]
#![feature(unsized_locals, unsized_fn_params)]
// CHECK-LABEL: emptyfn:
#[no_mangle]
pub fn emptyfn() {

View File

@ -2,7 +2,7 @@
//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel
//@ only-x86_64
//@ ignore-sgx
//@ ignore-macos (manipulates rsp too)
//@ ignore-apple (manipulates rsp too)
// Depending on various codegen choices, this might end up copying
// a `<2 x i8>`, an `i16`, or two `i8`s.

View File

@ -9,7 +9,7 @@
//@ [keep-thunk-extern] compile-flags: -Zfunction-return=keep -Zfunction-return=thunk-extern
//@ [thunk-extern-keep] compile-flags: -Zfunction-return=thunk-extern -Zfunction-return=keep
//@ only-x86_64
//@ ignore-x86_64-apple-darwin Symbol is called `___x86_return_thunk` (Darwin's extra underscore)
//@ ignore-apple Symbol is called `___x86_return_thunk` (Darwin's extra underscore)
//@ ignore-sgx Tests incompatible with LVI mitigations
#![crate_type = "lib"]

View File

@ -1,6 +1,6 @@
//
//@ ignore-windows
//@ ignore-macos
//@ ignore-apple
//@ ignore-wasm
//@ ignore-emscripten

View File

@ -11,7 +11,7 @@
//@ [LINUX] filecheck-flags: -DINSTR_PROF_COVFUN=__llvm_covfun
//@ [LINUX] filecheck-flags: '-DCOMDAT_IF_SUPPORTED=, comdat'
//@ [DARWIN] only-macos
//@ [DARWIN] only-apple
//@ [DARWIN] filecheck-flags: -DINSTR_PROF_DATA=__DATA,__llvm_prf_data,regular,live_support
//@ [DARWIN] filecheck-flags: -DINSTR_PROF_NAME=__DATA,__llvm_prf_names
//@ [DARWIN] filecheck-flags: -DINSTR_PROF_CNTS=__DATA,__llvm_prf_cnts
@ -49,7 +49,7 @@ pub fn print<T>(left: &str, value: T, right: &str)
pub fn wrap_with<F, T>(inner: T, should_wrap: bool, wrapper: F)
where
F: FnOnce(&T)
F: FnOnce(&T),
{
if should_wrap {
wrapper(&inner)

View File

@ -1,5 +1,5 @@
//
//@ only-macos
//@ only-apple
//@ compile-flags: -O
#![crate_type = "rlib"]

View File

@ -2,7 +2,7 @@
// before 4.0, formerly backported to the Rust LLVM fork.
//@ ignore-windows
//@ ignore-macos
//@ ignore-apple
//@ ignore-wasi
//@ compile-flags: -g -C no-prepopulate-passes
@ -10,5 +10,4 @@
// CHECK-LABEL: @main
// CHECK: {{.*}}DISubprogram{{.*}}name: "main",{{.*}}DI{{(SP)?}}FlagMainSubprogram{{.*}}
pub fn main() {
}
pub fn main() {}

View File

@ -1,5 +1,5 @@
//@ ignore-windows
//@ ignore-macos
//@ ignore-apple
//@ ignore-wasi wasi codegens the main symbol differently
//@ compile-flags: -g -C no-prepopulate-passes

View File

@ -1,6 +1,6 @@
// Test that __llvm_profile_counter_bias does not get internalized by lto.
//@ ignore-macos -runtime-counter-relocation not honored on Mach-O
//@ ignore-apple -runtime-counter-relocation not honored on Mach-O
//@ compile-flags: -Cprofile-generate -Cllvm-args=-runtime-counter-relocation -Clto=fat
//@ needs-profiler-support
//@ no-prefer-dynamic

View File

@ -4,7 +4,7 @@
# ignore-cross-compile
include ../tools.mk
# ignore-macos
# ignore-apple
#
# This hits an assertion in the linker on older versions of osx apparently

View File

@ -4,7 +4,7 @@
# ignore-cross-compile
include ../tools.mk
# ignore-macos
# ignore-apple
#
# This hits an assertion in the linker on older versions of osx apparently

View File

@ -1,10 +1,10 @@
include ../tools.mk
# ignore-windows
# ignore-macos
# ignore-apple
#
# This feature only works when the output object format is ELF so we ignore
# macOS and Windows
# Apple and Windows
# check that the .stack_sizes section is generated
all:

View File

@ -2,7 +2,7 @@
include ../tools.mk
# ignore-windows
# ignore-macos
# ignore-apple
# Test for #39529.
# `-z text` causes ld to error if there are any non-PIC sections

View File

@ -1,4 +1,4 @@
# only-macos
# only-apple
#
# Check that linking to a framework actually makes it to the linker.

View File

@ -1,4 +1,4 @@
# only-macos
# only-apple
include ../tools.mk

View File

@ -1,5 +1,5 @@
# ignore-cross-compile
# ignore-macos
# ignore-apple
include ../tools.mk

View File

@ -1,9 +1,9 @@
include ../tools.mk
# only-macos
# only-apple
#
# This checks that `#[used]` passes through to the linker on
# darwin. This is subject to change in the future, see
# Apple targets. This is subject to change in the future, see
# https://github.com/rust-lang/rust/pull/93718 for discussion
all:

View File

@ -1,6 +1,6 @@
//@ ignore-wasm32 no subprocess support
//@ ignore-sgx no processes
//@ ignore-macos this needs valgrind 3.11 or higher; see
//@ ignore-apple this needs valgrind 3.11 or higher; see
// https://github.com/rust-lang/rust/pull/30365#issuecomment-165763679
use std::env;
@ -11,8 +11,7 @@ fn main() {
print!("hello!");
exit(0);
} else {
let out = Command::new(env::args().next().unwrap()).arg("foo")
.output().unwrap();
let out = Command::new(env::args().next().unwrap()).arg("foo").output().unwrap();
assert!(out.status.success());
assert_eq!(String::from_utf8(out.stdout).unwrap(), "hello!");
assert_eq!(String::from_utf8(out.stderr).unwrap(), "");

View File

@ -2,7 +2,7 @@
//@ compile-flags:-Cstrip=none
//@ compile-flags:-g -Csplit-debuginfo=unpacked
//@ only-macos
//@ only-apple
use std::process::Command;
use std::str;

View File

@ -1,4 +1,4 @@
//@ only-macos
//@ only-apple
//@ compile-flags: --print deployment-target
//@ normalize-stdout-test: "\d+\." -> "$$CURRENT_MAJOR_VERSION."
//@ normalize-stdout-test: "\d+" -> "$$CURRENT_MINOR_VERSION"

View File

@ -10,20 +10,21 @@ mod rusti {
}
}
#[cfg(any(target_os = "android",
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd",
target_os = "fuchsia",
target_os = "hurd",
target_os = "illumos",
target_os = "linux",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris",
target_os = "vxworks",
target_os = "nto",
#[cfg(any(
target_os = "android",
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd",
target_os = "fuchsia",
target_os = "hurd",
target_os = "illumos",
target_os = "linux",
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris",
target_os = "vxworks",
target_os = "nto",
target_vendor = "apple",
))]
mod m {
#[cfg(target_arch = "x86")]

View File

@ -2,10 +2,10 @@
#![allow(unused_variables)]
//@ compile-flags:--test -g
#[cfg(target_os = "macos")]
#[cfg(target_vendor = "apple")]
#[test]
fn simple_test() {
use std::{env, panic, fs};
use std::{env, fs, panic};
// Find our dSYM and replace the DWARF binary with an empty file
let mut dsym_path = env::current_exe().unwrap();
@ -13,8 +13,13 @@ fn simple_test() {
assert!(dsym_path.pop()); // Pop executable
dsym_path.push(format!("{}.dSYM/Contents/Resources/DWARF/{0}", executable_name));
{
let file = fs::OpenOptions::new().read(false).write(true).truncate(true).create(false)
.open(&dsym_path).unwrap();
let file = fs::OpenOptions::new()
.read(false)
.write(true)
.truncate(true)
.create(false)
.open(&dsym_path)
.unwrap();
}
env::set_var("RUST_BACKTRACE", "1");

View File

@ -1,32 +1,32 @@
//@ run-pass
#![allow(non_upper_case_globals)]
#[cfg(not(target_os = "macos"))]
#[link_section=".moretext"]
#[cfg(not(target_vendor = "apple"))]
#[link_section = ".moretext"]
fn i_live_in_more_text() -> &'static str {
"knock knock"
}
#[cfg(not(target_os = "macos"))]
#[link_section=".imm"]
#[cfg(not(target_vendor = "apple"))]
#[link_section = ".imm"]
static magic: usize = 42;
#[cfg(not(target_os = "macos"))]
#[link_section=".mut"]
#[cfg(not(target_vendor = "apple"))]
#[link_section = ".mut"]
static mut frobulator: usize = 0xdeadbeef;
#[cfg(target_os = "macos")]
#[link_section="__TEXT,__moretext"]
#[cfg(target_vendor = "apple")]
#[link_section = "__TEXT,__moretext"]
fn i_live_in_more_text() -> &'static str {
"knock knock"
}
#[cfg(target_os = "macos")]
#[link_section="__RODATA,__imm"]
#[cfg(target_vendor = "apple")]
#[link_section = "__RODATA,__imm"]
static magic: usize = 42;
#[cfg(target_os = "macos")]
#[link_section="__DATA,__mut"]
#[cfg(target_vendor = "apple")]
#[link_section = "__DATA,__mut"]
static mut frobulator: usize = 0xdeadbeef;
pub fn main() {

View File

@ -1,5 +1,5 @@
// Check that linking frameworks on Apple platforms works.
//@ only-macos
//@ only-apple
//@ revisions: omit link weak both
//@ [omit]build-fail
//@ [link]run-pass

View File

@ -1,4 +1,4 @@
//@ ignore-macos this is supposed to succeed on osx
//@ ignore-apple this is supposed to succeed on Apple platforms (though it won't necessarily link)
#[link(name = "foo", kind = "framework")]
extern "C" {}

View File

@ -1,5 +1,5 @@
error[E0455]: link kind `framework` is only supported on Apple targets
--> $DIR/osx-frameworks.rs:3:29
--> $DIR/kind-framework.rs:3:29
|
LL | #[link(name = "foo", kind = "framework")]
| ^^^^^^^^^^^

View File

@ -1,6 +1,6 @@
//@ run-pass
//@ ignore-windows
//@ ignore-macos
//@ ignore-apple
//@ ignore-wasm32 common linkage not implemented right now
#![feature(linkage)]

View File

@ -1,6 +1,6 @@
//@ run-pass
//@ ignore-windows
//@ ignore-macos
//@ ignore-apple
//@ ignore-emscripten doesn't support this linkage
//@ ignore-sgx weak linkage not permitted
//@ aux-build:linkage1.rs

View File

@ -4,7 +4,7 @@
//@ ignore-emscripten no weak symbol support
//@ ignore-windows no extern_weak linkage
//@ ignore-macos no extern_weak linkage
//@ ignore-apple no extern_weak linkage
//@ aux-build:lib.rs

View File

@ -1,7 +1,5 @@
//@ ignore-macos
//@ ignore-ios
//@ ignore-apple
//@ compile-flags:-l framework=foo
//@ error-pattern: library kind `framework` is only supported on Apple targets
fn main() {
}
fn main() {}

View File

@ -1,4 +1,4 @@
//@ ignore-macos: cycle error does not appear on apple
//@ ignore-apple: cycle error does not appear on apple
use std::sync::Mutex;

View File

@ -30,21 +30,21 @@ struct Outer {
t: Inner
}
#[cfg(any(target_os = "android",
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd",
target_os = "fuchsia",
target_os = "hurd",
target_os = "illumos",
target_os = "linux",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris",
target_os = "vxworks",
target_os = "nto",
#[cfg(any(
target_os = "android",
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd",
target_os = "fuchsia",
target_os = "hurd",
target_os = "illumos",
target_os = "linux",
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris",
target_os = "vxworks",
target_os = "nto",
target_vendor = "apple",
))]
mod m {
#[cfg(target_arch = "x86")]