Commit Graph

609 Commits

Author SHA1 Message Date
Saleem Abdulrasool
5d683d9670 StdlibUnittest: port to android x86, x86_64
Account for the x86 and x86_64 architectures when defining
`RTLD_DEFAULT`.
2019-11-03 20:52:11 -08:00
Mike Ash
b8f5e841e2 [Runtime] Add a function pointer for intercepting swift_willThrow calls.
rdar://problem/53400364
2019-10-24 14:06:14 -04:00
Michael Ilseman
d30ec5ba79 Merge pull request #26884 from milseman/cache_alignment
[test] Disable misaligned indices test prior to 5.1
2019-08-28 14:23:11 -07:00
Michael Ilseman
774788ac18 [test] Disable misaligned indices test prior to 5.1
Misaligned indices were fixed in 5.1, but we should disable the test
when testing back deployment.

Adds a shared helper to StdlibUnittest for the run time check.
2019-08-27 15:13:38 -07:00
Karoy Lorentey
d5ea371eed [test] Add some high-level tests for AutoreleasingUnsafeMutablePointer 2019-08-26 20:09:53 -07:00
Puyan Lotfi
6691fda8ec Appending SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS to SWIFT_COMPILE_FLAGS.
There are situations where you want to build against a libc that is out
of tree or that is not the system libc (Or for cross build scenarios).
This is a change for passing the -sdk and include paths for things like
this.
2019-07-01 09:43:47 -07:00
Saleem Abdulrasool
2a710f4bba StdlibUnittest: disable FP80 path on android
android x64 does not support FP80
2019-06-23 21:05:46 -07:00
Saleem Abdulrasool
1d1c362aba StdlibUnittest: consume the carriage return on stdout
This was already being done for the stderr, but not for stdout.  Doing
this means that we no longer get spurious carriage returns on the stdout
output stream on Windows.  This is needed for supporting the
validation test suite on Windows.
2019-06-05 13:59:22 -07:00
Mishal Shah
6c69c8d0bb Merge pull request #25135 from porglezomp-misc/fix/stdlib-unittest-over-release
FIx an overrelease in StdlibUnittest's getSystemVersionPlistProperty
2019-06-03 13:35:04 -07:00
Mishal Shah
d543dd9a61 Merge pull request #25136 from porglezomp-misc/fix/stdlib-unittest-race
Fix a potential race condition in StdlibUnittest
2019-05-31 14:18:30 -07:00
Ben Cohen
e9d4687e31 De-underscore @frozen, apply it to structs (#24185)
* De-underscore @frozen for enums

* Add @frozen for structs, deprecate @_fixed_layout for them

* Switch usage from _fixed_layout to frozen
2019-05-30 17:55:37 -07:00
Cassie Jones
dc395a1d1d Replace objc version of getSystemVersionPlistProperty with swift version
The comment in the function said:
// This function is implemented in Objective-C because Swift does not support
// failing initializers.
which hasn't been true since swift 1.1.
2019-05-29 18:51:31 -07:00
Cassie Jones
2d21059030 Fix an over-release in StdlibUnittest
Fixes rdar://51245681
2019-05-29 18:01:39 -07:00
Cassie Jones
e84142539c Fix a potential race condition in StdlibUnittest
StdlibUnittest uses an AtomicBool to track whether a failure has ocurred
in a test. Before this, expectFailure could have a false-positive
failure due to a race condition on the _anyExpectFailed.

The following interleaving would trigger the issue:

A: loads false
A: stores false
B: loads false
A: stores true
B: stores false
A: loads false (after body)

This causes A to see a false-positive failure.
2019-05-26 16:17:39 -07:00
Ross Bayer
dfb2d31e74 Rename the LIBRARY_INSTALL_NAME_DIR argument in add_swift_target_library to DARWIN_INSTALL_NAME_DIR which better explains that this argument only controls the install_name_dir for Darwin platforms. 2019-04-29 16:46:09 -07:00
Ross Bayer
b855119fbe Added a new CMake cache variable to control the private standard library install_name_dir. Those libraries are not going to be installed in /usr/lib/swift and thus need to be controlled via a separate mechanism. 2019-04-29 16:46:09 -07:00
Karoy Lorentey
d9c166fdb9 Merge pull request #23832 from lorentey/foundation-hashing
[Foundation] Modernize hashing in Foundation's Swift-only types
2019-04-26 14:59:13 -07:00
Saleem Abdulrasool
83b290438c Windows: bridge BOOL to Bool
This allows the conversion of the Windows `BOOL` type to be converted to
`Bool` implicitly.  The implicit bridging allows for a more ergonomic
use of the native Windows APIs in Swift.

Due to the ambiguity between the Objective C `BOOL` and the Windows
`BOOL`, we must manually map the `BOOL` type to the appropriate type.
This required lifting the mapping entry for `ObjCBool` from the mapped
types XMACRO definition into the inline definition in the importer.

Take the opportunity to simplify the mapping code.

Adjust the standard library usage of the `BOOL` type which is now
eclipsed by the new `WindowsBool` type, preferring to use `Bool`
whenever possible.

Thanks to Jordan Rose for the suggestion to do this and a couple of
hints along the way.
2019-04-25 17:52:08 -07:00
Saleem Abdulrasool
70b6bdae0d StdlibUnittest: make a var a let (NFC)
Silences a suggestion from the compiler to convert a value which is not
mutated into a `let` binding rather than a `var` binding.
2019-04-09 08:50:23 -07:00
Karoy Lorentey
68e64492ce [StdlibUnittest] checkHashable: Add opt-in support for incomplete hashes 2019-04-05 15:21:24 -07:00
Karoy Lorentey
668c1f0c6f [test] StdlibUnittest: Cosmetic changes to checkEquatable/checkHashable 2019-04-04 13:56:29 -07:00
Luciano Almeida
a62c87f6cd [stdlib] Addressing Fixme comment atomic stdlib unit test flags (#23198)
* Addressing FIXME comment making StdlibUnittest flags atomic

* Commenting store

* Fix wrong change

* Add comment

* Addressing the PR comment suggestions.

* Remove public wrong place.

* Reverting comment iff

* Update stdlib/private/StdlibUnittest/StdlibUnittest.swift

Co-Authored-By: LucianoPAlmeida <passos.luciano@outlook.com>

* File private vars
2019-03-28 12:06:02 -07:00
Harlan Haskins
fbce6e7873 [StdlibUnittest] Allow tests to require a new process
When testing runtime lookup changes, we want to make sure each test runs in isolation. Add a new modifier, `.requireOwnProcess()`, to enable tests to guarantee they’re run in isolation.
2019-03-17 17:29:36 -07:00
Saleem Abdulrasool
06ec943d89 StdlibUnittest: add a workaround for Windows \r\n
Windows uses carriage returns and newlines.  The string matching is
sensitive to this.  Simply erase carriage returns from the standard
error stream to compensate.
2019-02-28 23:13:52 -08:00
Saleem Abdulrasool
bc58e5bc3f stdlib: disable abort reporting on Windows
Avoid the dialog when an assertion fails on Windows.  This is important to
ensure that the tests do not create a large number of prompts.
2019-01-03 16:56:42 -08:00
Saleem Abdulrasool
b7e21da2d0 StdlibUnittest: add a VEH for TRAP on Windows
Add a vectored exception handler for illegal instructions on Windows.
This allows us to emulate `signal(SIGTRAP, ...)`.  This allows better
coverage of tests.
2019-01-02 09:38:18 -08:00
Saleem Abdulrasool
9421d0189c StdlibUnittest: prevent abort dialog on Windows
Adjust the abort behaviour on Windows.  The aborts would cause a large
number of dialogs to appear.  This reduces the load a bit and is crucial
for getting tests to run without manual intervention.
2019-01-02 09:37:34 -08:00
Saleem Abdulrasool
3027784bf7 StdlibUnittest: add a workraound for DOS lineendings
Windows uses DOS line endings which appear through the PIPE endpoints.
We currently split on line feeds only, leaving the carriage return in
place.  Without this, the messages on the communication pipe would not
be interpreted correctly.
2019-01-02 09:37:34 -08:00
Saleem Abdulrasool
335ea14beb stdlib: port StdlibUnittest to Windows 2019-01-02 09:37:34 -08:00
Maxim Moiseev
165fe328c3 [stdlib] tee _stdlib_AtomicInt > SwiftPrivate
Turns out some people used this type despite it being prefixed with
`_stdlib_`, so we have to keep it, with an obsoletion message this time.
Second copy of the same type is kept available past Swift 5 in
SwiftPrivate for use in tests.
2018-12-18 16:12:47 -08:00
Maxim Moiseev
ebf90f78be Make an StdlibUnitTest error message a bit more useful 2018-12-06 14:11:57 -08:00
Karoy Lorentey
1ef6cf4813 Merge pull request #20866 from lorentey/deprecate-hashValue-1
[test] Modernize hashing throughout the test suite
2018-11-30 14:21:04 +00:00
Karoy Lorentey
8e77a2655a [test] StdlibUnittest: Add missing hash(into:) implementations 2018-11-29 15:55:17 +00:00
Saleem Abdulrasool
ce40d72641 stdlib: implement _stdlib_pthread_join in terms of Windows threading
Implement `_stdlib_pthread_join` in terms of windows threading.
Additionally, rename it to `_stdlib_thread_join`.
2018-11-26 13:10:00 -08:00
Saleem Abdulrasool
6bf7b9e711 stdlib: implement _stdlib_create_pthread_block in terms of Windows threaing
Port the block based thread constructor to Windows threading model, and
rename it to `_stdlib_create_thread_block`.
2018-11-26 13:10:00 -08:00
Saleem Abdulrasool
940db1b0cf stdlib: remove pthread_attr_t from _stdlib_pthread_create_block
The attributes were not being used currently.  Since this is a private
interface, remove the parameter as it makes it easier to port to
Windows.
2018-11-26 13:09:31 -08:00
Saleem Abdulrasool
0693bec1f1 sdlib: rename SwiftPrivatePthreadExtras to SwiftPrivateThreadExtras
This is in preparation to make the code here more target agnostic for
porting to the Windows threading primitives.  This is used pretty
extensively in the tests, so disabling tests would lose a chunk of
coverage.
2018-11-26 13:09:31 -08:00
Ben Cohen
df2307e035 [stdlib][DNM] Collapse sequence and collection wrappers (#20221)
* Concretize dropFirst/Last/sufix/prefix from Sequence

Remove split customization point

Eliminate SubSequence from Sequence protocol

Collapse LazyCollection

Collapse LazyMapCollection

Eliminate _SequenceWrapper

Collapse LazyFilterCollection

Collapse LazyDrop/PrefixWhileCollection

Fix tests, ABI stability update

Collapse FlattenSequence

* Add entries to source/ABI compatible expected results.

* Update tests to avoid pre-10.14 objc runtime bug

* Expunge _preprocessingPass
2018-11-14 10:05:58 -08:00
Lance Parker
f1a35bd1c9 String comparison iterator for UTF8 strings 2018-11-04 10:42:41 -08:00
Michael Ilseman
4ab45dfe20 [String] Drop in initial UTF-8 String prototype
This is a giant squashing of a lot of individual changes prototyping a
switch of String in Swift 5 to be natively encoded as UTF-8. It
includes what's necessary for a functional prototype, dropping some
history, but still leaves plenty of history available for future
commits.

My apologies to anyone trying to do code archeology between this
commit and the one prior. This was the lesser of evils.
2018-11-04 10:42:40 -08:00
Michael Gottesman
3f17bb6ddf Carefully split the build's invocation of add_swift_library into host/target variants.
The key thing here is that all of the underlying code is exactly the same. I
purposely did not debride anything. This is to ensure that I am not touching too
much and increasing the probability of weird errors from occurring. Thus the
exact same code should be executed... just the routing changed.
2018-10-27 12:58:51 -07:00
Karoy Lorentey
b2ef455b3a [test] Update tests for _rawHashValue(seed:) changes 2018-09-24 13:31:19 +01:00
Ben Cohen
e338344bae Remove overloads that were needed pre-conditional conformance 2018-09-11 21:00:36 -07:00
Chéyo Jiménez
a527e53e17 Renamed DictionaryLiteral to KeyValuePairs (#16577)
* renamed DictionaryLiteral to KeyValuePairs per SE-0214

* renamed DictionaryLiteral type tests to KeyValuePairs

* [SE-0214] Move changelog entry (Swift 4.2 => 5.0)

* [SE-0214] Update comment in AST/Expr.h

* [SE-0214] Use generic typealias

See also <https://github.com/apple/swift/pull/17711>

* [SE-0214] Update source-stability.swift.expected
2018-08-27 10:51:12 -07:00
Joe Groff
5461b1b079 Don't hardcode metadata kind constants in tests. 2018-08-20 10:49:40 -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
Ben Cohen
345879429b [stdlib] Take several underscored stdlib functions private (#18134)
* Make _sanityCheck internal

* Make _debugPrecondition internal

* Make Optional._unsafelyUnwrappedUnchecked internal.

* Make _precondition internal

* Switch Foundation _sanityChecks to assertions

* Update file check tests

* Remove one more _debugPrecondition

* Update Optimization-with-check tests
2018-07-24 18:26:19 -07:00
Ben Cohen
4694310e51 [stdlib] Some minor cleanup (#18130)
* Remove case destructuring to _

* Remove some Iterator.Element

* Which idiot wrote this? Oh.

* Switch NibbleSort to just use default impls... shouldn't change perf
2018-07-21 17:29:57 -07:00
Brent Royal-Gordon
b6e35038b2 [SILGen] Output a different message for failed IUO force-unwraps
Modifies SILGen and the `Swift._diagnoseUnexpectedNilOptional` call to print a slightly different message for force unwraps which were implicitly inserted by the compiler for IUOs. The message is chosen based on the presence of certain flags in the `ForceValueExpr`, not on the type of the value being unwrapped.
2018-07-12 19:09:56 -07:00
Michael Gottesman
493136267c Merge pull request #17815 from gottesmm/pr-861b0b35b2be7673bc8ea0c903f50247d1bc502b
[+0-all-args] Clean up remains of +1 convention from the runtime.
2018-07-09 12:24:36 -07:00