Skip to content

[WIP, DNM] Enable exit tests on Android API level 28 and newer.#1381

Draft
grynspan wants to merge 34 commits intomainfrom
jgrynspan/exit-tests-android
Draft

[WIP, DNM] Enable exit tests on Android API level 28 and newer.#1381
grynspan wants to merge 34 commits intomainfrom
jgrynspan/exit-tests-android

Conversation

@grynspan
Copy link
Copy Markdown
Contributor

@grynspan grynspan commented Oct 27, 2025

This PR enables exit tests on Android.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

@grynspan grynspan added this to the Swift 6.x (main) milestone Oct 27, 2025
@grynspan grynspan added enhancement New feature or request exit-tests ☠️ Work related to exit tests android 🤖 Android support labels Oct 27, 2025
Comment thread Sources/Testing/ExitTests/SpawnProcess.swift Outdated
@finagolfin
Copy link
Copy Markdown
Member

Thanks, Jonathan, will try it and let you know. 👍

@finagolfin
Copy link
Copy Markdown
Member

finagolfin commented Oct 30, 2025

Seeing a couple build errors because of @available attributes:

/data/data/com.termux/files/home/swift-testing/Sources/Testing/ExitTests/WaitFor.swift:84:58: �[1;31merror: �[1;39m'ExitStatus' is only available in Android 28 or newer�[0;0m
 �[0;36m81 |�[0;0m #elseif SWT_TARGET_OS_APPLE || os(Linux) || os(FreeBSD) || os(OpenBSD) || os(Android)
 �[0;36m82 |�[0;0m /// A mapping of awaited child PIDs to their corresponding Swift continuations.
 �[0;36m83 |�[0;0m private nonisolated(unsafe) let _childProcessContinuations = {
    �[0;36m|�[0;0m                                 `- �[1;39mnote: �[1;39madd '@available' attribute to enclosing let�[0;0m
 �[0;36m84 |�[0;0m   let result = ManagedBuffer<[pid_t: CheckedContinuation<ExitStatus, any Error>], pthread_mutex_t>.create(
    �[0;36m|�[0;0m                                                          |- �[1;31merror: �[1;39m'ExitStatus' is only available in Android 28 or newer�[0;0m
    �[0;36m|�[0;0m                                                          `- �[1;39mnote: �[1;39madd 'if #available' version check�[0;0m
 �[0;36m85 |�[0;0m     minimumCapacity: 1,
 �[0;36m86 |�[0;0m     makingHeaderWith: { _ in [:] }

/data/data/com.termux/files/home/swift-testing/Sources/Testing/ExitTests/WaitFor.swift:106:68: �[1;31merror: �[1;39m'ExitStatus' is only available in Android 28 or newer�[0;0m
�[0;36m102 |�[0;0m ///
�[0;36m103 |�[0;0m /// - Throws: Whatever is thrown by `body`.
�[0;36m104 |�[0;0m private func _withLockedChildProcessContinuations<R>(
    �[0;36m|�[0;0m              `- �[1;39mnote: �[1;39madd '@available' attribute to enclosing global function�[0;0m
�[0;36m105 |�[0;0m   _ body: (
�[0;36m106 |�[0;0m     _ childProcessContinuations: inout [pid_t: CheckedContinuation<ExitStatus, any Error>],
    �[0;36m|�[0;0m                                                                    `- �[1;31merror: �[1;39m'ExitStatus' is only available in Android 28 or newer�[0;0m
�[0;36m107 |�[0;0m     _ lock: UnsafeMutablePointer<pthread_mutex_t>
�[0;36m108 |�[0;0m   ) throws -> R

Not going to spend time fixing this given the bigger SwiftPM issue, but if you want to keep iterating, happy to build it locally for you.

@grynspan
Copy link
Copy Markdown
Contributor Author

Thanks, I'll address those and ping you when it's ready to try again.

@grynspan
Copy link
Copy Markdown
Contributor Author

grynspan commented Nov 6, 2025

sig_t is not a portable spelling, need a custom typedef.

@grynspan
Copy link
Copy Markdown
Contributor Author

@finagolfin I believe I've got all the availability annotations in place now.

Comment thread Package.swift Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

android 🤖 Android support enhancement New feature or request exit-tests ☠️ Work related to exit tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants