public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server v3 4/4] test: cfg2cmd: allow setting host CPU vendor for a given test
Date: Tue, 14 Jul 2026 12:41:51 +0200	[thread overview]
Message-ID: <20260714104201.71308-5-f.ebner@proxmox.com> (raw)
In-Reply-To: <20260714104201.71308-1-f.ebner@proxmox.com>

The host CPU vendor defaults to GenuineIntel for test stability, but
it can be useful to also test for other vendors. Allow overriding the
vendor in a test using a new HOST_CPU_VENDOR property.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

New in v3.

 .../cfg2cmd/win11-amd-host-11.0+pve2.conf     |  5 ++++
 .../cfg2cmd/win11-amd-host-11.0+pve2.conf.cmd | 26 +++++++++++++++++++
 src/test/run_config2command_tests.pl          | 10 ++++++-
 3 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 src/test/cfg2cmd/win11-amd-host-11.0+pve2.conf
 create mode 100644 src/test/cfg2cmd/win11-amd-host-11.0+pve2.conf.cmd

diff --git a/src/test/cfg2cmd/win11-amd-host-11.0+pve2.conf b/src/test/cfg2cmd/win11-amd-host-11.0+pve2.conf
new file mode 100644
index 00000000..5624d2de
--- /dev/null
+++ b/src/test/cfg2cmd/win11-amd-host-11.0+pve2.conf
@@ -0,0 +1,5 @@
+# TEST: Simple test for Windows 11 VM with AMD host CPU and machine version 11.0+pve2
+# HOST_CPU_VENDOR: AuthenticAMD
+cpu: host
+machine: pc-q35-11.0+pve2
+ostype: win11
diff --git a/src/test/cfg2cmd/win11-amd-host-11.0+pve2.conf.cmd b/src/test/cfg2cmd/win11-amd-host-11.0+pve2.conf.cmd
new file mode 100644
index 00000000..c2b6657f
--- /dev/null
+++ b/src/test/cfg2cmd/win11-amd-host-11.0+pve2.conf.cmd
@@ -0,0 +1,26 @@
+/usr/bin/kvm \
+  -id 8006 \
+  -name vm8006 \
+  -no-shutdown \
+  -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \
+  -mon 'chardev=qmp,mode=control' \
+  -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \
+  -mon 'chardev=qmp-event,mode=control' \
+  -pidfile /var/run/qemu-server/8006.pid \
+  -daemonize \
+  -smp '1,sockets=1,cores=1,maxcpus=1' \
+  -nodefaults \
+  -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \
+  -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \
+  -global 'kvm-pit.lost_tick_policy=discard' \
+  -cpu 'host,-cet-ibt,-cet-ss,hv_ipi,hv_relaxed,hv_reset,hv_runtime,hv_spinlocks=0x1fff,hv_stimer,hv_synic,hv_time,hv_vapic,hv_vpindex,+kvm_pv_eoi,+kvm_pv_unhalt' \
+  -m 512 \
+  -global 'ICH9-LPC.disable_s3=1' \
+  -global 'ICH9-LPC.disable_s4=1' \
+  -readconfig /usr/share/qemu-server/pve-q35-4.0.cfg \
+  -device 'usb-tablet,id=tablet,bus=ehci.0,port=1' \
+  -device 'VGA,id=vga,bus=pcie.0,addr=0x1,edid=off' \
+  -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on' \
+  -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \
+  -rtc 'driftfix=slew,base=localtime' \
+  -machine 'hpet=off,type=pc-q35-11.0+pve0'
diff --git a/src/test/run_config2command_tests.pl b/src/test/run_config2command_tests.pl
index a8eebc12..47250c67 100755
--- a/src/test/run_config2command_tests.pl
+++ b/src/test/run_config2command_tests.pl
@@ -184,6 +184,7 @@ my $current_test; # = {
 #   description => 'Test description', # if available
 #   qemu_version => '2.12',
 #   host_arch => 'HOST_ARCH',
+#   'host-cpu-vendor' => 'HOST_CPU_VENDOR',
 #   expected_error => 'error message',
 #   expected_warning => 'warning message',
 #   config => { config hash },
@@ -194,6 +195,7 @@ my $current_test; # = {
 #   TEST: A single line describing the test, gets outputted
 #   QEMU_VERSION: \d+\.\d+(\.\d+)? (defaults to current version)
 #   HOST_ARCH: x86_64 | aarch64 (default to x86_64, to make tests stable)
+#   HOST_CPU_VENDOR: AuthenticAMD | GenuineIntel | etc. (defaults to GenuineIntel)
 #   EXPECT_ERROR: <error message> For negative tests
 #   EXPECT_WARN(ING): <warning message> that is expected
 #   HW_CAPABILITIES: <cpu-type-or-json-string> to defined the HW caps the test should expose
@@ -209,6 +211,8 @@ sub parse_test($config_fn) {
 
     my $description = $config->{description} // '';
 
+    $current_test->{'host-cpu-vendor'} = 'GenuineIntel';
+
     while ($description =~ /^\h*(.*?)\h*$/gm) {
         my $line = $1;
         next if !$line || $line =~ /^#/;
@@ -221,6 +225,8 @@ sub parse_test($config_fn) {
             $current_test->{qemu_version} = "$1";
         } elsif ($line =~ /^HOST_ARCH:\s*(.*)\s*$/) {
             $current_test->{host_arch} = "$1";
+        } elsif ($line =~ /^HOST_CPU_VENDOR:\s*(.*)\s*$/) {
+            $current_test->{'host-cpu-vendor'} = "$1";
         } elsif ($line =~ /^EXPECT_ERROR:\s*(.*)\s*$/) {
             $current_test->{expect_error} = "$1";
         } elsif ($line =~ /^EXPECT_WARN(?:ING)?:\s*(.*)\s*$/) {
@@ -248,7 +254,9 @@ my $procfs_tools_module = Test::MockModule->new('PVE::ProcFSTools');
 $procfs_tools_module->mock(
     read_cpuinfo => sub {
         my $res = $procfs_tools_module->original('read_cpuinfo')->();
-        $res->{vendor} = 'GenuineIntel';
+        my $vendor = $current_test->{'host-cpu-vendor'}
+            or die "internal error - host cpu vendor not set";
+        $res->{vendor} = $vendor;
         return $res;
     },
 );
-- 
2.47.3





      parent reply	other threads:[~2026-07-14 10:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14 10:41 [PATCH-SERIES qemu-server v3 0/4] cpu config: enable hv-evmcs for Windows 11/2022/2025 to mitigate issues with VBS Fiona Ebner
2026-07-14 10:41 ` [PATCH qemu-server v3 1/4] cpu config: disable vmx-mbec flag for machine versions < 11.0 Fiona Ebner
2026-07-14 10:41 ` [PATCH qemu-server v3 2/4] cpu config: use $version_guard rather than passing $machine_version Fiona Ebner
2026-07-14 10:41 ` [PATCH qemu-server v3 3/4] cpu config: enable hv-evmcs for Windows 11/2022/2025 to mitigate issues with VBS Fiona Ebner
2026-07-14 10:41 ` Fiona Ebner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260714104201.71308-5-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal