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

Asorted tests improvements #17840

Merged
merged 21 commits into from
Oct 15, 2024
Merged

Asorted tests improvements #17840

merged 21 commits into from
Oct 15, 2024

Conversation

majocha
Copy link
Contributor

@majocha majocha commented Oct 7, 2024

Cherrypicked from #17662.

  • replace or remove some of the flakiest hardcoded timeouts
  • make sure there are no background tasks started with Async.Start etc. and not observed / awaited. They will escape the confinement of currently running test case and if they throw, they bring down the whole test host
  • Enabled a few regression tests that were disabled for years because of trivial exit 0 in the code
  • named test runs in CI to make test summary easier to use
  • added some rudimentary tests for Mailbox.TryScan because we had none outside of the core\controlMailbox script.

Copy link
Contributor

github-actions bot commented Oct 7, 2024

✅ No release notes required

@majocha majocha marked this pull request as ready for review October 7, 2024 13:16
@majocha majocha requested a review from a team as a code owner October 7, 2024 13:16
@majocha
Copy link
Contributor Author

majocha commented Oct 7, 2024

Another one:
https://dev.azure.com/dnceng-public/public/_build/results?buildId=829273&view=logs&j=966a6946-91f0-5397-81f4-d998467880f9&t=344839a9-08c6-5829-65fb-26f32c5a016f&l=5086

 Failed EmittedIL.TryCatch.Stackoverflow reproduction(compilation: StackOverflowRepro.fs) [30 s]
  Error Message:
   System.TimeoutException : Timeout executing command 'dotnet' 'D:\a\_work\1\s\artifacts\bin\FSharp.Compiler.ComponentTests\Release\net9.0\tests\EmittedIL\TryCatch\Stackoverflow_reproduction\StackOverflowRepro.exe'

This comes down to the timeout here being too tight for the CI occasionally:

let timeout = 30000
let exitCode, output, errors = Commands.executeProcess (Some fileName) arguments (Path.GetDirectoryName(outputFilePath)) timeout

Maybe it would make sense to get rid of such hardcoded timeouts altogether. In the IDE it's obvious when a test hangs and in the CI we can just use --blame-hang-timeout.

@majocha
Copy link
Contributor Author

majocha commented Oct 8, 2024

I used CancellationTokenSource to cancel MailboxProcessors on test end. Turns out Mailbox uses quite different code paths with and without cancellation, #17849, so this is not acceptable.

Copy link
Member

@psfinaki psfinaki left a comment

Choose a reason for hiding this comment

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

Thanks for applying proper testing practices, @majocha. This is a really solid effort. I have also learned some multithreading stuff from this :)

@psfinaki psfinaki merged commit 7ebe5c5 into dotnet:main Oct 15, 2024
32 checks passed
@majocha
Copy link
Contributor Author

majocha commented Oct 15, 2024

Thanks for applying proper testing practices, @majocha. This is a really solid effort. I have also learned some multithreading stuff from this :)

They're still not perfect. Using just sync primitives often obfuscates the code. Now I think some sort of simulated time, Rx style, would make the code more clear. But at the cost of making the tests depend on yet another thing.

@psfinaki
Copy link
Member

Well - we're leaving the playground in the better shape we've found it 👀

@Martin521
Copy link
Contributor

Great improvement indeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants