[libvirt] [PATCH 2/6] Tests for CPU selection in qemu driver

Jiri Denemark jdenemar at redhat.com
Fri Apr 16 17:01:40 UTC 2010


---
 .../qemuxml2argvdata/qemuxml2argv-cpu-exact1.args  |    1 +
 tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.xml |   28 ++++++++++++++
 .../qemuxml2argvdata/qemuxml2argv-cpu-exact2.args  |    1 +
 tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.xml |   35 ++++++++++++++++++
 .../qemuxml2argv-cpu-minimum1.args                 |    1 +
 .../qemuxml2argvdata/qemuxml2argv-cpu-minimum1.xml |   21 +++++++++++
 .../qemuxml2argv-cpu-minimum2.args                 |    1 +
 .../qemuxml2argvdata/qemuxml2argv-cpu-minimum2.xml |   25 +++++++++++++
 .../qemuxml2argvdata/qemuxml2argv-cpu-strict1.args |    1 +
 .../qemuxml2argvdata/qemuxml2argv-cpu-strict1.xml  |   38 ++++++++++++++++++++
 .../qemuxml2argv-cpu-topology1.args                |    1 +
 .../qemuxml2argv-cpu-topology1.xml                 |   21 +++++++++++
 .../qemuxml2argv-cpu-topology2.args                |    1 +
 .../qemuxml2argv-cpu-topology2.xml                 |   22 +++++++++++
 .../qemuxml2argv-cpu-topology3.args                |    1 +
 .../qemuxml2argv-cpu-topology3.xml                 |   21 +++++++++++
 tests/qemuxml2argvtest.c                           |    9 +++++
 17 files changed, 228 insertions(+), 0 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-topology1.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-topology1.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-topology2.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-topology2.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-topology3.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-topology3.xml

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.args
new file mode 100644
index 0000000..e48672c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -cpu qemu64,-svm,-lm,-nx,-syscall,-clflush,-pse36,-mca -m 214 -smp 6 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net none -serial none -parallel none -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.xml
new file mode 100644
index 0000000..2538b1d
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.xml
@@ -0,0 +1,28 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>6</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <cpu match='exact'>
+    <model>qemu64</model>
+    <feature policy='disable' name='svm'/>
+    <feature policy='disable' name='lm'/>
+    <feature policy='disable' name='nx'/>
+    <feature policy='disable' name='syscall'/>
+    <feature policy='disable' name='clflush'/>
+    <feature policy='disable' name='pse36'/>
+    <feature policy='disable' name='mca'/>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+      <emulator>/usr/bin/qemu</emulator>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.args
new file mode 100644
index 0000000..d418d51
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -cpu core2duo,+lahf_lm,+3dnowext,+xtpr,+ds_cpl,+tm,+ht,+ds,-nx -m 214 -smp 6 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net none -serial none -parallel none -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.xml
new file mode 100644
index 0000000..db25a72
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.xml
@@ -0,0 +1,35 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>6</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <cpu match='exact'>
+    <model>core2duo</model>
+    <feature name='lahf_lm' policy='require'/>
+    <feature name='xtpr' policy='require'/>
+    <feature name='cx16' policy='disable'/>
+    <feature name='tm2' policy='disable'/>
+    <feature name='ds_cpl' policy='require'/>
+    <feature name='pbe' policy='disable'/>
+    <feature name='tm' policy='optional'/>
+    <feature name='ht' policy='require'/>
+    <feature name='ss' policy='disable'/>
+    <feature name='ds' policy='require'/>
+    <feature name='nx' policy='disable'/>
+    <feature name='3dnowext' policy='force'/>
+    <feature name='sse4a' policy='optional'/>
+    <feature name='wdt' policy='forbid'/>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+      <emulator>/usr/bin/qemu</emulator>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.args
new file mode 100644
index 0000000..06009ae
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -cpu core2duo,+lahf_lm,+xtpr,+cx16,+tm2,+est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,+acpi,+ds -m 214 -smp 6 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net none -serial none -parallel none -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.xml
new file mode 100644
index 0000000..db9ad2f
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.xml
@@ -0,0 +1,21 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <cpu match='minimum'>
+    <model>486</model>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+      <emulator>/usr/bin/qemu</emulator>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.args
new file mode 100644
index 0000000..e2bc2e9
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -cpu core2duo,+lahf_lm,+xtpr,+cx16,+tm2,+est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,+acpi,+ds,-lm,-nx,-syscall -m 214 -smp 6 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net none -serial none -parallel none -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.xml
new file mode 100644
index 0000000..0c89a26
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.xml
@@ -0,0 +1,25 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>6</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <cpu match='minimum'>
+    <model>qemu64</model>
+    <feature policy='disable' name='svm'/>
+    <feature policy='disable' name='lm'/>
+    <feature policy='disable' name='nx'/>
+    <feature policy='disable' name='syscall'/>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+      <emulator>/usr/bin/qemu</emulator>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.args
new file mode 100644
index 0000000..07cc0d7
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -cpu core2duo,+lahf_lm,+3dnowext,+xtpr,+est,+vmx,+ds_cpl,+tm,+ht,+acpi,+ds,-nx -m 214 -smp 6 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net none -serial none -parallel none -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.xml
new file mode 100644
index 0000000..6dacd9e
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.xml
@@ -0,0 +1,38 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>6</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <cpu match='strict'>
+    <model>core2duo</model>
+    <feature name='lahf_lm' policy='require'/>
+    <feature name='xtpr' policy='require'/>
+    <feature name='cx16' policy='disable'/>
+    <feature name='tm2' policy='disable'/>
+    <feature name='est' policy='optional'/>
+    <feature name='vmx' policy='optional'/>
+    <feature name='ds_cpl' policy='require'/>
+    <feature name='pbe' policy='disable'/>
+    <feature name='tm' policy='optional'/>
+    <feature name='ht' policy='require'/>
+    <feature name='ss' policy='disable'/>
+    <feature name='acpi' policy='optional'/>
+    <feature name='ds' policy='require'/>
+    <feature name='nx' policy='disable'/>
+    <feature name='3dnowext' policy='force'/>
+    <feature name='sse4a' policy='optional'/>
+    <feature name='wdt' policy='forbid'/>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+      <emulator>/usr/bin/qemu</emulator>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology1.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology1.args
new file mode 100644
index 0000000..43e1d43
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology1.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 6,sockets=3,cores=2,threads=1 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net none -serial none -parallel none -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology1.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology1.xml
new file mode 100644
index 0000000..e31ea4b
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology1.xml
@@ -0,0 +1,21 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>6</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <cpu>
+    <topology sockets="3" cores="2" threads="1"/>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+      <emulator>/usr/bin/qemu</emulator>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology2.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology2.args
new file mode 100644
index 0000000..f3d8f01
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology2.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -cpu core2duo -m 214 -smp 6,sockets=1,cores=2,threads=3 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net none -serial none -parallel none -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology2.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology2.xml
new file mode 100644
index 0000000..8bdad2c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology2.xml
@@ -0,0 +1,22 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>6</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <cpu match='exact'>
+    <model>core2duo</model>
+    <topology sockets="1" cores="2" threads="3"/>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+      <emulator>/usr/bin/qemu</emulator>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology3.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology3.args
new file mode 100644
index 0000000..210bcdf
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology3.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 6 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -net none -serial none -parallel none -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology3.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology3.xml
new file mode 100644
index 0000000..e31ea4b
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology3.xml
@@ -0,0 +1,21 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>6</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <cpu>
+    <topology sockets="3" cores="2" threads="1"/>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+      <emulator>/usr/bin/qemu</emulator>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 9e4d5bf..beb5dcd 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -346,6 +346,15 @@ mymain(int argc, char **argv)
     DO_TEST_FULL("restore-v2", QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC, "exec:cat");
     DO_TEST_FULL("migrate", QEMUD_CMD_FLAG_MIGRATE_QEMU_TCP, "tcp:10.0.0.1:5000");
 
+    DO_TEST("cpu-topology1", QEMUD_CMD_FLAG_SMP_TOPOLOGY);
+    DO_TEST("cpu-topology2", QEMUD_CMD_FLAG_SMP_TOPOLOGY);
+    DO_TEST("cpu-topology3", 0);
+    DO_TEST("cpu-minimum1", 0);
+    DO_TEST("cpu-minimum2", 0);
+    DO_TEST("cpu-exact1", 0);
+    DO_TEST("cpu-exact2", 0);
+    DO_TEST("cpu-strict1", 0);
+
     free(driver.stateDir);
     virCapabilitiesFree(driver.caps);
 
-- 
1.7.0.4




More information about the libvir-list mailing list