Add regression test for kvm with explicit -cpu core2duo option.
authorRichard W.M. Jones <rjones@redhat.com>
Wed, 25 May 2011 10:04:07 +0000 (11:04 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Wed, 25 May 2011 10:14:22 +0000 (11:14 +0100)
Makefile.am
tests/kvm-explicit-cpu/proc/cpuinfo [new file with mode: 0644]
tests/kvm-explicit-cpu/proc/self/status [new file with mode: 0644]
tests/kvm-explicit-cpu/sbin/dmidecode [new file with mode: 0755]
tests/kvm-explicit-cpu/sbin/id [new file with mode: 0755]
tests/kvm-explicit-cpu/sbin/virt-what-cpuid-helper [new file with mode: 0755]
tests/test-kvm-explicit-cpu.sh [new file with mode: 0755]

index 38998bf..2dfed9c 100644 (file)
@@ -36,6 +36,7 @@ TESTS = \
        tests/test-esx4.1.sh \
        tests/test-hyperv.sh \
        tests/test-kvm.sh \
+       tests/test-kvm-explicit-cpu.sh \
        tests/test-linux-vserver.sh \
        tests/test-lx86.sh \
        tests/test-parallels-desktop.sh \
@@ -68,6 +69,11 @@ EXTRA_DIST = \
        tests/kvm/sbin/dmidecode \
        tests/kvm/sbin/id \
        tests/kvm/sbin/virt-what-cpuid-helper \
+       tests/kvm-explicit-cpu/proc/cpuinfo \
+       tests/kvm-explicit-cpu/proc/self/status \
+       tests/kvm-explicit-cpu/sbin/dmidecode \
+       tests/kvm-explicit-cpu/sbin/id \
+       tests/kvm-explicit-cpu/sbin/virt-what-cpuid-helper \
        tests/linux-vserver/proc/cpuinfo \
        tests/linux-vserver/proc/self/status \
        tests/linux-vserver/sbin/dmidecode \
diff --git a/tests/kvm-explicit-cpu/proc/cpuinfo b/tests/kvm-explicit-cpu/proc/cpuinfo
new file mode 100644 (file)
index 0000000..a53a4b9
--- /dev/null
@@ -0,0 +1,19 @@
+processor      : 0
+vendor_id      : GenuineIntel
+cpu family     : 6
+model          : 15
+model name     : Intel(R) Core(TM)2 Duo CPU     T7700  @ 2.40GHz
+stepping       : 11
+cpu MHz                : 2659.998
+cache size     : 4096 KB
+fpu            : yes
+fpu_exception  : yes
+cpuid level    : 10
+wp             : yes
+flags          : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx lm constant_tsc up rep_good pni ssse3 cx16 hypervisor lahf_lm
+bogomips       : 5319.99
+clflush size   : 64
+cache_alignment        : 64
+address sizes  : 40 bits physical, 48 bits virtual
+power management:
+
diff --git a/tests/kvm-explicit-cpu/proc/self/status b/tests/kvm-explicit-cpu/proc/self/status
new file mode 100644 (file)
index 0000000..264981d
--- /dev/null
@@ -0,0 +1,39 @@
+Name:  cat
+State: R (running)
+Tgid:  1618
+Pid:   1618
+PPid:  1609
+TracerPid:     0
+Uid:   0       0       0       0
+Gid:   0       0       0       0
+Utrace:        0
+FDSize:        256
+Groups:        0 1 2 3 4 6 10 
+VmPeak:          101012 kB
+VmSize:          101012 kB
+VmLck:        0 kB
+VmHWM:      472 kB
+VmRSS:      472 kB
+VmData:             184 kB
+VmStk:      136 kB
+VmExe:       44 kB
+VmLib:     1728 kB
+VmPTE:       44 kB
+VmSwap:               0 kB
+Threads:       1
+SigQ:  0/7858
+SigPnd:        0000000000000000
+ShdPnd:        0000000000000000
+SigBlk:        0000000000000000
+SigIgn:        0000000000000000
+SigCgt:        0000000000000000
+CapInh:        0000000000000000
+CapPrm:        ffffffffffffffff
+CapEff:        ffffffffffffffff
+CapBnd:        ffffffffffffffff
+Cpus_allowed:  1
+Cpus_allowed_list:     0
+Mems_allowed:  00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
+Mems_allowed_list:     0
+voluntary_ctxt_switches:       0
+nonvoluntary_ctxt_switches:    1
diff --git a/tests/kvm-explicit-cpu/sbin/dmidecode b/tests/kvm-explicit-cpu/sbin/dmidecode
new file mode 100755 (executable)
index 0000000..3ffe125
--- /dev/null
@@ -0,0 +1,113 @@
+#!/bin/sh -
+cat <<'EOF'
+# dmidecode 2.11
+SMBIOS 2.4 present.
+10 structures occupying 263 bytes.
+Table at 0x3FFFFEF0.
+
+Handle 0x0000, DMI type 0, 24 bytes
+BIOS Information
+       Vendor: Bochs
+       Version: Bochs
+       Release Date: 01/01/2007
+       Address: 0xE8000
+       Runtime Size: 96 kB
+       ROM Size: 64 kB
+       Characteristics:
+               BIOS characteristics not supported
+               Targeted content distribution is supported
+       BIOS Revision: 1.0
+
+Handle 0x0100, DMI type 1, 27 bytes
+System Information
+       Manufacturer: Bochs
+       Product Name: Bochs
+       Version: Not Specified
+       Serial Number: Not Specified
+       UUID: 799AE7CA-23A2-F622-C691-48FEEBCDDBE6
+       Wake-up Type: Power Switch
+       SKU Number: Not Specified
+       Family: Not Specified
+
+Handle 0x0300, DMI type 3, 20 bytes
+Chassis Information
+       Manufacturer: Bochs
+       Type: Other
+       Lock: Not Present
+       Version: Not Specified
+       Serial Number: Not Specified
+       Asset Tag: Not Specified
+       Boot-up State: Safe
+       Power Supply State: Safe
+       Thermal State: Safe
+       Security Status: Unknown
+       OEM Information: 0x00000000
+       Height: Unspecified
+       Number Of Power Cords: Unspecified
+
+Handle 0x0401, DMI type 4, 32 bytes
+Processor Information
+       Socket Designation: CPU01
+       Type: Central Processor
+       Family: Other
+       Manufacturer: Bochs
+       ID: FB 06 00 00 FF FB 8B 0F
+       Version: Not Specified
+       Voltage: Unknown
+       External Clock: Unknown
+       Max Speed: 2000 MHz
+       Current Speed: 2000 MHz
+       Status: Populated, Enabled
+       Upgrade: Other
+       L1 Cache Handle: Not Provided
+       L2 Cache Handle: Not Provided
+       L3 Cache Handle: Not Provided
+
+Handle 0x1000, DMI type 16, 15 bytes
+Physical Memory Array
+       Location: Other
+       Use: System Memory
+       Error Correction Type: Multi-bit ECC
+       Maximum Capacity: 1 GB
+       Error Information Handle: Not Provided
+       Number Of Devices: 1
+
+Handle 0x1100, DMI type 17, 21 bytes
+Memory Device
+       Array Handle: 0x1000
+       Error Information Handle: 0x0000
+       Total Width: 64 bits
+       Data Width: 64 bits
+       Size: 1024 MB
+       Form Factor: DIMM
+       Set: None
+       Locator: DIMM 0
+       Bank Locator: Not Specified
+       Type: RAM
+       Type Detail: None
+
+Handle 0x1300, DMI type 19, 15 bytes
+Memory Array Mapped Address
+       Starting Address: 0x00000000000
+       Ending Address: 0x0003FFFFFFF
+       Range Size: 1 GB
+       Physical Array Handle: 0x1000
+       Partition Width: 1
+
+Handle 0x1400, DMI type 20, 19 bytes
+Memory Device Mapped Address
+       Starting Address: 0x00000000000
+       Ending Address: 0x0003FFFFFFF
+       Range Size: 1 GB
+       Physical Device Handle: 0x1100
+       Memory Array Mapped Address Handle: 0x1300
+       Partition Row Position: 1
+
+Handle 0x2000, DMI type 32, 11 bytes
+System Boot Information
+       Status: No errors detected
+
+Handle 0x7F00, DMI type 127, 4 bytes
+End Of Table
+
+EOF
diff --git a/tests/kvm-explicit-cpu/sbin/id b/tests/kvm-explicit-cpu/sbin/id
new file mode 100755 (executable)
index 0000000..6c704ac
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh -
+echo 0
diff --git a/tests/kvm-explicit-cpu/sbin/virt-what-cpuid-helper b/tests/kvm-explicit-cpu/sbin/virt-what-cpuid-helper
new file mode 100755 (executable)
index 0000000..f52a9d7
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh -
+echo KVMKVMKVM
diff --git a/tests/test-kvm-explicit-cpu.sh b/tests/test-kvm-explicit-cpu.sh
new file mode 100755 (executable)
index 0000000..7482b83
--- /dev/null
@@ -0,0 +1,34 @@
+# Test for KVM with explicit -cpu core2duo option.
+# Copyright (C) 2008-2011 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+root=tests/kvm-explicit-cpu
+
+output="$(./virt-what --test-root=$root 2>&1)"
+expected="kvm"
+
+if [ "$output" != "$expected" ]; then
+    echo "$0: test failed because output did not match expected"
+    echo "Expected output was:"
+    echo "----------------------------------------"
+    echo "$expected"
+    echo "----------------------------------------"
+    echo "But the actual output of the program was:"
+    echo "----------------------------------------"
+    echo "$output"
+    echo "----------------------------------------"
+    exit 1
+fi