Thanks to visit codestin.com
Credit goes to github.com

Skip to content

tests: Further reduce explicit test sleep times - #8027

Merged
rbradford merged 11 commits into
cloud-hypervisor:mainfrom
rbradford:202604/more-reduce-explicit-sleeps
Apr 16, 2026
Merged

rbradford merged 11 commits into
cloud-hypervisor:mainfrom
rbradford:202604/more-reduce-explicit-sleeps

Conversation

@rbradford

Copy link
Copy Markdown
Member
  • tests: Reduce explicit sleep time in test_api tests*
  • tests: Remove explicit sleeps from balloon tests
  • tests: Remove explicit sleeps before killing vhost-user daemons
  • tests: Use wait_until! to check for vhost-user socket
  • tests: Remove explicit sleeps from "liveness" checks
  • tests: Remove explicit sleep from tests_simple_launch tests

@phip1611 phip1611 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lovely! Less flakiness and maybe even one-two minutes less execution time!

Comment thread cloud-hypervisor/tests/integration.rs
Comment thread cloud-hypervisor/tests/common/tests_wrappers.rs
@rbradford

Copy link
Copy Markdown
Member Author

(This whole PR is a bit speculative as i'm still working on running the tests locally.)

@rbradford
rbradford force-pushed the 202604/more-reduce-explicit-sleeps branch 7 times, most recently from 43c045e to 64bf50c Compare April 15, 2026 12:28
@rbradford
rbradford marked this pull request as ready for review April 15, 2026 12:58
@rbradford
rbradford requested a review from a team as a code owner April 15, 2026 12:58
Comment thread test_infra/src/lib.rs Outdated
Comment on lines +1220 to +1221
/// Waits until the guest's SSH port is no longer reachable, indicating
/// the guest has fully shut down.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does it really indicate that the guest has fully shut down? It just means sshd has been stopped and the guest could still be shutting down/cleaning up other things?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeh, it's a tricky one. Suggest a better name?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If this is just about if the guest shut down: why not check the event monitor?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Because it doesn't poweroff the VM - instead it just halts it. Thus you don't get the event. This is for a test that boots, shutdown and then boots it again. I guess if it used poweroff then it would quit the VMM and that wouldn't work.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

What about wait_for_ssh_unresponsive() ? And then maybe when #8025 lands we can do better?

@phip1611 phip1611 Apr 15, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

UPDATE You were faster than me haha

by the way, we are going to change that #8025 - guest shutdown will keep the VMM running. Not sure if this is helpful for you here (I don't know the specifics)


Okay, my long weekend starts now - see you Monday!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We can keep the current name. I was just wondering if this is the most reliable way we have for determining if a guest has shut down. Seems like that is the case currently. So be it then.

@rbradford
rbradford force-pushed the 202604/more-reduce-explicit-sleeps branch from 64bf50c to 5a31235 Compare April 16, 2026 16:41
@rbradford
rbradford enabled auto-merge April 16, 2026 16:45
Use new `wait_until()` and existing boot response mechanisms to remove
explicit sleeps from these tests.

Signed-off-by: Rob Bradford <[email protected]>
Use the new `wait_until()` to test the balloon size.

Signed-off-by: Rob Bradford <[email protected]>
If we're about to kill the daemons we don't need to spin waiting for
them.

Signed-off-by: Rob Bradford <[email protected]>
Rather than use a fixed time to wait for the socket to be opened instead
test for its existence using `wait_until()`.

Signed-off-by: Rob Bradford <[email protected]>
The vhost-user tests uses SSH and checking the RAM to test for the
liveness of the VM - replace the explicit sleep before them with
`wait_until()` allowing them to potentially finish earlier.

Signed-off-by: Rob Bradford <[email protected]>
On the shutdown path remove the explicit sleep and instead wait for
the event to be delivered.

Signed-off-by: Rob Bradford <[email protected]>
Instead use `wait_until()` for mounting of the filesystem.

Signed-off-by: Rob Bradford <[email protected]>
Use `wait_until()` with the SSH command for detecting if the block
device is present/absent as part of hotplugging/unplugging.

Signed-off-by: Rob Bradford <[email protected]>
Use `wait_until()` with the SSH command for detecting if the net device
is present/absent as part of hotplugging/unplugging.

Signed-off-by: Rob Bradford <[email protected]>
Instead wait for the event to be delivered that it has panicked.

Signed-off-by: Rob Bradford <[email protected]>
Instead wait for the guest to stop responding on the SSH port.

Signed-off-by: Rob Bradford <[email protected]>
@rbradford
rbradford force-pushed the 202604/more-reduce-explicit-sleeps branch from 5a31235 to 5ef8633 Compare April 16, 2026 21:52
@rbradford
rbradford added this pull request to the merge queue Apr 16, 2026
Merged via the queue into cloud-hypervisor:main with commit 43b5a47 Apr 16, 2026
37 of 38 checks passed
@phip1611

Copy link
Copy Markdown
Member

#7943 brought us ~15min, this another 5min. We are now consistently down to 40min it seems (was 60). awesome!

Follow-up #8065

@rbradford
rbradford deleted the 202604/more-reduce-explicit-sleeps branch June 12, 2026 10:36
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.

3 participants