-
Notifications
You must be signed in to change notification settings - Fork 146
Reimplement _TestingInterop in C++.
#1622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
grynspan
wants to merge
17
commits into
main
Choose a base branch
from
jgrynspan/just-do-interop-in-c++
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
80908ea
Reimplement `_TestingInterop` in C++.
grynspan 3c78ef1
Fix typo sigh
grynspan 7149e06
Intentionally empty header file so git includes the empty includes di…
grynspan ad7d564
Merge branch 'main' into jgrynspan/just-do-interop-in-c++
grynspan 16680d7
Fixup headers a bit
grynspan 85b841a
sendability annotations
grynspan 6ea9d57
Fix CMake module name
grynspan feae920
Import module explicitly
grynspan 06904d7
Revert "Import module explicitly"
grynspan 1da1682
Move header to interop target, symlink it from internals
grynspan 6b29b65
Revert "Move header to interop target, symlink it from internals"
grynspan 8d8015e
Try explicitly exporting the C++ module by name?
grynspan 74ab29f
Try explicitly disabling C++ modules?
grynspan 59ae167
Update CMake
grynspan dd7d9c4
Merge branch 'main' into jgrynspan/just-do-interop-in-c++
grynspan f9d450b
Break up _swift_testing_install_target()
grynspan bfae5b2
Remove autolink flag
grynspan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| // | ||
| // This source file is part of the Swift.org open source project | ||
| // | ||
| // Copyright (c) 2026 Apple Inc. and the Swift project authors | ||
| // Licensed under Apache License v2.0 with Runtime Library Exception | ||
| // | ||
| // See https://swift.org/LICENSE.txt for license information | ||
| // See https://swift.org/CONTRIBUTORS.txt for Swift project authors | ||
| // | ||
|
|
||
| #if !defined(SWT_NO_INTEROP) | ||
| #include "Defines.h" | ||
| #include "Includes.h" | ||
|
|
||
| SWT_ASSUME_NONNULL_BEGIN | ||
|
|
||
| /// A type describing a fallback event handler that testing API can invoke as an | ||
| /// alternate method of reporting test events to the current test runner. | ||
| /// Shadows the type with the same name in _TestingInterop. | ||
| /// | ||
| /// - Parameters: | ||
| /// - recordJSONSchemaVersionNumber: The JSON schema version used to encode | ||
| /// the event record. | ||
| /// - recordJSONBaseAddress: A pointer to the first byte of the encoded event. | ||
| /// - recordJSONByteCount: The size of the encoded event in bytes. | ||
| /// - reserved: Reserved for future use. | ||
| typedef void (* SWTFallbackEventHandler)(const char *recordJSONSchemaVersionNumber, | ||
| const void *recordJSONBaseAddress, | ||
| size_t recordJSONByteCount, | ||
| const void *_Nullable reserved); | ||
|
|
||
| /// Set the current fallback event handler if one has not already been set. | ||
| /// | ||
| /// - Parameters: | ||
| /// - handler: The handler function to set. | ||
| /// | ||
| /// - Returns: Whether or not `handler` was installed. | ||
| /// | ||
| /// The fallback event handler can only be installed once per process, typically | ||
| /// by the first testing library to run. If this function has already been | ||
| /// called and the handler set, it does not replace the previous handler. | ||
| SWT_EXTERN bool _swift_testing_installFallbackEventHandler(SWTFallbackEventHandler handler); | ||
|
|
||
| /// Get the current fallback event handler. | ||
| /// Shadows the function with the same name in _TestingInterop. | ||
| /// | ||
| /// - Returns: The currently-set handler function, if any. | ||
| SWT_EXTERN SWTFallbackEventHandler _Nullable _swift_testing_getFallbackEventHandler(void); | ||
|
|
||
| SWT_ASSUME_NONNULL_END | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // | ||
| // This source file is part of the Swift.org open source project | ||
| // | ||
| // Copyright (c) 2025–2026 Apple Inc. and the Swift project authors | ||
| // Licensed under Apache License v2.0 with Runtime Library Exception | ||
| // | ||
| // See https://swift.org/LICENSE.txt for license information | ||
| // See https://swift.org/CONTRIBUTORS.txt for Swift project authors | ||
| // | ||
|
|
||
| #if !defined(SWT_NO_INTEROP) | ||
| #include "../_TestingInternals/include/FallbackEventHandler.h" | ||
|
|
||
| #include <atomic> | ||
|
|
||
| /// Storage for the fallback event handler. | ||
| static std::atomic<SWTFallbackEventHandler> fallbackEventHandler { nullptr }; | ||
|
|
||
| bool _swift_testing_installFallbackEventHandler(SWTFallbackEventHandler handler) { | ||
| SWTFallbackEventHandler nullptrValue = nullptr; | ||
| return fallbackEventHandler.compare_exchange_strong(nullptrValue, handler, std::memory_order_seq_cst, std::memory_order_relaxed); | ||
| } | ||
|
|
||
| SWTFallbackEventHandler _swift_testing_getFallbackEventHandler(void) { | ||
| return fallbackEventHandler.load(std::memory_order_seq_cst); | ||
| } | ||
| #endif |
This file was deleted.
Oops, something went wrong.
|
grynspan marked this conversation as resolved.
Outdated
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.