Skip to content

Add testing for swift-corelibs-foundation-android-test repo #170

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

Conversation

marcprux
Copy link
Contributor

This PR adds testing for the https://github.com/marcprux/swift-corelibs-foundation-android-test.git repository, which is a fork of https://github.com/apple/swift-corelibs-foundation.git that builds only the Tests/ part of the package and adapts a number of Foundation tests to accommodate Android. A number of tests are disabled (mostly some daylight savings and Process forking tests), but most pass on the Android emulator.

Having this baseline of tests that pass for swift-corelibs-foundation will be useful to see what breaks (or is fixed) when swift-foundation is added to the mix.

Note that this PR relies on the additional Termux libraries added in #167, since those are required to run the XMLParser and URLSession tests.

@marcprux marcprux marked this pull request as draft September 14, 2024 22:20
@finagolfin
Copy link
Owner

I am currently in the process of updating the CI to cross-compile the latest snapshot tags of the SDK, including the two updated foundation repos for Android. So far it works well for trunk 6.1, going to try 6.0 next.

I had not thought of building and running the foundation tests too, but you are right that since these are structured as Swift packages now, it should be possible to cross-compile the foundation test runners too.

Hold off for a bit till I get that in: it may be easier to use those patches to build these tests, as I use patches like swiftlang/swift-foundation#871 natively on Android AArch64 to get almost all the tests passing.

Also, I see a strange TLS issue when building this test runner natively, that required some workarounds to get all the tests running and get their output.

@marcprux
Copy link
Contributor Author

I am currently in the process of updating the CI to cross-compile the latest snapshot tags of the SDK, including the two updated foundation repos for Android. So far it works well for trunk 6.1, going to try 6.0 next.

Great! Is this pushed to a branch somewhere? Let me know if there is anything I can do to help … I'm very eager to get going with Swift 6 and swift-foundation.

Hold off for a bit till I get that in: it may be easier to use those patches to build these tests, as I use patches like apple/swift-foundation#871 natively on Android AArch64 to get almost all the tests passing.

Will do. I'll leave this as a draft PR for the time being, but feel free to close it and I'll open a new one later if you think that would be better.

Also, I see a strange TLS issue when building this test runner natively, that required some workarounds to get all the tests running and get their output.

Do you mean a TLS issue with URLSession and HTTPS URLs on Android? If so, you may be interested in this: https://gist.github.com/marcprux/34dd8da76ea56dca719b47b4b0072b98

@finagolfin
Copy link
Owner

Great! Is this pushed to a branch somewhere?

No, still cleaning up and extracting my local patches.

Let me know if there is anything I can do to help … I'm very eager to get going with Swift 6 and swift-foundation.

OK, I will get that up by tomorrow, so we can iterate on it independently from then on.

Will do. I'll leave this as a draft PR for the time being

Sounds good.

Do you mean a TLS issue with URLSession and HTTPS URLs on Android?

No, I mean Thread-Local Storage, which I now see the Swift stdlib just added for the first time this summer on linux platforms. This caused no problems for me before because it was always invoked from the shared library libFoundation.so, but after the re-core on swift-foundation, SwiftPM builds the swift-corelibs-foundation test runner without dynamic linking of the Foundation libraries like libFoundation.so, ie statically linking those object files instead, which then causes problems because Android didn't support native TLS till API 29, whereas I'm building for API 24.

I'm not sure exactly why it causes problems for executables alone- haven't dug into it- but it doesn't appear to be using the emulated TLS talked about there. Could be a simple mis-configuration on my end, will need to look into it.

@finagolfin
Copy link
Owner

I'm still sorting through the Android patches for Swift 6, should have that up tonight.

@finagolfin
Copy link
Owner

Unless you really care about checking the APIs in swift-corelibs-foundation, it may be better to change this to testing swift-foundation alone for now, at least until we get the TLS issue figured out, as bumping the emulator API level doesn't help with this repo. The official CI runs the tests for both repos separately, which we can try once the TLS issue is resolved.

@marcprux
Copy link
Contributor Author

marcprux commented Oct 7, 2024

The last time I looked, the swift-foundation tests didn't have as much coverage as swift-corelibs-foundation, but it seems like they have been expanded considerably. I'll take a look at them. Thanks!

@marcprux
Copy link
Contributor Author

I don't think we need this. Closing.

@marcprux marcprux closed this Dec 12, 2024
@finagolfin
Copy link
Owner

I'll try to get this in once we have the emulated TLS fix.

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.

2 participants