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

[android] build and run SPM-based tests on x64 #230

Open
weliveindetail opened this issue Jan 20, 2025 · 2 comments
Open

[android] build and run SPM-based tests on x64 #230

weliveindetail opened this issue Jan 20, 2025 · 2 comments

Comments

@weliveindetail
Copy link
Collaborator

weliveindetail commented Jan 20, 2025

The Swift SDK contains components that are built with the Swift Package Manager, e.g. swift-corelibs-foundation

Tests in swift-corelibs-foundation are implemented in Swift, so we have to make the Swift Runtime available on the emulator (similar for LIT-based tests). Tests are executed either via swift test or xcodebuild and there is integrated support for running them in the Apple simulators. It doesn't look like we can use that for Android.

swift build seems to support cross-compilation of tests which produces "a test runner executable with the .xctest extension" as of this description:
https://github.com/finagolfin/swift-android-sdk/blob/486e8be7bae6ea9100511af668464f2047f7b016/README.md#cross-compiling-and-testing-swift-packages-with-the-android-sdk-bundle

This CI configuration looks promising that we can automate it with a combination of adb and termux (which just for reference has a Swift package):
https://github.com/finagolfin/swift-android-sdk/blob/6.0.3/.github/workflows/sdks.yml#L448

We have no cross-platform support for testing SPM-based projects in build.ps1 yet.

@weliveindetail
Copy link
Collaborator Author

The XCTest driver for swift-corelibs-foundation tests on native Windows depends on:

swiftWinSDK.dll
swiftCore.dll
swift_Concurrency.dll
swift_StringProcessing.dll
swiftCRT.dll
Foundation.dll
swiftDispatch.dll
BlocksRuntime.dll
XCTest.dll
swiftRegexBuilder.dll
Testing.dll

@finagolfin
Copy link

This may be the easiest way to get Swift code tested in the Android emulator, as you see my Android CI doing. Note that I only use Termux on my Android CI because of some permissions issue with running the NIO tests, so I run it under an Android app's permissions instead. I just used the Termux app for that because I was familiar with it and it has OSS builds: any Android app would've worked.

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

No branches or pull requests

2 participants