Skip to content
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

Dependencies: dynamically link XCTest #169

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

compnerd
Copy link
Contributor

Use delayed dynamic linking for registering the test observer. This is particularly important for Windows which does not support weak linking and weak symbols. Even in the case that Dependencies is imported due to use, we will not pull in the test observer until runtime, as a best effort. If the DependenciesTestObserver library is found in the search path, it will be loaded and the observer initialised. If we can't find the library, we will simply continue without the test observer.

@compnerd
Copy link
Contributor Author

Interesting, the tests pass with --parallel, but fail without. Am I mixing up some state?

@compnerd compnerd force-pushed the dynamic branch 2 times, most recently from b252523 to a0c625b Compare January 17, 2024 20:55
@compnerd
Copy link
Contributor Author

Okay, preserving the existing behaviour on Darwin seems reasonable - the difference is the ObjC runtime is hooked dynamically already. The isolated library approach applies to non-ObjC runtimes (Linux, Windows). This I think might be down to 2 failures on Linux (which seem like a bug in the test case).

@compnerd compnerd force-pushed the dynamic branch 2 times, most recently from 0a7b61e to 3508642 Compare January 17, 2024 23:48
@compnerd
Copy link
Contributor Author

Taking a different approach to isolate the XCTest dependency, but without the SPI so conceptually simpler but with more indirection. I think that this is a better shape overall. Seems to pass on Linux and macOS.

@compnerd
Copy link
Contributor Author

Ah, right, WASI does not yet do dynamic modules. What do you recommend here @stephencelis?

@stephencelis
Copy link
Member

@compnerd I haven't dug in too deeply, but can we fall back to explicit importing in this case?

@compnerd
Copy link
Contributor Author

Okay, sure, I can make that change for WASI.

Use delayed dynamic linking for registering the test observer. This is
particularly important for Windows which does not support weak linking
and weak symbols. Even in the case that `Dependencies` is imported due
to use, we will not pull in the test observer until runtime, as a best
effort. If the DependenciesTestObserver library is found in the search
path, it will be loaded and the observer initialised. If we can't find
the library, we will simply continue without the test observer.
Copy link
Member

@stephencelis stephencelis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@stephencelis stephencelis merged commit 4ce7fd2 into pointfreeco:main Jan 22, 2024
8 checks passed
@compnerd compnerd deleted the dynamic branch January 22, 2024 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants