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] Enable more code and tests #871

Merged
merged 2 commits into from
Sep 17, 2024
Merged

Conversation

finagolfin
Copy link
Member

while disabling setting extended file attributes and a test creating a hard link, features not normally allowed on Android.

This got all the tests passing natively on Android 13 AArch64.

@hyp and @compnerd, try it out yourself and please review.

@@ -173,7 +173,7 @@ struct TimeZoneCache : Sendable {
}
}

#if os(Linux) && !os(WASI)
#if os(Linux)
Copy link
Member Author

Choose a reason for hiding this comment

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

@kateinoigakukun, I assume the os can't be both Linux and WASI?

Copy link
Member

Choose a reason for hiding this comment

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

Right, just a os(Linux) should be enough.

@finagolfin
Copy link
Member Author

Updated to allow reading from zero-sized system files on Android too and imported the Android overlay in a test file that now needs it and rebased, tested with the Sep. 4 trunk source snapshot natively on Android without a problem. I was hoping to get confirmation from TBC guys, who are preparing their own Android SDK, but no word from them for the last month on this pull, so might as well move ahead.

@parkera, just need someone to review and get this in, then I'd like to get this into release/6.0 next. Should be perfectly safe as this only affects Android, touches no code on any other platform.

@parkera
Copy link
Contributor

parkera commented Sep 12, 2024

@swift-ci test

@parkera parkera requested a review from jmschonfeld September 12, 2024 15:39
@@ -23,6 +23,10 @@ import TestSupport
@testable import Foundation
#endif

#if canImport(Android)
import Android
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious why we need this import here.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the compilation error I get without it:

Tests/FoundationEssentialsTests/FileManager/FileManagerTests.swift:622:15: error: cannot find 'getuid' in scope
620 |     func testFileAccessAtPath() throws {
621 |         #if !os(Windows)
622 |         guard getuid() != 0 else {
    |               `- error: cannot find 'getuid' in scope

There are some strange issues with these platform overlays, which I investigated a bit last month. Since nobody I asked seems to have a good idea of what's going on, I chalked it up to some Swift module leak that can be fixed later and am just adding these imports now to shut the compiler up.

Copy link
Contributor

@parkera parkera left a comment

Choose a reason for hiding this comment

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

Seems fine to me, but would like a second opinion from @jmschonfeld

Copy link
Contributor

@jmschonfeld jmschonfeld left a comment

Choose a reason for hiding this comment

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

Overall LGTM, but a few small comments

while disabling setting extended file attributes and a test creating a hard link,
features not normally allowed on Android.
@finagolfin
Copy link
Member Author

Addressed all review feedback and updated, one last CI run and this can go in.

@jmschonfeld
Copy link
Contributor

@swift-ci please test

@finagolfin
Copy link
Member Author

Passed CI, ready for merge. I will submit for 6.0 next.

@jmschonfeld jmschonfeld merged commit 53ffff0 into swiftlang:main Sep 17, 2024
3 checks passed
@finagolfin finagolfin deleted the droid branch September 17, 2024 16:47
finagolfin added a commit to finagolfin/swift-foundation that referenced this pull request Sep 18, 2024
* [Android] Enable more code and tests

while disabling setting extended file attributes and a test creating a hard link,
features not normally allowed on Android.

* Remove incorrect WASI check
parkera pushed a commit that referenced this pull request Oct 2, 2024
* [Android] Enable more code and tests

while disabling setting extended file attributes and a test creating a hard link,
features not normally allowed on Android.

* Remove incorrect WASI check
cthielen pushed a commit to cthielen/swift-foundation that referenced this pull request Nov 8, 2024
* [Android] Enable more code and tests

while disabling setting extended file attributes and a test creating a hard link,
features not normally allowed on Android.

* Remove incorrect WASI check
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.

4 participants