mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
A number of tests exercise features only available in Apple OSes that shipped with Swift 5.0 in the OS; this includes the following versions: - macOS 10.14.4 - iOS 12.2 - tvOS 12.2 - watchOS 5.2 Previously these tests were restricted to running on macOS only, with an explicit -target x86_64-apple-macosx10.14.4. To get better test coverage, add a new %target-stable-abi-triple substitution which expands to a triple with the correct OS version on all Apple platforms. On non-Apple platforms, this is the same as %target-variant-triple, but for now any test that uses this exercises Apple platform features anyway. One caveat is that since iOS 12.2 does not have a 32-bit slice, we have to skip any tests that use -target %target-stable-abi-triple on this platform. A new swift_stable_abi feature flag can be tested with 'REQUIRES: swift_stable_abi'. To get maximum test coverage, I split off a 'stable_abi' version of a few tests that build with both an old and new deployment target. This allows the old deployment target case to still be tested on 32-bit iOS.
31 lines
2.5 KiB
Matlab
31 lines
2.5 KiB
Matlab
// Check that when Objective-C is first to touch a Swift class, it gives the
|
|
// Swift runtime a chance to update instance size and ivar offset metadata.
|
|
|
|
// RUN: %empty-directory(%t)
|
|
// RUN: %target-build-swift -emit-library -emit-module -o %t/libResilient.dylib %S/Inputs/class-layout-from-objc/Resilient.swift -Xlinker -install_name -Xlinker @executable_path/libResilient.dylib -enable-library-evolution -DSMALL
|
|
|
|
// RUN: %target-clang -c %S/Inputs/class-layout-from-objc/OneWordSuperclass.m -fmodules -fobjc-arc -o %t/OneWordSuperclass.o
|
|
// RUN: %target-build-swift -emit-library -o %t/libClasses.dylib -emit-objc-header-path %t/Classes.h -I %t -I %S/Inputs/class-layout-from-objc/ %S/Inputs/class-layout-from-objc/Classes.swift %t/OneWordSuperclass.o -Xlinker -install_name -Xlinker @executable_path/libClasses.dylib -lResilient -L %t -target %target-stable-abi-triple
|
|
// RUN: %target-clang %S/class_update_callback_with_fixed_layout.m -I %S/Inputs/class-layout-from-objc/ -I %t -fmodules -fobjc-arc -o %t/main -lResilient -lClasses -L %t
|
|
// RUN: %target-codesign %t/main %t/libResilient.dylib %t/libClasses.dylib
|
|
// RUN: %target-run %t/main NEW %t/libResilient.dylib %t/libClasses.dylib
|
|
|
|
// RUN: %target-build-swift -emit-library -emit-module -o %t/libResilient.dylib %S/Inputs/class-layout-from-objc/Resilient.swift -Xlinker -install_name -Xlinker @executable_path/libResilient.dylib -enable-library-evolution -DBIG
|
|
// RUN: %target-codesign %t/libResilient.dylib
|
|
// RUN: %target-run %t/main NEW %t/libResilient.dylib %t/libClasses.dylib
|
|
|
|
// Try again when the class itself is also resilient.
|
|
// RUN: %target-build-swift -emit-library -o %t/libClasses.dylib -emit-objc-header-path %t/Classes.h -I %S/Inputs/class-layout-from-objc/ -I %t %S/Inputs/class-layout-from-objc/Classes.swift %t/OneWordSuperclass.o -Xlinker -install_name -Xlinker @executable_path/libClasses.dylib -lResilient -L %t -target %target-stable-abi-triple
|
|
// RUN: %target-codesign %t/libClasses.dylib
|
|
// RUN: %target-run %t/main NEW %t/libResilient.dylib %t/libClasses.dylib
|
|
|
|
// RUN: %target-build-swift -emit-library -emit-module -o %t/libResilient.dylib %S/Inputs/class-layout-from-objc/Resilient.swift -Xlinker -install_name -Xlinker @executable_path/libResilient.dylib -enable-library-evolution -DSMALL
|
|
// RUN: %target-codesign %t/libResilient.dylib
|
|
// RUN: %target-run %t/main NEW %t/libResilient.dylib %t/libClasses.dylib
|
|
|
|
// REQUIRES: executable_test
|
|
// REQUIRES: objc_interop
|
|
// REQUIRES: swift_stable_abi
|
|
|
|
// The actual source code for the test is in class_update_callback_with_fixed_layout.m.
|