Commit Graph

2015 Commits

Author SHA1 Message Date
Alejandro Alonso
88bf2108a8 Mark CharacterPropertiesLong as long_test (#39437) 2021-09-24 03:08:40 -07:00
Alejandro Alonso
12b9566f7b Add availability around new Unicode test (#39250) 2021-09-13 13:33:24 -07:00
Kuba (Brecka) Mracek
8b189d99e4 Turn off SWIFT_ENABLE_REFLECTION on the stdlib_minimal preset (#39030) 2021-09-12 18:54:53 -07:00
Guillaume Lessard
6b219a9c56 [stdlib] fix another accidental infinite-recursion bug (#38950)
fixes: SR-6501, SR-11516
2021-08-23 11:06:27 -04:00
Alejandro Alonso
b651278616 Fix a crash on Scalar init with negative numbers (#38829) 2021-08-12 11:42:54 -07:00
Guillaume Lessard
92335b115a Merge pull request #38677 from glessard/sr14491-v1
[stdlib] fast path for UMBP.initialize<C>(from: C) when C is a Slice
2021-08-03 11:28:32 -06:00
Guillaume Lessard
23bed3118b [test] test UnsafeMutableBufferPointer.initialize(from: Slice<_>) 2021-07-28 14:32:57 -06:00
Guillaume Lessard
0ea4e3c4d9 [stdlib] add availability annotations and tests 2021-07-21 09:20:12 -06:00
Guillaume Lessard
3789ce292a [stdlib] fix an accidental recursion bug involving MutableCollection
- add a default implementation of MutableCollection’s
  subscript(bounds: Range<_>) with the most general signature possible
- it is marked unavailable in order to prevent the
  infinite recursion bug reported in SR-14848
- add a conditionally-available subscript(bounds: Range<_>) -> Slice<Self>
  only when Subsequence is Slice<Self>. This will supersede
  the unconditional extension that provides the same signature.
2021-07-20 16:11:23 -06:00
Guillaume Lessard
473b5737d4 [test] add a definition that shouldn't compile 2021-07-20 13:25:55 -06:00
3405691582
ac9640b00a [stdlib] Changes to support Foundation on OpenBSD.
* Not implementing POSIXError for a given platform is not a blocking
  problem to getting a successful build of Swift. However, it is
  part of the validation tests (albeit locked behind REQUIRES) and is
  referenced when building Foundation. Implement by forklifting from
  `sys/errno.h`.

* Some Foundation class implementations require some missing includes in
  the platform modulemap. Add these.
2021-07-09 18:55:51 -04:00
Guillaume Lessard
6053c47f6d Merge pull request #38161 from glessard/sr14848
[stdlib] fix an accidental recursion bug involving Collection
2021-07-01 07:58:53 -06:00
Guillaume Lessard
7d6260560e [stdlib] fix an accidental recursion bug involving Collection
- adds a default implementation of Collection’s subscript(bounds: Range<_>)
  with the most general signature possible
- it is marked unavailable in order to prevent the
  infinite recursion bug reported in SR-14848
- Collections whose SubSequence is Slice<Self> still get the proper default, as intended.
2021-06-30 21:58:48 -06:00
Mishal Shah
f51923dd8f Merge pull request #37978 from lorentey/postprocess-stress-tests
[test] Add missing postprocessing phase to executable stress tests
2021-06-23 10:51:44 -07:00
Varun Gandhi
c53d0eb273 Temporarily mark ArraysObjc test unsupported for watchsimulator-i386.
Earlier, I accidentally marked Arrays.swift.gyb, however the test that
is failing is ArraysObjc.swift.gyb.
2021-06-22 16:16:05 -07:00
Varun Gandhi
9e707e1f40 Revert "Temporarily mark test unsupported for watchsimulator-i386."
This reverts commit dab1254dea.
2021-06-22 16:15:01 -07:00
Varun Gandhi
3368d9c597 Merge pull request #38032 from varungandhi-apple/vg-dont-watch-arrays
Temporarily mark test unsupported for watchsimulator-i386.
2021-06-22 12:23:18 -07:00
Varun Gandhi
dab1254dea Temporarily mark test unsupported for watchsimulator-i386. 2021-06-22 12:20:07 -07:00
Karoy Lorentey
4c12217157 [test] Add missing postprocessing phase to executable stress tests
We need to run utils/swift-darwin-postprocess.py on every executable test on Darwin platforms to work around a dyld issue. (And to ad-hoc sign executables on platforms that need it.)

Add a %target-codesign step to stress tests that are currently missing it.
2021-06-17 13:35:21 -07:00
Erik Eckstein
0831240be6 tests: disable COW checking by default, and enable it for specific tests
COW checking needs that all libraries are consistently compiled with asserts enabled. This is not the case for the Foundation overlay anymore.
Therefore it does not work with some tests which interop with Foundation.

The solution here is to disable COW checking by default, but enable it for Array tests which do not interop with Foundation.
2021-06-17 16:14:03 +02:00
Erik Eckstein
6f4192927e tests: refactor Array test files.
* move all ObjC array tests into a separate file ArraysObjc.swift.gyb
* merge the remaining Arrays.swift.gyb and ArrayNew.swift.gyb files
* move the utilities from ArrayTypesAndHelpers.swift into its only use into ArraysObjc.swift.gyb
2021-06-17 11:30:59 +02: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
Karoy Lorentey
9cf28dffa2 [SDK] Remove the obsolete XCTest overlay
The actual XCTest overlay has not been maintained in this repository for years. (It is distributed in Xcode (libXCTestSwiftSupport.dylib), along with XCTest.framework itself.)

The code we have here is badly out of date, and the fact that we have it on the module path in CI makes it interfere with the contents of recent SDKs.

Remove the XCTest overlay from this repository; pick it up from the SDK instead.

rdar://76915582
2021-05-21 17:21:12 -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
Luciano Almeida
ddeb1929c4 [DiagnosticQol][SR-14505] Use DeclDescriptive kind in missing return data flow diagnostics (#36952)
* [Diagnostics] Use DeclDescriptiveKind on data flow diagnostics to improve diagnostic message

* [tests] Add regression tests to SILOptimizer/return.swift

* [tests] Adapt other tests to changes of SR-14505

* [Diagnostics] Adapt message for missing return diagnostics, remove article

* [Diagnostics] Adapt message for missing return diagnostics to have a note with fix

* [tests] Adjust tests in validation suit
2021-04-20 08:16:32 -03:00
Karoy Lorentey
f7f44763eb [test] Add missing version guards to tests for new stdlib behavior
rdar://75837172
2021-03-30 22:06:55 -07:00
Andrew Trick
eb15f3376c Temporarily move FixedPoint.swift.gyb into long_test
[SR-14363] FixedPoint.swift.gyb slowed down with -Onone copy propagation
2021-03-16 09:13:13 -07:00
Ben Rimmington
aac2caf7c6 [stdlib] Speed up the FixedPointConversion tests (#36434) 2021-03-15 11:50:57 -04:00
eeckstein
5acd5e65c4 Merge pull request #36426 from benrimmington/sr-14282
[SR-14282] Compiler crash in DictionaryTrapsObjC.swift
2021-03-14 11:32:54 +01:00
Andrew Trick
8ba6868c35 Fix stdlib/Dictionary tests for copy-propagation.
[NSArray getObjects] does not retain the objects.
2021-03-12 19:33:23 -08:00
Ben Rimmington
cbba5042d8 [SR-14282] Compiler crash in DictionaryTrapsObjC.swift 2021-03-12 19:28:07 +00:00
Xiaodi Wu
4c7059f59a [stdlib][SR-13883] Avoid advancing past representable bounds when striding (#34860)
* [stdlib][SR-13883] Avoid advancing past representable bounds when striding.

* [stdlib] Expand a test and add a comment to ensure correct floating-point stride bounds checking.

* [stdlib][NFC] Clarify a comment in a test.

* [stdlib][NFC] Adjust copyright notices, clarify comments, delete '-swift-version=3' for tests.

* [stdlib] Add implementations for fixed-width integer strides for performance.

* [stdlib] Document `Strideable._step` and modify overflow checking behavior of `Stride*Iterator`.

* [stdlib] Address reviewer comments, postpone documentation changes

* [stdlib][NFC] Update documentation for '_step(after:from:by:)'

* [stdlib][NFC] Use 'nil' instead of an arbitrary value for integer striding '_step' index
2021-03-11 08:18:28 -05:00
Ben Rimmington
d2495f87f0 [stdlib] Reinstate the FixedPointConversion tests (#36205)
* [stdlib] Reinstate the FixedPointConversion tests

* [stdlib] Update the FixedPointConversion tests

* [stdlib] Generate the FixedPointConversion tests

* [stdlib] FixedPointConversion_Release32: long_test
2021-03-09 22:24:03 -05:00
Ben Rimmington
5be886f094 [stdlib] Reinstate some tests (#36072) 2021-03-02 18:13:04 +00:00
Michael Gottesman
d3aee16db3 [silgen-cleanup] Ensure that we move nextII past /all/ instructions we are going to delete no matter order of visitation.
Specifically, given code like the following:

```
(%1, %2) = multi_result_inst %0   (a)
inst_to_delete %1                 (b)
inst_to_delete %2                 (c)
```

We would sometimes visit (c) before (b). So if nextII was (b) at that point, we
would think that we were safe. Then we process (b), move nextII from (b) ->
(c). Then we delete both (b) and (c). =><=.

The solution to this is each iteration of the delete loop, we track /all/
instructions that eliminateDeadInstruction is going to eliminate and ensure that
after each callback is called we have moved past all visited instructions (even
ones we visited previously). This is done using a small set that I clear each
iteration.

I also re-enabled the dictionary test that exposed this issue when testing
-O/-Osize.

rdar://71933996
2021-02-22 13:33:56 -08:00
3405691582
e81534960c [validation] Fix some portability test issues.
Here we fix a few portability issues affecting running the validation tests on OpenBSD. The remaining failures will be dealt with separately.

1. In the `rth` tool, ensure `-z origin` is specified to the linker when
   using `$ORIGIN`, as required on this platform.

2. Explicitly set the rpath in the `dsohandle-multi-module` execution
   test, since the test uses built dynamic libraries during the test.

3. Erase the environment variable instead of using `env -u`, the latter
   of which is not portable.
2021-02-06 16:36:44 -05:00
Andrew Trick
677424b337 Merge pull request #35315 from atrick/fix-settestlifetime
Add a _fixLifetime to stdlib/Set.swift test.
2021-01-08 21:16:17 -08:00
Andrew Trick
0aa91f46ec Add a _fixLifetime to stdlib/Set.swift test.
On Linux with -O:

[ RUN      ] Set.formSymmetricDifference
stdout>>> check failed at /Users/docker_user/src/build/buildbot_linux/swift-linux-x86_64/main.swift, line 3245
stdout>>> unexpected value: "94788628116752" (of type Swift.Int)
[     FAIL ] Set.formSymmetricDifference

The test is roughly:

  var s1 = Set(...)
  let s1_copy = s1

  let identity1 = s1._rawIdentifier()
  s1.someMutatingMethod1()

  check(s1)
  check(s1_copy)

  s1.someMutatingMethod2()

  // Mutating the set should cause an identity change
  releaseAssert(identity1 != s1._rawIdentifier())

On Linux, the optimizer is able to destroy s1_copy before the call to
s1.someMutatingMethod2(), which generates new Set storage. This new
storage uses the same address as the destroyed s1_copy.

Fixes rdar://72933150 ([CanonicalOSSA] Fix Set.swift unit test that assumes object lifetime)
2021-01-08 11:52:33 -08:00
Karoy Lorentey
4b2f032fac [test] Disable tests for newly introduced Range behavior on earlier OSes 2021-01-06 13:03:58 -08:00
Karoy Lorentey
8082b58365 Merge pull request #34961 from lorentey/buffers-need-to-be-fast-but-not-too-fast
[stdlib] Review and fix some problems with unsafe buffer and Range initialization
2020-12-12 19:13:20 -08:00
Arnold Schwaighofer
20dd3997de This test also fails in optimize size mode
rdar://71933996
2020-12-08 07:12:18 -08:00
Karoy Lorentey
c5c27c7c69 [stdlib] Add a missing debug precondition to [Closed]Range.init(uncheckedBounds:)
Unchecked APIs must still perform checks in debug builds to ensure that invariants aren’t violated.
(I.e., these aren’t a license to perform invalid operations — they just let us get rid of the checks when we know for sure they are unnecessary.)
2020-12-04 02:06:22 -08:00
Karoy Lorentey
7f63b42496 [test] ArrayTraps: Skip trap test on negative UBP counts in release builds 2020-12-04 02:06:21 -08:00
Arnold Schwaighofer
007c74f5ba Temporarily disable test in optimize mode
The test failed on oss-swift_tools-RA_stdlib-RD_test-simulator

rdar://71933996
2020-12-03 07:21:12 -08:00
Kuba (Brecka) Mracek
d7dfa3e942 Bring up tests + validation tests for the 'freestanding' build and the standalone_minimal preset (#34386) 2020-10-26 16:32:36 -07:00
Karoy Lorentey
184367ca8f [stdlib] Fix Array.append(contentsOf:) for arguments of type NSArray
Due to a couple of unfortunate circumstances, appending an NSArray instance to an Array instance does not actually append any elements.

The cause is https://github.com/apple/swift/pull/29220, which accidentally optimized away the actual loop that appends the elements in this particular case. (And only this particular case, which is why this wasn’t detected by the test suite.)

When the argument to `Array.append(contentsOf:)` is of type NSArray, the `newElements is [Element]` expression is compiled into a runtime check that returns true, eliminating the subsequent loop over the remaining items of the iterator. Sadly, NSArray.underestimatedCount` currently returns 0, so the earlier _copyContents call is a noop, so no elements get added to `self` at all.

Turning the `is` test into a direct equality check between the metatype instances resolves the issue.
2020-10-24 18:17:52 -07:00
Mishal Shah
21f4cf6a9c [XFAIL] Disable validation-test/stdlib/CommandLine.swift (70423908) 2020-10-18 17:42:21 -07:00
Kuba (Brecka) Mracek
9de7b59388 Subsume SWIFT_STDLIB_USE_NONATOMIC_RC into SWIFT_STDLIB_SINGLE_THREADED_RUNTIME (#33643) 2020-08-26 21:28:30 -07:00
Stephen Canon
457b9990e9 Add checks that the endpoints of partial ranges are not-NaN. (#33378)
We can't actually check for NaN (because the notion doesn't exist for Comparable), but we can require that the endpoint is non-exceptional by checking if it equals itself.
2020-08-10 14:06:46 -04:00
Mishal Shah
a3cd8bc9e9 [Tests] Codesign the binary before executing the test 2020-08-07 00:26:07 -07:00