Skip to content

Conversation

@mhrawdon
Copy link
Contributor

We can do this now that Swift Testing support attachments.

Also give callers of checkBuild() the opportunity to opt out of adding these attachments, and have BuildTaskBehaviorTests.stressConcurrentCancellation() do so, as its particular nature can sometimes crash the tests when adding attachments.

…test at the end of BuildOperationTester.checkBuild().

We can do this now that Swift Testing support attachments.

Also give callers of checkBuild() the opportunity to opt out of adding these attachments, and have BuildTaskBehaviorTests.stressConcurrentCancellation() do so, as its particular nature can sometimes crash the tests when adding attachments.
@mhrawdon
Copy link
Contributor Author

@swift-ci test

let startBuilds = WaitCondition()
let buildsDone = WaitCondition()

// The threads this test spawns to run the build can outlive the lifetime of the test itself, so it passed attachBuildArifacts = false since if that happens then the test might crash because the reporter needed to add the attachments will no longer exist.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Whoa, that seems bad, nothing should outlive the test itself. I'm actually quite surprised this is here.

Can you make an array of Task<Void, Never> just before the for loop, and then append the Task handles to that array as you go? Then after the for loop, iterate the array and await the value of each of the tasks. That should guarantee we never have dangling work past the end of the test.

Copy link
Contributor Author

@mhrawdon mhrawdon Dec 12, 2025

Choose a reason for hiding this comment

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

I've already spent a couple of hours trying to fix up this test, and I'm not going to mess with it further as part of this PR. I suggest opening a new Issue for someone who is deeply familiar with it to investigate. I was able to reproduce it most of the time by running the whole BuildSystemTests suite inside of Xcode (removing the change to cause it to not add attachments, of course).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fair enough. Good that it's easy to reproduce.

let startBuilds = WaitCondition()
let buildsDone = WaitCondition()

// The threads this test spawns to run the build can outlive the lifetime of the test itself, so it passed attachBuildArifacts = false since if that happens then the test might crash because the reporter needed to add the attachments will no longer exist.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Fair enough. Good that it's easy to reproduce.

@mhrawdon mhrawdon merged commit 4e772a8 into swiftlang:main Dec 13, 2025
91 of 95 checks passed
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