-
Notifications
You must be signed in to change notification settings - Fork 22
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
PHD: add Windows Server 2016 adapter & improve WS2016/2019 reliability #646
Conversation
/// Wait for the supplied string to appear on the guest serial console. | ||
WaitFor(&'static str), | ||
WaitFor(Cow<'a, str>), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like it might be the wrong tool for the job, but maybe not?
Previously this was only used for the string literals that appear in guest OSes' boot sequences, but now a command might be an owned string, e.g. if shell_command_sequence
had to amend it. It seemed silly to make all the literals into owned String
s just to accommodate this case, but I'm not sure if Cow
is the best (or even an appropriate) way for this code to have its &'static str
cake and eat String
s too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cow
is absolutely an appropriate way to have something that's "either a &'static str
or a String
" --- honestly, I think I see it used for that purpose far more than for use-cases that actually use copy-on-write...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me! i left a few suggestions, but none of them seemed like actual problems.
Change the semantics of waiting for characters in the serial buffer so that waits return the preceding buffer contents but don't actually erase anything from the buffer. Instead, make callers manually issue a "clear" command to discard from the buffer anything they know they're not going to want, and update the guest shell command sequences to clear the buffer between echoing the entire command and pressing Enter to execute it. This fixes issues with command echoing for Windows guests that don't redraw characters that the guest believes are already on the screen--now those characters don't get consumed from the buffer, so it's OK that the guest doesn't explicitly reprint them.
Thanks @hawkw! I still need to address your feedback here. I pushed bb39823 to change the serial console wait discipline in a way that should fix #643 for good:
With this change Windows Server 2019 passes all the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lovely!
The phd-run job failed due to a known flake in VMM teardown that I've filed as #648. All the tests otherwise passed. |
Add a Windows Server 2016 guest adapter to PHD. It's more or less identical to the Windows Server 2019 adapter (but is still worth keeping separate since the guests support different command-line tools and Powershell cmdlets out of the box).
Tighten a few bolts to improve (but not perfect) test performance and reliability for these guests:
GuestOs
es now specify a serial consoleCommandSequence
that the framework should execute in order to run a shell command.With this change, it no longer matters that Windows guests don't re-echo characters that are already on-screen, because the framework no longer invalidates them until it knows they're no longer wanted.
Additionally improve the keystroke debounce logic:
Only apply the debounce delay if the next character to be issued is the same as the previous character. This allows the debounce timeout to be lengthened considerably without tanking test performance (which is important to minimize flakiness).
It might be worth investigating whether we could avoid this delay by doing byte-by-byte "call and response" for characters we expect the guest to echo. This may require a more substantial refactoring of the serial console code, so I've just resorted to having a longer debounce for now.
Change
TestVm::send_serial_bytes_async
to wait for the serial task to acknowledge that it has sent all the requested bytes to the guest before returning so thatTestVm
can time out waiting for characters to be echoed without including the time spent waiting for them to be sent.Tested with WS2016, WS2019, and Debian 11 guests.
Fixes #601. Fixes #644. Fixes #643.