The feature tests fail in CI often #11696

Closed
opened 2026-01-31 02:55:03 +00:00 by claunia · 3 comments
Owner

Originally created by @zadjii-msft on GitHub (Dec 4, 2020).

Hey maybe we should have an issue tracking this, because it's kinda getting worse.

Builds with this issue:

  • 124997 FileTests::TestWriteFileWrapEOL#metadataSet0 [Failed]
  • 126069: FileTests::TestWriteFileDisableNewlineAutoReturn#metadataSet1 [Failed]
  • 126880 FileTests::TestWriteFileRaw [Failed] and FileTests::TestWriteFileProcessed [Failed]
    • Error: Verify: Win32BoolSucceeded(GetConsoleScreenBufferInfoEx(
    • Error: Verify: Win32BoolSucceeded(GetConsoleScreenBufferInfoEx(

Feels free to add more as they come. Maybe just disable all of them?

Originally created by @zadjii-msft on GitHub (Dec 4, 2020). Hey maybe we should have an issue tracking this, because it's kinda getting worse. Builds with this issue: * [124997](https://dev.azure.com/ms/terminal/_build/results?buildId=124997&view=logs&j=fe5d217b-357f-5a83-11fa-ea15ba02c406&t=94a67b48-79ec-5be5-f887-ae3875b74c8b&l=20057) `FileTests::TestWriteFileWrapEOL#metadataSet0 [Failed]` * [126069](https://dev.azure.com/ms/20953fb4-d427-4ad6-b78c-13142d0c5462/_build/results?buildId=126069): ` FileTests::TestWriteFileDisableNewlineAutoReturn#metadataSet1 [Failed]` * [126880](https://dev.azure.com/ms/terminal/_build/results?buildId=126880&view=logs&j=fe5d217b-357f-5a83-11fa-ea15ba02c406&t=94a67b48-79ec-5be5-f887-ae3875b74c8b) `FileTests::TestWriteFileRaw [Failed]` and `FileTests::TestWriteFileProcessed [Failed]` - `Error: Verify: Win32BoolSucceeded(GetConsoleScreenBufferInfoEx(` - `Error: Verify: Win32BoolSucceeded(GetConsoleScreenBufferInfoEx(` <!-- * []() `` --> Feels free to add more as they come. Maybe just disable all of them?
Author
Owner

@Don-Vito commented on GitHub (Dec 5, 2020):

@zadjii-msft - there are much more tests failing (e.g., WriteConsoleOutputWWithClipping, TestDbcsBisectWriteCellsEndA, WrongWayVerbsUser)

A common trend for them is that:

  1. They call GetStdOutputHandle, followed by some console API (e.g., GetConsoleScreenBufferInfoEx, SetConsoleWindowInfo, ReadConsoleOutputCharacterW) which returns 6 (invalid handle) as last error.
  2. The preceding init invokes FreeConsole, sleeps for a second and then invokes AttachConsole (followed by freopen_s for stdin and stdout)

I don't have a smoking gun here, but given the random nature of the failure, sleeps are always suspicious. Why is this sleep required? What happens if this 1 second sleep is insufficient?

@Don-Vito commented on GitHub (Dec 5, 2020): @zadjii-msft - there are much more tests failing (e.g., `WriteConsoleOutputWWithClipping`, `TestDbcsBisectWriteCellsEndA`, `WrongWayVerbsUser`) A common trend for them is that: 1. They call `GetStdOutputHandle`, followed by some console API (e.g., `GetConsoleScreenBufferInfoEx`, `SetConsoleWindowInfo`, `ReadConsoleOutputCharacterW`) which returns 6 (invalid handle) as last error. 2. The preceding init invokes `FreeConsole`, sleeps for a second and then invokes `AttachConsole` (followed by `freopen_s` for `stdin` and `stdout`) I don't have a smoking gun here, but given the random nature of the failure, sleeps are always suspicious. Why is this sleep required? What happens if this 1 second sleep is insufficient?
Author
Owner

@zadjii-msft commented on GitHub (Dec 9, 2020):

So these tests are wonky. They're all basically summoning another openconsole.exe (to test), then running the test code in that console. So I'm betting the sleep is to ensure that the new window is created.

I agree that sleeping is usually a problematic sign. I'm gonna see if I can't throw something together. @miniksa as an FYI, since he wrote these tests and they're still a bit of magic

@zadjii-msft commented on GitHub (Dec 9, 2020): So these tests are wonky. They're all basically summoning another `openconsole.exe` (to test), then running the test code _in that console_. So I'm betting the sleep is to ensure that the new window is created. I agree that sleeping is usually a problematic sign. I'm gonna see if I can't throw something together. @miniksa as an FYI, since he wrote these tests and they're still a bit of magic
Author
Owner

@miniksa commented on GitHub (Dec 9, 2020):

So I'm betting the sleep is to ensure that the new window is created.

Hit the nail on the head.

I'm sure with a lot of thought, I could have come up with some fail-proof way of waiting for the window thread to start after the process started (asynchronously of course because CreateProcess is an async sort of dispatch to the kernel) and then wait for the window to display or whatnot.

But eh.

@miniksa commented on GitHub (Dec 9, 2020): > So I'm betting the sleep is to ensure that the new window is created. Hit the nail on the head. I'm sure with a lot of thought, I could have come up with some fail-proof way of waiting for the window thread to start after the process started (asynchronously of course because `CreateProcess` is an async sort of dispatch to the kernel) and then wait for the window to display or whatnot. But eh.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#11696