Commit Graph

794 Commits

Author SHA1 Message Date
Alexis Laferrière
11c448d954 Tests: Use a local cache for many tests importing AppKit
Tests importing AppKit have a tendency to be flaky if they share a
module cache with other builds using a different set of framework search
flags. Make sure they use a local cache to avoid picking incompatible
cached modules.

Alternatively, we could align all builds using the same cache to have
exactly the same framework search paths or enable explicit module
builds. I picked the module cache as it's the most reliable solution in
the short and long term.

The 5 tests below import AppKit and have been known to be flaky.
Adapting them to use a custom cache with require more care. For now,
let's use them as control group to validate that the fix works. If these
5 fail without the fixed ones, we should extend the same corresponding
fix to them.

- Interpreter/SDK/GLKit.swift
- Interpreter/SDK/cf_extensions.swift
- Interpreter/SDK/cf_type_bridging.swift
- Interpreter/SDK/mapkit_header_static.swift
- Interpreter/SDK/objc_ns_enum.swift

rdar://142296731
2025-01-09 12:22:02 -08:00
Ben Langmuir
dc5e6d88c2 [test] ignore deprecations
Ignore some deprecation warnings associated with the deployment target
bump.
2024-08-30 09:10:14 -07:00
Charles Hu
77e6c57a73 Fix NSDecimal interpreter test
We fixed the behavior of Decimal.ulp with https://github.com/apple/swift-foundation/pull/741. We should remove this test with wrong expectations since we already test it in SwiftFoundation
2024-08-14 13:41:23 -07:00
Mike Ash
c0486723fe [Test] Remove class_getImageName-static test.
This test checks the behavior of class_getImageName before the runtime's hook is installed with objc_setHook_getImageName. Foundation now triggers installation of that hook very early, causing the test to fail. Reliably avoiding this is difficult, and the test is redundant with the ObjC runtime's tests, so just remove it.

rdar://132478164
2024-07-25 11:09:38 -04:00
Artem Chikin
1f14158a1d Introduce VisionOS Platform
This change introduces a new compilation target platform to the Swift compiler - visionOS.

- Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target.
- Addition of the new platform kind definition.
- Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries.
- Utilities to read out Darwin platform SDK info containing platform mapping data.
- Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback').
- Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path.
- Changes to existing test suite to accomodate the new platform.
2024-04-10 09:38:02 -07:00
Allan Shortlidge
e5c6bb649c Remove support for Swift 3 @objc inference.
Obsolete the `-enable-swift3-objc-inference` option and related options by
removing support for inferring `@objc` attributes using Swift 3 rules.
Automated migration from Swift 3 has not been supported by the compiler for
many years.
2024-01-11 15:40:04 -08:00
Nate Chandler
4e2e76f479 [Test] Disabled test failing in some configs.
rdar://106965845
2023-08-25 11:06:03 -07:00
Michael Spencer
b2640e15e4 [test] Rename all module.map files to module.modulemap
`module.map` as a module map name has been discouraged since 2014, and
Clang will soon warn on its usage. This patch renames all instances of
`module.map` in the Swift tests to `module.modulemap` in preparation
for this change to Clang.

rdar://106123303
2023-08-21 15:58:59 -07:00
Mike Ash
dbd2f82739 [Runtime] Fix up the heap destroyer in objc_setClassCopyFixupHandler.
We fix up the VWT pointer, but not the heap destroyer. This doesn't matter for classes which use ObjC refcounting, which is the common case for dynamic subclasses, because that doesn't use the heap destroyer pointer. But it does matter for classes that use native Swift refcounting, such as classes that don't inherit from NSObject, or actors.

rdar://113657917
2023-08-10 15:19:18 -04:00
Karoy Lorentey
b82ce9c3be [stdlib] Adopt _pointerBitWidth conditional 2023-04-27 13:33:24 -07:00
Mishal Shah
e072c8e3a5 Update test/Interpreter/SDK/Foundation_NSRect.swift 2022-09-17 00:15:13 -07:00
Drew Maxwell
7825221cd4 Updating Swift tests to remove outdated tests and use more current calls. 2022-09-16 15:11:10 -07:00
Anthony Latsis
af66096847 Gardening: Migrate test suite to GH issues: Interpreter 2022-09-01 06:35:57 +03:00
Karoy Lorentey
0d8f5d9113 [test] Interpreter/autolinking: Require local execution 2022-08-23 14:55:12 -07:00
Anthony Latsis
18910ae8e5 Add regression test to close #43022 2022-06-28 22:36:01 +03:00
Mike Ash
a0dec1d30a [Test] Disable objc_old_swift.swift on ARM64e.
The bit twiddling done by this test falls afoul of ptrauth on ARM64e. We don't support pre-stable Swift ABI code on ARM64e anyway, so just disable the test there.

rdar://92469961
2022-04-28 12:53:06 -04:00
Mike Ash
b00397c7eb [Concurrency] Fix ObjC weak references to actors.
Change actor destruction to call swift_deallocClassInstance instead of swift_deallocObject. When ObjC interop is enabled, swift_deallocClassInstance will check the "pure swift deallocation" bit and call into the ObjC runtime to destruct the instance when needed. This is what clears weak references and associated objects.

rdar://91270492
2022-04-06 15:57:01 -04:00
Erik Eckstein
6ee19f0bea Do conservative cross-module-optimization by default
The "regular" CMO is done with the option `-cross-module-optimization`. It's good for performance but can increase code size.
Now, which this change CMO is also done if the option is not given, but in a very conservative way. Only very small functions are serialized and not additional type metadata is kept alive.

rdar://70082202
2022-01-12 12:43:53 +01:00
Karoy Lorentey
e2cfab4f28 [stdlib][test] Adopt availability macros in tests 2021-10-31 15:00:58 -07:00
Mike Ash
cc0d207050 [Test] Disable Interpreter/SDK/objc_bridge_cast.swift and Interpreter/SDK/objc_dealloc.swift.
These tests are failing intermittently. Disabling them to keep PR testing happy while we figure out why.

rdar://80079617
2021-07-02 08:51:29 -04:00
Mike Ash
3e027b7cea [Runtime] Set fastDeallocSupported to false on i386 simulators.
The conditional should have been "Intel simulators" but it was actually "x86-64 simulators." The i386 simulator doesn't have the weak formation callout, which causes it to miss cleaning up associated objects when the Swift runtime thinks it does.

rdar://79672466
2021-06-23 16:45:06 -04:00
Varun Gandhi
35d4b4ce38 Temporarily turn off 2 ObjC related tests.
These are failing (rdar://79672466); temporarily mark
them unsupported to unblock PR testing.
2021-06-23 11:18:23 -07:00
Mishal Shah
23c3b15f5f Support Xcode 13 beta
* Updating availability versions
* Remove all remaining overlays in stdlib/public/Darwin/*:
   - ObjectiveC
   - Dispatch
   - CoreFoundation
   - CoreGraphics
   - Foundation
2021-06-07 12:04:31 -07:00
Alexis Laferrière
955a572819 [Test] Fix line numbers in objc_swift3_deprecated_objc_inference.swift 2021-04-30 21:46:33 -07:00
Alexis Laferrière
28e8149867 [Test] Disable objc_swift3_deprecated_objc_inference.swift for 32 bits watchOS 2021-04-30 15:36:00 -07:00
Robert Widmann
0149ccd0ca Add arm64_32 support for Swift
Commit the platform definition and build script work necessary to
cross-compile for arm64_32.

arm64_32 is a variant of AARCH64 that supports an ILP32 architecture.
2021-04-20 14:59:04 -07:00
Nate Chandler
b8b6d9cb39 [Test] Disabled Interpreter/SDK/cf_without_foundation.swift on watchos.
rdar://76080265
2021-04-13 16:59:27 -07:00
Andrew Trick
0aba7b6373 Update various tests for enabling mandatory copy propagation. 2021-03-12 19:32:55 -08:00
Erik Eckstein
9e7e6865dd tests: re-enable Interpreter/SDK/objc_cast.swift
Needed to add some explicit casts to NSObject

rdar://33021520
2021-02-25 10:32:35 +01:00
Mike Ash
1be7171817 Merge pull request #34350 from mikeash/remove-os-object-test-workaround
[Test] Remove `as AnyObject` cast from OS_objects.swift.
2020-10-21 11:33:17 -04:00
Mike Ash
b1633fdc36 [Test] Remove as AnyObject cast from OS_objects.swift.
This workaround is no longer needed.

rdar://problem/27526994
2020-10-19 11:49:31 -04:00
Saleem Abdulrasool
2fc5cbdc14 stdlib: remove swiftMSVCRT, replace with swiftCRT on Windows
This replaces swiftMSVCRT with swiftCRT.  The big difference here is
that the `visualc` module is no longer imported nor exported.  The
`visualc` module remains in use for a singular test wrt availability,
but this should effectively remove the need for the `visualc` module.

The difference between the MSVCRT and ucrt module was not well
understood by most.  MSVCRT provided ucrt AND visualc, combining pieces
of the old MSVCRT and the newer ucrt.  The ucrt module is what you
really wanted most of the time, however, would need to use MSVCRT for
the convenience aliases for type-generic math and the deprecated math
constants.

Unfortunately, we cannot shadow the `ucrt` module and create a Swift SDK
overlay for ucrt as that seems to result in circular dependencies when
processing the `_Concurrency` module.

Although this makes using the C library easier for most people, it has a
more important subtle change: it cleaves the dependency on visualc.
This means that this enables use of Swift without Visual Studio for the
singular purpose of providing 3 header files.  Additionally, it removes
the need for the installation of 2 of the 4 support files.  This greatly
simplifies the deployment process on Windows.
2020-10-15 16:02:01 -07:00
Tim Kientzle
62bae423b5 Un-XFAIL a test that now passes
protocol_lookup_foreign exercises CF casting that used to
be broken, but now works with the new dynamic casting implementation.
2020-08-31 10:56:47 -07:00
tbkka
524cfae1b2 [Dynamic Casting] Overhauled Runtime (#33561)
* Dynamic Cast Rework: Runtime

This is a completely refactored version of the core swift_dynamicCast
runtime method.

This fixes a number of bugs, especially in the handling of multiply-wrapped
types such as Optional within Any.  The result should be much closer to the
behavior specified by `docs/DynamicCasting.md`.

Most of the type-specific logic is simply copied over from the
earlier implementation, but the overall structure has been changed
to be uniformly recursive.  In particular, this provides uniform
handling of Optional, existentials, Any and other common "box"
types along all paths.  The consistent structure should also be
easier to update in the future with new general types.

Benchmarking does not show any noticable performance implications.

**Temporarily**, the old implementation is still available.  Setting the
environment variable `SWIFT_OLD_DYNAMIC_CAST_RUNTIME` before launching a program
will use the old runtime implementation.  This is only to facilitate testing;
once the new implementation is stable, I expect to completely remove the old
implementation.
2020-08-27 11:06:40 -07:00
Saleem Abdulrasool
1d0bf509b8 Merge pull request #33373 from compnerd/rosetta
test: repair Interpreter/SDK/interpreter_with_options on ASi
2020-08-08 08:13:22 -07:00
Mishal Shah
473f55ced8 Remove codesign from test/Interpreter/SDK/objc_swift3_deprecated_objc_inference.swift 2020-08-07 15:53:45 -07:00
Saleem Abdulrasool
88e13060ab test: repair Interpreter/SDK/interpreter_with_options on ASi
Remove the target specific binary and instead compile a test binary on
the fly.  Because this test is restricted to macOS platforms, we know
that we assume that we will have a compatible Objective-C runtime at our
disposal.  Use that to create a stub library for testing
`NSClassFromString`.

This allows this test to execute on ARM64.
2020-08-07 14:29:35 -07:00
Mishal Shah
a3cd8bc9e9 [Tests] Codesign the binary before executing the test 2020-08-07 00:26:07 -07:00
Karoy Lorentey
d966dbb511 Merge pull request #32676 from lorentey/simplify-checkclass
[Foundation] Update & simplify class name stability check
2020-07-09 18:50:25 -07:00
Karoy Lorentey
f44cbe4697 [Foundation] Update & simplify class name stability check
Move the ObjC class name stability check logic to the Swift runtime, exposing it as a new SPI called _swift_isObjCTypeNameSerializable.

Update the reporting logic. The ObjC names of generic classes are considered stable now, but private classes and classes defined in function bodies or other anonymous contexts are unstable by design.

On the overlay side, rewrite the check’s implementation in Swift and considerably simplify it.

rdar://57809977
2020-07-02 19:32:22 -07:00
Mishal Shah
84489d87b2 [Apple Silicon] Mark several tests that require the Swift interpreter accordingly 2020-07-02 16:26:10 -07:00
Robert Widmann
cddf73ecdb [Gardening] Clean Up OS-Test Patterns Across The Codebase
Clean up a few general patterns that are now obviated by canImport

This aligns more generally with the cleanup that the Swift Package
Manager has already done in their automated XCTest-plumbing tool in
apple/swift-package-manager#1826.
2020-06-30 22:55:58 -07:00
Karoy Lorentey
da242bd2d4 [SDK] Remove obsolete overlay code 2020-06-22 15:43:39 -07:00
Mishal Shah
272c466e47 Update master to build with Xcode 12 beta 2020-06-22 15:43:20 -07:00
Doug Gregor
3095deb0f1 [Tests] Update with explicit SDK linking where we missed it. 2020-06-18 09:48:19 -07:00
Mishal Shah
d5c40bf231 Revert "Disable objc_mangling.swift and SwiftObjectNSObject.swift test on tvOS"
This reverts commit 7e2c2452ad.
2020-05-28 14:10:40 -07:00
Dmitri Gribenko
30afc6c406 Consolidated four CoreGraphics execution tests
I don't see any reason to split the tests like this. I merged the tests
into the biggest and best-organized test file.

I also removed the `REQUIRES: OS=macosx` line and made some small
adjustments to the test to make it cross-platform.
2020-05-18 23:13:12 +02:00
Slava Pestov
dd0ce1ad13 Remove the integrated REPL 2020-05-06 22:29:05 -04:00
Varun Gandhi
a1716fe2a6 [Diagnostics] Update compiler diagnostics to use less jargon. (#31315)
Fixes rdar://problem/62375243.
2020-04-28 14:11:39 -07:00
3405691582
4a36a4b6c5 [test] Setup testing for OpenBSD.
This commit focuses the basics: setting up the relevant stanzas in
lit.cfg and adding platform conditionals for importing Glibc. Future
commits will deal with other portability fixes.
2020-03-23 20:47:31 -04:00