Skip to content

Split SWT_NO_EXIT_TESTS into SWT_NO_EXIT_TESTS and SWT_NO_PROCESS_SPAWNING. #769

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Oct 17, 2024

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Oct 17, 2024

This PR separates out our process-spawning code to be guarded by SWT_NO_PROCESS_SPAWNING instead of SWT_NO_EXIT_TESTS. We do this so that we can potentially use process spawning on platforms where exit tests are not supported for some other reason (such as the iOS/Android sandboxes) but process spawning is still internally possible.

There are a few use cases we have for spawning processes that don't involve exit tests:

I took the opportunity to clean up WaitFor.swift a bit and rearrange code so that the "new platform, dunno who lives here" case should compile (although not function) out-of-the-box.

Checklist:

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

Verified

This commit was signed with the committer’s verified signature.
prusnak Pavol Rusnak
…S_SPAWNING`.

This PR separates out our process-spawning code to be guarded by
`SWT_NO_PROCESS_SPAWNING` instead of `SWT_NO_EXIT_TESTS`. We do this so that we
can potentially use process spawning on platforms where exit tests are not
supported for some other reason (such as the iOS/Android sandboxes) but process
spawning is still internally possible.

There are a few use cases we have for spawning processes that don't involve exit
tests:

- Calling out to `tar` to compress attachments (see #714)
- Running non-Swift scripts in their interpreters (see #478)
- Multi-process parallelism (the XCTest model)

I took the opportunity to clean up WaitFor.swift a bit and rearrange code so
that the "new platform, dunno who lives here" case should compile (although not
function) out-of-the-box.
@grynspan grynspan added enhancement New feature or request exit-tests ☠️ Work related to exit tests attachments/activities 🖇️ Work related to attachments and/or activities labels Oct 17, 2024
@grynspan grynspan self-assigned this Oct 17, 2024
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan grynspan added this to the Swift 6.1 milestone Oct 17, 2024
@grynspan grynspan merged commit 907b2ce into main Oct 17, 2024
3 checks passed
@grynspan grynspan deleted the jgrynspan/split-SWT_NO_EXIT_TESTS branch October 17, 2024 18:37
grynspan added a commit that referenced this pull request Oct 18, 2024
This PR was supposed to be part of #769, but I must have blown away a local
commit because it didn't make it into that PR.

This PR updates Porting.md to explain when a developer might encounter an error
due to mismatched `SWT_` conditions. It ensures that exit tests require process
spawning to be enabled/implemented by adding a dependency between
`SWT_NO_PROCESS_SPAWNING` and `SWT_NO_EXIT_TESTS`.

This PR also tweaks which bits of `ExitTest` are exposed on platforms that do
not support exit tests at all. The type needs to be exposed so that
`ExitTest.Result` is exposed so that we can correctly expose
`#expect(exitsWith:)` and `#require(exitsWith:)` while marking them unavailable,
as opposed to hiding the macros and not giving a developer clear diagnostics.
grynspan added a commit that referenced this pull request Oct 18, 2024
…s. (#772)

This PR was supposed to be part of #769, but I must have blown away a
local commit because it didn't make it into that PR.

This PR updates Porting.md to explain when a developer might encounter
an error due to mismatched `SWT_` conditions. It ensures that exit tests
require process spawning to be enabled/implemented by adding a
dependency between `SWT_NO_PROCESS_SPAWNING` and `SWT_NO_EXIT_TESTS`.

This PR also tweaks which bits of `ExitTest` are exposed on platforms
that do not support exit tests at all. The type needs to be exposed so
that `ExitTest.Result` is exposed so that we can correctly expose
`#expect(exitsWith:)` and `#require(exitsWith:)` while marking them
unavailable, as opposed to hiding the macros and not giving a developer
clear diagnostics.

### Checklist:

- [ ] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [ ] If public symbols are renamed or modified, DocC references should
be updated.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
attachments/activities 🖇️ Work related to attachments and/or activities 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.

2 participants