-
Notifications
You must be signed in to change notification settings - Fork 102
Comparing changes
Open a pull request
base repository: swiftlang/swift-testing
base: 6.0.1
head repository: swiftlang/swift-testing
compare: main
Commits on Aug 21, 2024
-
This PR supersedes #603, #613, and #614. Exit tests remain an experimental feature. ## Clarify that 8-bit exit codes aren't a problem on macOS and Windows. (#603) The documentation for the experimental exit tests feature currently says that on POSIX-like systems, only the low 8 bits of a process' exit code are preserved. This would be true if we used `wait()`, `wait4()`, etc. and `WEXITSTATUS()`, but we use `waitid()` instead which is [supposed to](https://pubs.opengroup.org/onlinepubs/9699919799/functions/exit.html) preserve the full exit code. It does so on Darwin, but not on Linux; Windows doesn't use `waitid()` but does report the full exit code. Now, we're not currently building for any other POSIX-like systems that support processes (WASI/Wasm doesn't count here), so I've left in some weasel words and added a canary unit test. It will let us know if/when we add a platform that where `waitid()` doesn't preserve all the bits of the exit code, and we can amend the documentation in that case. ## Implement an equality operator for ExitCondition. (#613) This PR implements `==` and `===` for `ExitCondition`, part of the experimental exit tests feature. These operators are necessary in order to allow for exit tests to support more complex matching by trailing closure (e.g. to support inspecting `stdout`.) Because `.failure` is a fuzzy case, `==` fuzzy-matches while `===` exactly matches. `Hashable` conformance is unavailable. Example usage: ```swift let lhs: ExitCondition = .failure let rhs: ExitCondition = .signal(SIGTERM) print(lhs == rhs) // prints "true" print(lhs === rhs) // prints "false" ``` ## Allow throwing an error from an exit test's body. (#614) This PR amends the signatures of the exit test macros (`#expect(exitsWith:) {}` and `try #require(exitsWith:) {}`) to allow bodies to throw errors. If they do, they are treated as uncaught errors and the child process terminates abnormally (in the same way it does if an error is thrown from the main function of a Swift program.) ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for a46df3f - Browse repository at this point
Copy the full SHA a46df3fView commit details -
Allow move-only types as suites. (#619)
This PR enables using move-only types as suites. For example: ```swift @suite struct NumberOfBeesTests: ~Copyable { @test consuming func countBees() { var count = 0 for species in allSpecies { if species is Bee { count += species.populationCount } } #expect(count > 0) } } ``` Move-only types have a number of constraints in Swift, and those constraints aren't lifted in a test target, but generally speaking a move-only type should be able to do all the things any other type can do _as a test suite_. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for cd91e93 - Browse repository at this point
Copy the full SHA cd91e93View commit details -
Remove stray use of old
SWT_BUILDING_WITH_CMAKE
condition. (#621)We no longer define `SWT_BUILDING_WITH_CMAKE`, but one file's still checking for it. Fix. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 22b0ef1 - Browse repository at this point
Copy the full SHA 22b0ef1View commit details -
Warn when passing a non-optional value to
try #require(T?)
. (#620)This PR adds an overload of `try #require()` that warns the developer if they pass a non-optional, non-`Bool` value For example, this code: ```swift let x = 0 let y = try #require(x) ``` Will produce the diagnostic: >
⚠️ '#require(\_:\_:)' is redundant because 'x' never equals 'nil' ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.Configuration menu - View commit details
-
Copy full SHA for 097db6c - Browse repository at this point
Copy the full SHA 097db6cView commit details -
Reduce overhead of
.expectationChecked
event handling in `#expect()……`. (#610) This PR refactors the implementation of `#expect()` and `#require()` a bit such that they don't incur more than minimal overhead posting `.expectationChecked` events if nobody is listening for them (which, currently, nobody is.) We considered removing `.expectationChecked` outright, but XCTest has historically had a number of requests for a way to observe calls to `XCTAssert()` etc. even when they pass, so we opted not to remove the event kind at this time. This PR also introduces a cache for fully-qualified type names so that we don't need to call into the runtime to get them as often. Overall speedup is approximately **90% or 11x**. Test time for a tight loop of 1,000,000 `#expect()` calls goes from 5.898893 seconds down to 0.515558291 seconds (as measured on my work computer.) Resolves rdar://133517028. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 8534698 - Browse repository at this point
Copy the full SHA 8534698View commit details -
Implement an overload of
confirmation()
that takes an unbounded ran……ge. (#598) Unbounded ranges are not meaningful when used with `confirmation()` because _any_ confirmation count matches. As well, the `...` operator produces an instance of `UnboundedRange` which is a non-nominal type and cannot conform to `RangeExpression`. It may be non-obvious to a developer why `...` doesn't work as the `expectedCount` argument to that function when other range operators work as expected. This PR implements a stub overload of `confirmation()` that takes an unbounded range. The stub overload is marked unavailable and cannot be called. Example usage: ```swift await confirmation("Stuff happens", expectedCount: ...) { stuff in // ... } ``` Generated diagnostic: > 🛑 'confirmation(\_:expectedCount:sourceLocation:\_:)' is unavailable: Unbounded range '...' has no effect when used with a confirmation. As a reminder, using a range expression with `confirmation()` is an experimental feature and has not been API-reviewed. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for bba4bdf - Browse repository at this point
Copy the full SHA bba4bdfView commit details -
Fix a merge conflict on main-next. (#627)
This PR fixes a conflict between #610 and #619. #610 added a string cache to `TypeInfo` using `ObjectIdentifier` instances as keys. #619 added support for move-only types to `TypeInfo`. Due to rdar://134276458, move-only types cannot be used with `ObjectIdentifier`. This PR uses `UInt` instead until that issue can be resolved in a future stdlib update. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 61d4df9 - Browse repository at this point
Copy the full SHA 61d4df9View commit details -
Testing: use
clock_gettime
on AndroidAndroid recommends `clock_gettime` over `timespec_get` which is available at Level 29 and newer. This is needed to build swift-testing for Android.
Configuration menu - View commit details
-
Copy full SHA for 80e1e94 - Browse repository at this point
Copy the full SHA 80e1e94View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6ba948a - Browse repository at this point
Copy the full SHA 6ba948aView commit details -
Merge pull request #629 from compnerd/android-time
Testing: use `clock_gettime` on Android
Configuration menu - View commit details
-
Copy full SHA for 3fc7f59 - Browse repository at this point
Copy the full SHA 3fc7f59View commit details -
Disallow
@Test
on member functions ofXCTestCase
subclasses. (#626)This PR adds a diagnostic if we detect that `@Test` has been used on a member function of an `XCTestCase` subclass. This was meant to be disallowed, but we neglected to add a check after adopting `lexicalContext`. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 92bd26c - Browse repository at this point
Copy the full SHA 92bd26cView commit details -
Improve test coverage of CustomTestStringConvertible.swift. (#628)
This PR adds 100% test coverage to CustomTestStringConvertible.swift. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 2e3ed1f - Browse repository at this point
Copy the full SHA 2e3ed1fView commit details -
Testing: add some force unwraps for Android
Add some force unwraps to address nullability differences on Android from other platforms.
Configuration menu - View commit details
-
Copy full SHA for d080ee2 - Browse repository at this point
Copy the full SHA d080ee2View commit details -
Merge pull request #631 from compnerd/android
Testing: add some force unwraps for Android
Configuration menu - View commit details
-
Copy full SHA for 5772c9a - Browse repository at this point
Copy the full SHA 5772c9aView commit details -
Fix incorrectly-specified platform list in CMake file. (#633)
Our CMake file that sets compiler conditionals has the wrong syntax when setting `SWT_NO_EXIT_TESTS` conditionally. Fix that. (With thanks to @compnerd.) ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for bda8474 - Browse repository at this point
Copy the full SHA bda8474View commit details
Commits on Aug 22, 2024
-
Fix build errors in
ExitCondition
operators on platforms without ex……it tests. (#635) On platforms without exit tests, `ExitCondition` is marked unavailable. On those platforms, the new operators on `ExitCondition` call each other and the compiler complains because they're calling unavailable symbols. Silence the compiler. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 888caad - Browse repository at this point
Copy the full SHA 888caadView commit details -
Merge pull request #636 from swiftlang/main-next
Merge main-next into main.
Configuration menu - View commit details
-
Copy full SHA for 03c6518 - Browse repository at this point
Copy the full SHA 03c6518View commit details
Commits on Aug 23, 2024
-
Special-case comparisons of ranges in
__checkBinaryOperation()
. (#640)This PR adds an overload of `__checkBinaryOperation()` that is used when the inputs are range expressions. Ranges do not play well with collection diffing so we want to disable that functionality for them. Resolves #639. Resolves rdar://131122002. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 60784ff - Browse repository at this point
Copy the full SHA 60784ffView commit details -
Don't define
swt_getWASIVersion()
on non-WASI. (#632)Don't define `swt_getWASIVersion()` on non-WASI. Oops. :) ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 9773daa - Browse repository at this point
Copy the full SHA 9773daaView commit details -
Set the library version reported via CMake to 6.1-dev. (#637)
This PR updates the version reported when using CMake (i.e. when building in the toolchain) to `"6.1-dev"` with optional trailing git commit hash, if available. The resulting string looks like: > `6.1.0-dev (c6450e0 - modified)` "c6450e02cc76cd7" in this example refers to the most recent commit on the branch I was testing on via `git rev-parse --verify HEAD`, and "modified" is present because I had uncommitted changes. (We'll want to double-check that CMake used in CI can see the git repository and has access to the git tool.) ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for a907113 - Browse repository at this point
Copy the full SHA a907113View commit details -
[6.0] Fix incorrectly-specified platform list in CMake file. (#634)
**Explanation:** Correctly sets `SWT_NO_EXIT_TESTS` on platforms that don't support them when building with CMake. **Scope:** Building iOS, watchOS, tvOS, visionOS, WASI from OSS. **Issue:** N/A **Original PR:** #633 **Risk:** Low **Testing:** Manually tested as we don't have CI using CMake yet. **Reviewer:** @compnerd @briancroom
Configuration menu - View commit details
-
Copy full SHA for b0a306a - Browse repository at this point
Copy the full SHA b0a306aView commit details
Commits on Aug 26, 2024
-
Add
isolation
argument to functions taking non-sendable async closu……res. (#624) This PR adds an `isolation` parameter to several API functions that take `async` closures that are not required to be sendable. As well, it adds `sending` to those closures' return types where appropriate. This change is necessary in Swift 6 because a non-sendable async closure could be called in the wrong isolation domain otherwise. In particular, if the caller is `@MainActor`-isolated, the closure will not be called on the main actor and will therefore always hop, and a concurrency error occurs: ```swift @mainactor func f() async { await confirmation { // this inner closure is not actor-isolated, but can't be sent across // isolation domains. } } ``` `withKnownIssue()` and `confirmation()` are affected, as are several async overloads of the internal-but-public `__check()` function family. This change is necessary for correctness, but is potentially source-breaking if calling code directly references the modified functions by full name. Resolves #622. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for cac6314 - Browse repository at this point
Copy the full SHA cac6314View commit details
Commits on Aug 27, 2024
-
Generalize optional chaining detection used by
#require()
. (#625)This PR generalizes the optional chaining detection used in the implementation of unwrapping `#require()` such that it works with more than just member access expressions. Resolves #623. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 133e302 - Browse repository at this point
Copy the full SHA 133e302View commit details
Commits on Aug 28, 2024
-
Plumb through the testing library version into a function instead of …
…a C++ macro. (#648) This PR moves the consumption of the testing library version (via C++ macro `SWT_TESTING_LIBRARY_VERSION`) to a C++ function. It seems that defining it in CMake for C++ targets doesn't trigger for the Swift side when it imports symbols from C headers. Will verify with a toolchain build. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for ab1b0f9 - Browse repository at this point
Copy the full SHA ab1b0f9View commit details
Commits on Aug 29, 2024
-
[CMake] Fix build with SwiftTesting_BuildMacrosAsExecutables option s…
…et (#645) Resolve the issues with an out-of-toolchain build from the command line with ninja ### Motivation: Fixes #644 ### Modifications: There were two issues: - typo -load-plugin-exectuable -> -load-plugin-executable - The executable target for TestingMacros was not installed ### Result: A build from the command line with cmake -GNinja -Bbuild will successfully complete if SwiftSyntax is not find_package-able ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for d00d469 - Browse repository at this point
Copy the full SHA d00d469View commit details
Commits on Aug 30, 2024
-
Special-case
FileHandle(forWritingAtPath: "CONOUT$")
on Windows. (#654) This PR special-cases calls to `FileHandle.init(forWritingAtPath:)` when passed `"CONOUT$"` (the reserved "console output" file) on Windows such that it does not open a new file but just returns a copy of `.stdout` instead. This change is necessary because, on Windows, opening and locking `"CONOUT$"` does not lock `stdout` (they're considered entirely different files) and output written to `"CONOUT$"` is wrapped at the console's column limit even though it's being written as binary data. The VSCode Swift plugin authors would like to be able to specify writing the JSON event stream to `"CONOUT$"`, but the observed behaviour is stopping them from doing so. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 4c1286e - Browse repository at this point
Copy the full SHA 4c1286eView commit details -
Add basic platform support for Android. (#653)
This PR seeks out all the nooks and crannies where we have platform-specific code or logic and adds Android. In most cases, it's as simple as changing `os(Linux)` to `os(Linux) || os(Android)` but there are a few spots where they diverge. The PR should be _mostly_ self-explanatory. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated. Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
Configuration menu - View commit details
-
Copy full SHA for f2c8ee1 - Browse repository at this point
Copy the full SHA f2c8ee1View commit details
Commits on Sep 3, 2024
-
[android] fix 32 bit android build (#656)
This fixes the following errors: ``` S:/SourceCache/swift-testing/Sources/Testing/Support/FileHandle.swift:423:70: error: cannot convert value of type 'UInt32' to expected argument type 'mode_t' (aka 'UInt16') 421 | } 422 | var statStruct = stat() 423 | return (0 == fstat(fd, &statStruct) && swt_S_ISFIFO(statStruct.st_mode)) | `- error: cannot convert value of type 'UInt32' to expected argument type 'mode_t' (aka 'UInt16') 424 | } 425 | #elseif os(Windows) S:/SourceCache/swift-testing/Sources/Testing/Support/GetSymbol.swift:34:73: error: integer literal '4294967295' overflows when stored into 'Int' 32 | private nonisolated(unsafe) let RTLD_DEFAULT = ImageAddress(bitPattern: -2) 33 | #elseif os(Android) && _pointerBitWidth(_32) 34 | private nonisolated(unsafe) let RTLD_DEFAULT = ImageAddress(bitPattern: 0xFFFFFFFF) | `- error: integer literal '4294967295' overflows when stored into 'Int' ``` ### Motivation: Fix 32 bit android build. ### Modifications: Add explicit types to to cast correctly and to pick correct overload. ### Result: Android swift-testing will build for armv7k and i686. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 8e121e4 - Browse repository at this point
Copy the full SHA 8e121e4View commit details -
Optimizations to
Backtrace.current()
. (#647)This PR optimizes `Backtrace.current()`: - There are now fewer library symbols are captured in a backtrace. This particularly affects debug builds where nested scoped accesses aren't optimized away. - I've eliminated almost all copies of the backtrace's underlying data. On 64-bit targets, the only copy required is to final `Array` storage and is handled by the standard library. - I've eliminated runtime bounds checks on backtrace counts that need to be cast from one integer type to another. - I've renamed the internal symbol `_startCachingForThrownErrors` to `__SWIFT_TESTING_IS_CAPTURING_A_BACKTRACE_FOR_A_THROWN_ERROR__`. This symbol unavoidably shows up in backtraces captured when `swift_willThrow` is called, so I gave it a name that (hopefully) clearly explains why it's there. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 770ff07 - Browse repository at this point
Copy the full SHA 770ff07View commit details
Commits on Sep 4, 2024
-
Do not include sysctl.h on Linux. (#660)
This PR ensures `<sys/sysctl.h>` is not included on Linux, where it generates compile-time diagnostics on distros/versions where it's still present. The diagnostic looks something like: ``` [5/5][100%][7.920s] Linking Swift shared library lib/libTesting.so <module-includes>:3:10: note: in file included from <module-includes>:3: 1 | #include "./Defines.h" 2 | #include "./Discovery.h" 3 | #include "./Includes.h" | `- note: in file included from <module-includes>:3: 4 | #include "./Stubs.h" 5 | #include "./TestSupport.h" /home/build-user/swift-testing/Sources/_TestingInternals/include/./Includes.h:61:10: note: in file included from /home/build-user/swift-testing/Sources/_TestingInternals/include/./Includes.h:61: 59 | 60 | #if __has_include(<sys/sysctl.h>) 61 | #include <sys/sysctl.h> | `- note: in file included from /home/build-user/swift-testing/Sources/_TestingInternals/include/./Includes.h:61: 62 | #endif 63 | ``` Since we don't use `sysctl()` on Linux (and it's been outright removed from the OS!), let's fix the diagnostic. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 263545b - Browse repository at this point
Copy the full SHA 263545bView commit details -
Add support for capturing backtraces from typed throws. (#642)
Swift 6 introduces the typed throws feature to replace `rethrows` and to support error handling in Embedded Swift. This feature uses an ABI that differs from the one used by untyped (traditional) `throws` and as such, our hook into the runtime (`_swift_willThrow`) is insufficient to provide backtrace information for errors thrown this way. This PR adds support for capturing said backtraces _if and only if_ the thrown error is of reference type. Such errors have stable addresses that we can track over time, whereas errors of value type will be copied when used with typed throws. ~~I'm also taking the opportunity to implement some performance enhancements to `Backtrace`. It shouldn't get called _very_ frequently, but it also should be fast!~~ This PR is dependent on #647. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 0ca9774 - Browse repository at this point
Copy the full SHA 0ca9774View commit details -
Optimize
failureBreakpoint()
. (#655)`failureBreakpoint()` currently has optimizations disabled which produces some significant assembly for what's supposed to be a no-op. Enabling optimizations and marking its magic value as `@exclusivity(unchecked)` reduces it to a single indirect store. This is probably not the hottest hot path in the library (since it will only be called when a test is failing) but the whole point of the function is to be a no-op, and without this change it's _quite_ noisy and includes a whole function call into the Swift runtime (see the `bl` instructions below.) ### arm64 #### Before ```asm _$s7Testing17failureBreakpointyyF: 0000000000000660 sub sp, sp, #0x30 0000000000000664 stp x29, x30, [sp, #0x20] 0000000000000668 add x29, sp, #0x20 000000000000066c adrp x8, 0 ; 0x0 0000000000000670 add x0, x8, #0x0 0000000000000674 add x1, sp, #0x8 0000000000000678 mov x2, #0x21 000000000000067c mov x3, #0x0 0000000000000680 bl 0x680 0000000000000684 mov x8, #0x1 0000000000000688 adrp x9, 0 ; 0x0 000000000000068c add x9, x9, #0x0 0000000000000690 str x8, [x9] 0000000000000694 add x0, sp, #0x8 0000000000000698 bl 0x698 000000000000069c ldp x29, x30, [sp, #0x20] 00000000000006a0 add sp, sp, #0x30 00000000000006a4 ret ``` #### After ```asm _$s7Testing17failureBreakpointyyF: 0000000000000660 adrp x8, 0 ; 0x0 0000000000000664 str xzr, [x8] 0000000000000668 ret ``` Note this disassembly comes from the intermediate .o file generated for the relevant source file, so addresses aren't available yet. Neither function actually attempts to write to 0x0. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 294544a - Browse repository at this point
Copy the full SHA 294544aView commit details -
Add an EditorConfig file (#600)
Add an EditorConfig (`.editorconfig`) file to this repo. ### Motivation: [EditorConfig](https://editorconfig.org) helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. It will be helpful to add one of these files to swift-testing so that all contributors use the whitespace conventions described in our [style guide](https://github.com/swiftlang/swift-testing/blob/main/Documentation/StyleGuide.md) automatically when using a supported IDE/editor. Note that Xcode 16 Beta has added support for EditorConfig files — see 20796230 in the [release notes](https://developer.apple.com/documentation/xcode-release-notes/xcode-16-release-notes). ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 5720222 - Browse repository at this point
Copy the full SHA 5720222View commit details -
Remove
#expect(throws: Never.self)
and `#require(throws: Never.self……)` as distinct overloads. (#661) `#expect(throws: Never.self)` and `#require(throws: Never.self)` do not need to be specified as separate overloads. This PR removes them as distinct symbols: - The documentation for `#expect(throws: Never.self)` is merged into the documentation for `#expect(throws:)`. - The diagnostic emitted when using `#require(throws: Never.self)` is lowered from a deprecation warning to a macro-generated custom warning. This change has no other compile-time or runtime effects: code that passes `Never.self` to either macro will continue to compile, and macros cannot be referenced so there is no risk of source-level breakage like there might be from a function signature change. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 9de9084 - Browse repository at this point
Copy the full SHA 9de9084View commit details
Commits on Sep 5, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 36da714 - Browse repository at this point
Copy the full SHA 36da714View commit details -
Configuration menu - View commit details
-
Copy full SHA for c1b072b - Browse repository at this point
Copy the full SHA c1b072bView commit details -
Replace rethrows with typed throws in Graph (#662)
This replaces usage of `rethrows` with [typed throws](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0413-typed-throws.md) in the internal-only `Graph` support type. ### Motivation: It's now [recommended](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0413-typed-throws.md#when-to-use-typed-throws) to use typed throws in generic code that never produces its own errors, but only passes through errors that come from callers. And adopting typed throws in more places will reduce barriers to eventually supporting Embedded Swift. ### Modifications: - Replace all usage of `rethrows` with the analogous typed throws declaration in `Graph`. ### Result: No behavioral/runtime change. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 20c4440 - Browse repository at this point
Copy the full SHA 20c4440View commit details -
Work around compiler regression causing CI failure. (#664)
This PR attempts to work around the compiler regression reported in rdar://135346598 that is currently causing our macOS CI jobs to fail. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 23619cc - Browse repository at this point
Copy the full SHA 23619ccView commit details -
Work around swiftinterface generation bug on Windows. (#663)
Works around the issue described in swiftlang/swift#76279. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 5f62e01 - Browse repository at this point
Copy the full SHA 5f62e01View commit details -
Work around the swiftinterface generation issue for Android too
This is a follow-up to 5f62e01, as the same issue also hits the Android build
Configuration menu - View commit details
-
Copy full SHA for 6caae62 - Browse repository at this point
Copy the full SHA 6caae62View commit details -
Merge pull request #665 from swiftlang/eng/android-workaround
Work around the swiftinterface generation issue for Android too
Configuration menu - View commit details
-
Copy full SHA for ca51589 - Browse repository at this point
Copy the full SHA ca51589View commit details
Commits on Sep 6, 2024
-
Don't use
Synchronization.Atomic
for `deliverExpectationCheckedEven……ts`. (#666) This PR replaces the new use of `Atomic<Int>` with a `Locked<Int>` in the implementation of `deliverExpectationCheckedEvents`. Why? Because we're running into some environments where the Synchronization module isn't available (e.g. older host macOSes) and this is simpler. The performance profile is comparable: on my system, running the `repeatedlyExpect()` test takes 0.55s instead of 0.49s to call `#expect()` 1,000,000 times, so it's still a significant win over the implementation we had earlier. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for 2e9df4f - Browse repository at this point
Copy the full SHA 2e9df4fView commit details -
Exit tests shouldn't emit crash logs. (#670)
When a process crashes, the platforms we support all write a crash log (or core, or error report) to disk. This is not necessary for exit test child processes (since we intentionally crash them.) This PR suppresses generation of those logs from within an exit test: - On Darwin, we disable the exception port for crash report files; - On Linux, we set the maximum core dump size to zero bytes; and - On Windows, we disable Windows Error Reporting. The above effects are only applied to the exit test's child process, not to the parent test process nor the system as a whole. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for c120149 - Browse repository at this point
Copy the full SHA c120149View commit details
Commits on Sep 8, 2024
-
CMake: Install
_TestingInternals
in static library buildsWhen building the Testing library as a static library (BUILD_SHARED_LIBS=FALSE), `_TestingInternals` was not being installed alongside the main library. This caused the missing symbol error when linking against the Testing library statically.
Configuration menu - View commit details
-
Copy full SHA for ed97c9c - Browse repository at this point
Copy the full SHA ed97c9cView commit details -
Configuration menu - View commit details
-
Copy full SHA for f078f7a - Browse repository at this point
Copy the full SHA f078f7aView commit details -
Fix a typo in a call of install path getter function name
This is a follow-up fix to f078f7a that I made at the last minute before merging...
Configuration menu - View commit details
-
Copy full SHA for 090e9c8 - Browse repository at this point
Copy the full SHA 090e9c8View commit details -
Do not include <sys/resource.h> on WASI
Including `sys/resource.h` from wasi-libc requires a feature macro to be defined (`-D_WASI_EMULATED_PROCESS_CLOCKS`) and emits compilation errors otherwise. However, the header is not used in WASI paths, so it is safe to exclude it from the list of includes. See `sys/times.h` that is transitively included by `sys/resource.h` https://github.com/WebAssembly/wasi-libc/blob/wasi-sdk-22/libc-top-half/musl/include/sys/times.h
Configuration menu - View commit details
-
Copy full SHA for 12a7ddf - Browse repository at this point
Copy the full SHA 12a7ddfView commit details -
Merge pull request #672 from kateinoigakukun/yt/fix-last-min-change
Fix a typo in a call of install path getter function name
Configuration menu - View commit details
-
Copy full SHA for e7a7e23 - Browse repository at this point
Copy the full SHA e7a7e23View commit details
Commits on Sep 9, 2024
-
Ask Foundation to capture
NSError
/CFError
backtraces for us. (#673)On Apple platforms, when an error occurs in an Objective-C method or C function, convention is to return the error as an instance of `NSError`/`CFError` via an out-parameter. When that Objective-C method or C function is called by a Swift function, the Swift function detects the error, then effectively rethrows it, at which point our `swift_willThrow` hook is triggered. This can obscure the real origin of the error which may be many stack frames down from the point Swift takes over. This PR asks Foundation, via a relatively new internal function, to capture backtraces for instances of `NSError` and `CFError` at the point they are created. Then, when Swift Testing attempts to look up the backtrace for an error it has caught, if Foundation has generated one, then Swift Testing can substitute it in place of the one it generated in the `swift_willThrow` hook. Resolves rdar://114386243. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for f6af3d8 - Browse repository at this point
Copy the full SHA f6af3d8View commit details
Commits on Sep 10, 2024
-
Expose the target triple as a separate string from the testing librar…
…y version. (#652) This PR adds a script to our CMake build to capture the target triple being used to build Swift Testing so that we can include it in our diagnostic output. Apple's fork of Swift Testing (as included with Xcode 16) also includes this information, and it is very useful to have when reviewing bug reports as it can tell us if a problem is specific to a given architecture or OS variant. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Configuration menu - View commit details
-
Copy full SHA for a0c8fc6 - Browse repository at this point
Copy the full SHA a0c8fc6View commit details
There are no files selected for viewing
This file was deleted.
This file was deleted.