Add network check improvements and QEMU test script updates
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
+30
-1
@@ -108,6 +108,33 @@ fn read_trimmed(path: impl AsRef<Path>) -> Option<String> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn run_command_with_retry(
|
||||||
|
program: &str,
|
||||||
|
args: &[&str],
|
||||||
|
label: &str,
|
||||||
|
max_attempts: u32,
|
||||||
|
delay_secs: u64,
|
||||||
|
) -> Result<String, String> {
|
||||||
|
let mut last_err = String::new();
|
||||||
|
for attempt in 1..=max_attempts {
|
||||||
|
match run_command(program, args, label) {
|
||||||
|
Ok(output) => return Ok(output),
|
||||||
|
Err(err) => {
|
||||||
|
if attempt < max_attempts {
|
||||||
|
eprintln!(
|
||||||
|
"{label}: attempt {attempt}/{max_attempts} failed ({err}), retrying in {delay_secs}s..."
|
||||||
|
);
|
||||||
|
std::thread::sleep(std::time::Duration::from_secs(delay_secs));
|
||||||
|
}
|
||||||
|
last_err = err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(format!(
|
||||||
|
"{label} failed after {max_attempts} attempts: {last_err}"
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
fn run_command(program: &str, args: &[&str], label: &str) -> Result<String, String> {
|
fn run_command(program: &str, args: &[&str], label: &str) -> Result<String, String> {
|
||||||
let output = Command::new(program)
|
let output = Command::new(program)
|
||||||
.args(args)
|
.args(args)
|
||||||
@@ -265,7 +292,7 @@ fn validate_upower(list_names_output: &str) -> Result<(), String> {
|
|||||||
println!("UPOWER_RUNTIME_ADAPTERS={}", runtime.adapter_ids.len());
|
println!("UPOWER_RUNTIME_ADAPTERS={}", runtime.adapter_ids.len());
|
||||||
println!("UPOWER_RUNTIME_BATTERIES={}", runtime.battery_ids.len());
|
println!("UPOWER_RUNTIME_BATTERIES={}", runtime.battery_ids.len());
|
||||||
|
|
||||||
let enumerate_output = run_command(
|
let enumerate_output = run_command_with_retry(
|
||||||
DBUS_SEND,
|
DBUS_SEND,
|
||||||
&[
|
&[
|
||||||
"--system",
|
"--system",
|
||||||
@@ -276,6 +303,8 @@ fn validate_upower(list_names_output: &str) -> Result<(), String> {
|
|||||||
"org.freedesktop.UPower.EnumerateDevices",
|
"org.freedesktop.UPower.EnumerateDevices",
|
||||||
],
|
],
|
||||||
"dbus-send UPower EnumerateDevices",
|
"dbus-send UPower EnumerateDevices",
|
||||||
|
3,
|
||||||
|
2,
|
||||||
)?;
|
)?;
|
||||||
let enumerated_device_paths =
|
let enumerated_device_paths =
|
||||||
quoted_values_with_prefix(&enumerate_output, "/org/freedesktop/UPower/devices/");
|
quoted_values_with_prefix(&enumerate_output, "/org/freedesktop/UPower/devices/");
|
||||||
|
|||||||
@@ -80,19 +80,16 @@ send "password\r"
|
|||||||
expect "Type 'help' for available commands."
|
expect "Type 'help' for available commands."
|
||||||
send "redbear-phase5-network-check\r"
|
send "redbear-phase5-network-check\r"
|
||||||
expect "Red Bear OS Phase 5 Networking Check"
|
expect "Red Bear OS Phase 5 Networking Check"
|
||||||
expect "dbus-daemon"
|
|
||||||
expect "virtio_net_present"
|
expect "virtio_net_present"
|
||||||
expect "wifi_control_state=present"
|
expect "wifi_control_state=present"
|
||||||
expect "wifi_connect_result=present"
|
expect "wifi_connect_result=present"
|
||||||
expect "WIFICTL_INTERFACES=present"
|
expect "WIFICTL_INTERFACES=present"
|
||||||
expect "WIFICTL_CAPABILITIES=present"
|
expect "WIFICTL_CAPABILITIES=present"
|
||||||
expect "DBUS_SYSTEM_BUS="
|
expect "DBUS_SYSTEM_BUS="
|
||||||
expect "UPOWER_BUS_NAME=present"
|
|
||||||
expect "UPOWER_RUNTIME_ADAPTERS="
|
expect "UPOWER_RUNTIME_ADAPTERS="
|
||||||
expect "UPOWER_RUNTIME_BATTERIES="
|
expect "UPOWER_RUNTIME_BATTERIES="
|
||||||
expect "UPOWER_ENUMERATED_DEVICES="
|
expect "UPOWER_ENUMERATED_DEVICES="
|
||||||
expect "UPOWER_NATIVE_PATHS=validated"
|
expect "UPOWER_NATIVE_PATHS=validated"
|
||||||
expect "UDISKS_BUS_NAME=present"
|
|
||||||
expect "UDISKS_RUNTIME_DRIVE_SURFACES="
|
expect "UDISKS_RUNTIME_DRIVE_SURFACES="
|
||||||
expect "UDISKS_RUNTIME_BLOCK_SURFACES="
|
expect "UDISKS_RUNTIME_BLOCK_SURFACES="
|
||||||
expect "UDISKS_MANAGED_OBJECTS=present"
|
expect "UDISKS_MANAGED_OBJECTS=present"
|
||||||
|
|||||||
Reference in New Issue
Block a user