Skip to content

Tests: Convert Swift tests to use Testing module where possible #1202

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

Merged
merged 3 commits into from
Aug 29, 2024

Conversation

ADKaster
Copy link
Member

@ADKaster ADKaster commented Aug 27, 2024

Add the upcoming standard swift-testing library as a dependency.

In theory, this library will be included in the swift toolchain. Until that plan is finalized and stabilized for both Linux and macOS, pull it from GitHub using FetchContent.

The Testing.framework shipped with Xcode 16 Beta 5 links against libraries in /usr/lib/swift that only exist in the Developer/ and toolchain sections of the Xcode app, and not on my macOS installation. It also doesn't seem to be added to the rpath of our applications, as it lives in the Xcode Developer directories instead of in the system path. As such, we'll keep building it for macOS from source until the swift-testing maintainers come up with a good way to use the library from CMake, as the current focus is the Swift Package Manager.

The Xcode-shipped Testing.framework can be used if the developer sets USE_XCODE_TESTING_LIBRARY to ON in FindSwiftTesting.cmake and calls our test module like so:

env DYLD_FALLBACK_FRAMEWORK_PATH="/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks" \
DYLD_LIBRARY_PATH="/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib" \
./Build/ladybird/bin/TestLibWebSwift.swift-testing

@ADKaster ADKaster force-pushed the swift-testing-see-make branch 2 times, most recently from a27f4b7 to 3d5b920 Compare August 27, 2024 23:31
@ADKaster ADKaster marked this pull request as ready for review August 28, 2024 00:14
Instead of using a global setting, let's set this per-target. This
prevents conflicts when importing third-party dependencies that do
not tolerate the mode being "default".
@ADKaster ADKaster force-pushed the swift-testing-see-make branch from 3d5b920 to 331ba4c Compare August 29, 2024 02:24
This project is a part of the Xcode-shipped toolchain on macOS, but
needs built from source on other platforms. However, using the Xcode
version of the framework leads to a bunch of rpath confusion when
trying to link it the expected way. I suspect that there will be a
more intuitive way to link this library from the toolchain when it
stabilizes. So we'll build it everywhere :)
The AK tests can't seem to use it because it crashes the frontend :)
@ADKaster ADKaster force-pushed the swift-testing-see-make branch from 331ba4c to 0d82314 Compare August 29, 2024 02:25
@ADKaster ADKaster merged commit 7829266 into LadybirdBrowser:master Aug 29, 2024
6 checks passed
@ADKaster ADKaster deleted the swift-testing-see-make branch August 29, 2024 03:27
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.

1 participant