Commit Graph

19 Commits

Author SHA1 Message Date
Julian Lettner
105e4ad592 [TSan] Add positive test for TSan + Dispatch on Linux
1) Enable tests that use `import Dispatch` on Linux. Add substitution
   `%import-libdispatch` that needs to be used for all cross-platform
   tests (i.e., tests that are intended to be run on other platforms
   than Darwin) that do `import Dispatch` or enable thread sanitizer.

2) Make sure as many existing Dispatch and TSan tests as possible run on
   Linux. Mark tests that would require substantial work with
   `UNSUPPORTED: OS=linux-gnu`.

3) Add integration-style Swift test that shows that TSan finds a simple
   race when using `Dispatch.async` incorrectly. A more complete test
   suite for TSan's libdispatch support lives on the LLVM/compiler-rt
   side.

rdar://problem/49177535
2019-06-10 14:24:53 -07:00
mishal_shah
1e38fc3030 Update master to build with Xcode 11 beta, macOS 10.15, iOS 13, tvOS 13, and watchOS 6 SDKs 2019-06-03 22:50:02 -07:00
Slava Pestov
5d66bb810a Run stable ABI tests on all Apple platforms
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.
2019-05-16 17:02:06 -04:00
Slava Pestov
52fbe642ed Fix REQUIRES lines on class stubs tests
We use the just-built clang without any -target or -sdk flags. Keep things
simple and limit the test to macOS for now.

Fixes <rdar://problem/50586614>.
2019-05-08 22:22:27 -04:00
Nathan Hawes
af3fbc52b3 Revert "Add tests for weak-linked class stubs" 2019-05-08 10:55:00 -07:00
Slava Pestov
9f4b86b741 Add test for weak-linked Objective-C resilient class stubs 2019-05-07 16:34:56 -04:00
Slava Pestov
fbd8b97351 Un-XFAIL validation-test/Runtime/class_stubs.m and adjust for Clang changes
The objc_loadClassref() symbol is weak linked from Clang now, so we can
un-XFAIL this test. Note that we have to pass a special flag to Clang
since objc_loadClassref() is not in the SDK's TBD files yet.

Also, change the test to use its own asserts instead of FileCheck since
there's no output unless a new libobjc is available.
2019-05-07 16:31:40 -04:00
Slava Pestov
9536eff2d6 Execution tests for Objective-C resilient class stubs
Fixes <rdar://49090613>, except they're disabled for the time being.
2019-04-19 17:39:51 -04:00
Slava Pestov
1159af50d9 Rename -enable-resilience to -enable-library-evolution and make it a driver flag
Fixes <rdar://problem/47679085>.
2019-03-14 22:24:26 -04:00
Julian Lettner
c0674b7ef8 [testsuite] Allow libdispatch tests to run on non-Apple platforms
The lit feature `objc_interop` is used as a proxy for the availability
of libdispatch and Foundation.

Although we don't support Obj-C on non-Apple platforms, we support
libdispatch and Foundation. Let's break up `objc_interop` into
finer-grained categories so we can run more tests on non-Apple
platforms.

This patch adds lit features `libdispatch` and `foundation` (currently
only enabled on Apple platforms) and removes the `objc_interop`
dependency from libdispatch tests.
2019-03-08 16:53:40 -08:00
Slava Pestov
2633c9d063 Fix old_runtime_crash_without_fixed_layout.swift to pass when optimizations are on
@_optimize(none) does not prevent LLVM from optimizing the function, and the LLVM
optimizer was able to inline blackHole() and elide the metadata access altogether.
2019-02-22 21:10:18 -05:00
Slava Pestov
6ac91701dd Runtime: Add precondition check to swift_updateClassMetadata()
This initialization pattern can only be used if there is a backward deployment
layout (IRGen calls this ClassMetadataStrategy::FixedOrUpdate) or if we are
running on a newer Objective-C runtime that supports class metadata update
hooks (IRGen calls this ClassMetadataStrategy::Update).

If neither condition holds, we must trap here to avoid undefined behavior.
2019-02-18 22:39:13 -05:00
Slava Pestov
eec0fcdf49 IRGen: When available, use ClassMetadataStrategy::Update even if we don't have legacy type info
If we know our deployment target has a new Objective-C runtime, we can
emit fixed metadata for classes with resilient types even if those
types do not appear in the YAML legacy type info.

Fixes <rdar://problem/47649465>.
2019-02-18 22:39:13 -05:00
Slava Pestov
32954fc463 Use -read-legacy-type-info-path in Runtime/class-layout-from-objc.m test 2019-02-08 14:22:00 -05:00
Jordan Rose
73fba19a97 [test] Tweak class-layout-from-objc.m to avoid macros named "check"
rdar://problem/47389594
2019-01-18 16:41:38 -08:00
Jordan Rose
7629253ab5 Test that newer libobjcs let the Swift runtime set up a class's layout (#21942)
Specifically, when the class is referenced from Objective-C first,
before being referenced from Swift in any way. This is important for
resilience, since up until now Objective-C isn't used to the size of a
class changing based on anything other than a superclass's size
changing.

This is basically the test that would have gone with 9024768b0 had
there been a build of libobjc to test it with.

rdar://problem/45718008
2019-01-17 17:39:44 -08:00
Andrew Trick
e560125d20 Create RuntimeUnittest library for C++ runtime unit tests from lit.
Create a new RuntimeUnittest library alongside the other stdlib unit
tests so we can write C++ runtime unit tests callable from lit.

Move runtime exclusivity tests into the stdlib unittest library and
create lit tests so we can verify that the runtime crashes with an
error message.
2018-10-13 10:06:35 -07:00
Doug Gregor
9565f0d753 [Test] Add test for SR-8666 / rdar://problem/43893945.
This test case crashed at runtime in Swift 4.2, but is now fixed. Add it
so that we don't regress.
2018-10-06 22:12:55 -07:00
David Zarzycki
c00c18fc68 [Tests] Consolidate stress/long tests in validation-tests 2018-03-20 22:19:37 -04:00