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

Fix a failing time-sensitive test. #190

Merged
merged 1 commit into from
Jan 18, 2024

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Jan 18, 2024

One of the tests for our .timeLimit() trait uses Clock.measure {} to determine how long it takes to execute, but that's unsafe because it will include time spent waiting for the Swift runtime and the OS to schedule the child task in which the test runs. That time may be significant when tests are running in parallel.

This PR modifies that test to explicitly measure the start of the test when the test function is entered and the end of the test when the local test run completes. This avoids accidentally measuring any initial wait time.

Checklist:

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

One of the tests for our `.timeLimit()` trait uses `Clock.measure {}` to determine how long it takes to execute, but that's unsafe because it will include time spent waiting for the Swift runtime and the OS to schedule the child task in which the test runs. That time may be significant when tests are running in parallel.

This PR modifies that test to explicitly measure the start of the test when the test function is entered and the end of the test when the local test run completes. This avoids accidentally measuring any initial wait time.
@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan
Copy link
Contributor Author

CI shows the test passing now.

Remaining failure on Linux is fixed by swiftlang/swift-package-manager#7273.
Remaining failure on macOS is fixed by swiftlang/swift-package-manager#7267.

@grynspan grynspan merged commit 74de1e0 into main Jan 18, 2024
@grynspan grynspan deleted the jgrynspan/fix-failing-time-limit-test branch January 18, 2024 21:35
@grynspan grynspan self-assigned this Jan 31, 2024
@grynspan grynspan added bug 🪲 Something isn't working concurrency Swift concurrency/sendability issues labels Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working concurrency Swift concurrency/sendability issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants