Motivation:
The syscall abstraction layer tests aren't sendable clean.
Modifications:
- Factor out the setup/teardown of SAL tests into a SALContext
- SALContext a method to run a SAL test with two closues: one on the
hooked event loop and another on the calling thread.
- The EL bound closure is provided with the EL and locked boxes for the
user ot kernel and kernel to user boxes.
- The closure on the calling thread is provided with an 'assertions'
object which provides a view over the hooked selector.
- Note that there are still sendable holes in this code.
- Refactored the tests to use these APIs.
Results:
Safer tests.
Co-authored-by: Cory Benfield <lukasa@apple.com>
### Motivation:
Warnings are annoying.
### Modifications:
- Remove unnecessary use of `Foundation.Thread` which isn't Sendable.
- Remove now unnecessary `@retroactive`s.
- Enable `-warnings-as-errors` in CI
### Result:
- Warnings can't sneak in as easily anymore
- No more warnings left in `swift-nio`
```
$ rm -rf .build/arm64-apple-macosx/ && swift build --build-tests -Xswiftc -warnings-as-errors > /dev/null
echo $?
$ echo $?
0
```
Co-authored-by: Cory Benfield <lukasa@apple.com>
* Apply formatting
* Apply no block comments rule
* Apply OmitExplicitReturns
* Apple OnlyOneTrailingClosureArgument
* Apply NoAssignmentInExpressions
* Fix up DontRepeatTypeInStaticProperties lint errors
* Apply `OrderedImports`
* Apply `ReplaceForEachWithForLoop`
* format file
* Enable the formatting pipeline
* Adopt `AmbiguousTrailingClosureOverload`
* Fix license header
* Fix format check
* Fix `EndOfLineComment`
* Fix CI
* Adapt CI script to check if changes when running formatting
* Separate lint and format into to steps
* Fix format
* Adopt `UseEarlyExits`
* Revert "Adopt `UseEarlyExits`"
This reverts commit d1ac5bbe12.
Motivation:
This test is flaky, and has always been flaky.
The issue here is simply a timing one. It has always been possible
for the thread running in the background DispatchQueue to be take
longer between calling semaphore.signal and promise.cascade(to:)
than it does for the event loop to process the tasks. If that
happens, this test will fail by eventually timing out.
Modifications:
- Adjust the test to avoid using promise.cascade(to:), and so prevent it
from having at timing window.
Result:
The test will be not flaky, or at least less flaky.
Resolves#1971.
Co-authored-by: George Barnett <gbarnett@apple.com>
Motivation:
The remaining NIO code really conceptually belongs in a module called
NIOPosix, and NIOCore should really be called NIO. We can't really do
that last step, but we can prepare by pushing the bulk of the remaining
code into a module called NIOPosix.
Modifications:
- Move NIO to NIOPosix
- Make NIO an umbrella module.
Result:
NIOPosix exists.