Commit Graph

208 Commits

Author SHA1 Message Date
Alejandro Alonso
1cda063fe0 Update Dictionary.swift 2024-06-06 11:02:47 -07:00
Karoy Lorentey
b82ce9c3be [stdlib] Adopt _pointerBitWidth conditional 2023-04-27 13:33:24 -07:00
Anthony Latsis
73b6784946 Gardening: Migrate test suite to GH issues: validation-test/stdlib 2022-09-20 02:32:29 +03:00
Lily Lin
fbd70fe6eb Fix build error for linux builds and add basic validation test 2022-06-03 15:26:06 -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
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
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
Arnold Schwaighofer
20dd3997de This test also fails in optimize size mode
rdar://71933996
2020-12-08 07:12:18 -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
Karoy Lorentey
b90e2ef776 [test] Denineninenineninify behavioral tests added for 5.1 2019-08-27 15:44:04 -07:00
Saleem Abdulrasool
1c41c0887c validation-test: adjust stdlib tests for Windows
The embedded shell script in the RUN command for lit is problematic for
non-sh shell environments (i.e. Windows).  This adjusts the tests to
uniformly build the code for the ObjC runtime.  However, the Objective-C
code is only built under the same circumstances that it is currently
enabled - the availability of the needed frameworks.  The empty object
on other runtimes will have no material impact.  The swift side of it
checks whether the runtime is built with ObjC interop.  This allows us
to largely use the same command line for all the targets.  The last
missing piece is that the `-fobjc-runtime` requires that we run a modern
ObjC runtime.  We enable this unconditionally in lit for the non-Apple
targets.

This improves the validation test coverage for the standard library on
Windows.
2019-06-03 08:36:22 -07:00
Karoy Lorentey
f776a381f3 [test] Add availability guards for tests checking behavioral changes in 5.1 2019-05-03 19:09:47 -07:00
Arnold Schwaighofer
1e63ce77fb Revert "Temporarily disable stdlib tests depending on autorelease elision." 2019-04-16 08:34:01 -07:00
Andrew Trick
bb8c5c66f9 Temporarily disable stdlib tests depending on autorelease elision.
Until the issue is fixed. Tracked by:
<rdar://problem/49791522> Swift CI Test failures: IRGen/autorelease_optimized_armv7/aarch64.
https://bugs.swift.org/browse/SR-10474
2019-04-15 16:31:47 -07:00
Karoy Lorentey
e08b219448 Merge pull request #23683 from lorentey/casting-improvements
[stdlib] Fix Set/Dictionary casting issues
2019-04-15 10:56:38 -07:00
Karoy Lorentey
3c74c0f1cb [stdlib] Change the signature of Dictionary’s bulk initializer (#23758)
The initializer was originally introduced without proper availability; in https://github.com/apple/swift/pull/23643, we fixed this by applying the `@_alwaysEmitIntoClient` attribute. However, this had the unfortunate side-effect that the symbol disappeared from `libswiftCore.dylib`, which somehow confuses some simulator builds.

Try to figure out what’s happening by replacing the third closure argument with an integer return value. This changes the mangled name of the bulk initializer, which should make it more obvious how/why these builds fail.

rdar://problem/49479386
2019-04-03 10:51:36 -07:00
Karoy Lorentey
ceb703b840 [test] Add new Set/Dictionary casting tests 2019-03-29 19:15:23 -07:00
Karoy Lorentey
3356b2aca4 Revert "[test] Dictionary: Skip a failing index validation test" 2019-02-28 14:16:38 -08:00
Karoy Lorentey
a7f9894f5a [test] Dictionary: Skip a test that currently fails when compiled with -O
rdar://problem/47973577
2019-02-25 16:03:23 -08:00
David Smith
490325c057 Update Dictionary test expectations too 2019-02-11 21:24:33 -08:00
David Smith
016ced2c44 Adopt the new bulk Dictionary initializer in bridging 2018-12-20 16:57:38 -08:00
Karoy Lorentey
f0e04f73f4 [stdlib] Process elements from back to front 2018-12-18 09:49:58 -08:00
Karoy Lorentey
039891c24b [stdlib] Dictionary: Add support for non-unique keys in bulk loading init 2018-12-18 09:49:58 -08:00
Karoy Lorentey
f1f5e0f2bf [stdlib] Dictionary: Add unsafe bulk-loading initializer
Interface inspired by this Array pitch:
https://forums.swift.org/t/array-initializer-with-access-to-uninitialized-buffer/13689
2018-12-18 09:49:58 -08:00
Karoy Lorentey
c8664c490d [test] Dictionary: Add checks for expected failures in Dictionary bridging 2018-12-13 17:09:36 +00:00
Karoy Lorentey
ce96f1e528 [stdlib] _modify: Use defer to ensure invariants are restored when yield throws
_modify mustn’t leave Collection storage in an inconsistent state when the code to which we’re yielding happens to throw. In practice this means that any cleanup code must happen in defer blocks before the yield.

Fix Dictionary to do just that and add tests to cover this functionality (as well as some other aspects of _modify).
2018-12-05 17:35:24 +00:00
Karoy Lorentey
92d355a4be [test] Dictionary: Add some tests for new index validation features in 5.0 2018-11-23 16:48:23 +00:00
Karoy Lorentey
cc3b270691 [test] Set/Dictionary: Restore bucket-level tests for collision handling 2018-11-23 12:49:35 +00:00
Karoy Lorentey
f013ffe9ec [test] Add basic leak tests for key-based Dictionary.subscript variants 2018-10-26 16:20:01 +01:00
Karoy Lorentey
a301449e5f [test] Fix spurious failure in optimized tests
We don’t emit the trap message in optimized builds, so don’t check for it.
2018-10-05 12:30:51 +01:00
Karoy Lorentey
6e671b6631 [stdlib] Allow native dictionaries to advance Cocoa indices 2018-10-03 21:05:46 +01:00
Karoy Lorentey
2b7ef24990 [stdlib] Dictionary.merge: Don’t leave storage in an inconsistent state when closure throws 2018-10-01 15:40:14 +01:00
Karoy Lorentey
7ff82b3ba9 [stdlib] Dictionary.updateValue(_:,forKey:): Don’t overwrite the existing key
Replacing the old key with the new is unnecessary and somewhat surprising. It is also harmful to some usecases.

rdar://problem/32144087

# Conflicts:
#	stdlib/public/core/NativeDictionary.swift
2018-09-27 21:20:54 +01:00
Karoy Lorentey
b4e27b110a Revert "[stdlib] Dictionary.updateValue(_:,forKey:): Don’t overwrite the existing key" 2018-09-26 16:08:07 +01:00
Karoy Lorentey
a293ce15a6 [stdlib] Dictionary.updateValue(_:,forKey:): Don’t overwrite the existing key
Replacing the old key with the new is unnecessary and somewhat surprising. It is also harmful to some usecases.

rdar://problem/32144087
2018-09-24 15:44:43 +01:00
Karoy Lorentey
00bbf1bde3 [test] Fix flaky test 2018-09-22 02:04:10 +01:00
Karoy Lorentey
95d9fba1cc [test] Update tests for Set/Dictionary changes
Along with updating tests to adopt the new storage class names, the behavior of removeAll() has changed slightly.

If t stored an empty Set/Dictionary that was bridged from Objective-C, t.removeAlI() used to keep the original Objective-C storage intact. Now removeAll() replaces the old storage with the empty singleton, which makes a lot more sense to me.
2018-09-22 02:04:08 +01:00
Ben Cohen
e338344bae Remove overloads that were needed pre-conditional conformance 2018-09-11 21:00:36 -07:00
Ben Cohen
75018155ff Kill old set/dictionary-specific bridging entrypoints (#18930) 2018-08-25 07:27:26 -07:00
Arnold Schwaighofer
b62c6e64ff Codesign validation-test/stdlib 2018-08-10 09:39:09 -07:00
Ben Rimmington
2f326bcc88 [stdlib] Remove theGlobalMT19937
SwiftPrivate/PRNG.swift:

- currently uses `theGlobalMT19937`;
- previously used `arc4random` (see #1939);
- is obsoleted by SE-0202: Random Unification.
2018-08-01 13:00:16 +01:00
Karoy Lorentey
d2861f779e [test] Re-add crash tests for getObjects:andKeys:count:
On some platforms, when a new process is started, ARC’s autoreleased return value optimization is expected to fail the first time it is used in each linked dylib. StdlibUnittest takes care of warming up ARC for the stdlib (libswiftCore.dylib), but for Dictionary.swift, we also need to do it for Foundation, or there will be spurious leaks reported for tests immediately following a crash test.

Add the necessary dummy operations to setUp, and re-add the crash tests that were removed in #17862. (As separate tests this time, so they don’t hide leaks in non-crashing test parts.)
2018-07-13 15:32:52 +01:00
Karoy Lorentey
4832e0ed46 [test] Fix leak and reenable getObjects:andKeys:count: tests 2018-07-12 18:33:00 +01:00
Karoy Lorentey
d1fd33f9b0 [test] Disable getObjects:andKeys:count: tests.
Removing crash tests fixed optimized test runs, but exposed an issue in unoptimized i386 simulator tests.

Disable the two affected tests until we plug all their holes.
2018-07-11 01:42:30 +01:00
Karoy Lorentey
6c97fe4db8 [test] Reenable previously disabled Dictionary tests 2018-07-10 22:42:22 +01:00
Karoy Lorentey
68a5331712 [test] Fix Dictionary failures; reenable previously disabled tests
Crashes somehow interfere with object counters in optimized tests, breaking the tests immediately following a crash test.

Remove getObjects:andKeys:count: crash tests for now.

rdar://problem/41871587
2018-07-10 22:41:54 +01:00
Karoy Lorentey
ea98396dbd [test] Skip two Dictionary tests to unblock CI 2018-07-10 13:13:59 +01:00
Ben Cohen
685f31b0e2 [stdlib] Migrate stdlib tests of Swift 3 (#17427)
* First sweep of Swift 3 stdlib test upgrades

* Review feedback

* Remove a handful more #if >=4.0

* Fix up Dictionary tests
2018-07-08 09:37:01 -07:00
Mark Lacey
dec3341ee0 Merge pull request #17748 from rudkx/remove-swift3-from-some-tests
Remove -swift-version 3 from a handful of tests and update them appro…
2018-07-06 15:59:40 -07:00
Karoy Lorentey
91bb2c0a6c [test] check getObjects:andKeys:count: implementations in bridged Dictionaries 2018-07-05 15:52:11 +01:00