tests: centralize default CPU arguments in test infrastructure

Replace the hard-coded  .args(["--cpus", "boot=1"]) in the simple
launch integration test with a shared helper (default_cpus) from test
infrastructure.

Extend Guest with explicit CPU-related defaults (num_cpu, nested)
and add default_cpus_string() so CPU configuration is derived from
guest state instead of being duplicated at call sites.

This refactor improves consistency and makes CPU defaults easier to
maintain across integration tests.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
Muminul Islam
2026-02-22 22:13:57 -08:00
committed by Rob Bradford
parent fdc51d923f
commit 60c6242bde
2 changed files with 17 additions and 1 deletions

View File

@@ -2545,7 +2545,7 @@ fn _test_simple_launch(guest: &Guest) {
let event_path = temp_event_monitor_path(&guest.tmp_dir);
let mut child = GuestCommand::new(guest)
.args(["--cpus", "boot=1"])
.default_cpus()
.args(["--memory", "size=512M"])
.default_kernel_cmdline()
.default_disks()