PHD: make lshw_lifecycle_test actually do that on Alpine#1037
Open
PHD: make lshw_lifecycle_test actually do that on Alpine#1037
lshw_lifecycle_test actually do that on Alpine#1037Conversation
That PHD test `lshw_lifecycle_test`, which starts a VM, runs `lspci` and `lshw`, stops, and restarts the VM, and asserts that the output of those commands on the original and subsequent VM are the same. This is intended to demonstrate that guest devices are not arbitrarily scrambled after restarting the guest, which is important. Fortunately for us, when running PHD tests with Alpine Linux as the guest OS (as we do on CI), the output of those commands on the initial and subsequent guests are, in fact, the same. Unfortunately, however, the output is: ```console localhost:~# stty -F `tty` cols 9999 localhost:~# sudo lspci -vvx -ash: sudo: not found localhost:~# sudo lshw -notime -ash: sudo: not found ``` Which, as you can see, _does_ in fact successfully demonstrate that both guests are seeing the same PCIe devices and such. :) Yeah. That sucks lol. This commit fixes that by removing the `sudo`, which doth not exist on Alpine Linux without having installed it. We don't actually need `sudo` on Alpine, since we log in as root anyway, [which is the correct and proper thing to do on linux][1]. This should be fine when running the tests with other Linuces as the guest OS, since the very first thing the `GuestOs` implementation for Ubuntu 22.04, does is [to immediately `sudo bash` to become root immediately][2], and the Debian 11 one [also does the morally correct thing and logs in as root][3]. Fixes #1036 [1]: https://loginasroot.net/linux_root_login_faq [2]: https://github.com/oxidecomputer/propolis/blob/21b3da87b70b4342eb22d861eedb083c32cf08b7/phd-tests/framework/src/guest_os/ubuntu22_04.rs#L20-L21 [3]: https://github.com/oxidecomputer/propolis/blob/21b3da87b70b4342eb22d861eedb083c32cf08b7/phd-tests/framework/src/guest_os/debian11_nocloud.rs#L13-L17
iximeow
reviewed
Feb 6, 2026
| async fn lspci_lifecycle_test(ctx: &Framework) { | ||
| const LSPCI: &str = "sudo lspci -vvx"; | ||
| const LSHW: &str = "sudo lshw -notime"; | ||
| const LSPCI: &str = "lspci -vvx"; |
Member
There was a problem hiding this comment.
so the real trick here is that i don't think there is an lspci (or lshw) in the Alpine image, at least the oldish 3.20 image i've got just says -ash: lshw: not found and the same for lspci. since the output can vary by distro's choice and version of the tools, i think we don't want to just compare to a golden output
i'm pretty sure this is actually why i'd wanted to get #797 in, because the sign that this output is uninformative is, i think, getting a non-zero status.
Member
Author
There was a problem hiding this comment.
yeah. we should really try and pick #797 back up, this is a very unfortunate situation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
That PHD test
lshw_lifecycle_test, which starts a VM, runslspciand
lshw, stops, and restarts the VM, and asserts that the output ofthose commands on the original and subsequent VM are the same. This is
intended to demonstrate that guest devices are not arbitrarily scrambled
after restarting the guest, which is important.
Fortunately for us, when running PHD tests with Alpine Linux as the
guest OS (as we do on CI), the output of those commands on the initial
and subsequent guests are, in fact, the same.
Unfortunately, however, the output is:
Which, as you can see, does in fact successfully demonstrate that both
guests are seeing the same PCIe devices and such. :)
Yeah.
That sucks lol.
This commit fixes that by removing the
sudo, which doth not exist onAlpine Linux without having installed it. We don't actually need
sudoon Alpine, since we log in as root anyway, which is the correct and
proper thing to do on linux.
This should be fine when running the tests with other Linuces as the
guest OS, since the very first thing the
GuestOsimplementation forUbuntu 22.04, does is to immediately
sudo bashto become rootimmediately, and the Debian 11 one also does the morally correct
thing and logs in as root.
Fixes #1036