Blob Blame History Raw
From 8bc06c4843dc0b824e211b6f9f6f358336988b64 Mon Sep 17 00:00:00 2001
From: Andrew Jones <drjones@redhat.com>
Date: Tue, 27 Oct 2015 18:16:03 +0100
Subject: [PATCH 23/27] qemu/kvm: try dmidecode on all targets

Looking at "$dmi" on targets that don't support dmidecode is
harmless. Furthermore it works, not only for arm targets, but
also pc, so move it out of the 'if arm' block.
---
 Makefile.am                                                  | 12 ++++++------
 tests/{qemu-arm-acpi => qemu-smbios}/proc/cpuinfo            |  0
 tests/{qemu-arm-acpi => qemu-smbios}/proc/self/status        |  0
 tests/{qemu-arm-acpi => qemu-smbios}/sbin/dmidecode          |  0
 tests/{qemu-arm-acpi => qemu-smbios}/sbin/uname              |  0
 .../sbin/virt-what-cpuid-helper                              |  0
 tests/{test-qemu-arm-acpi.sh => test-qemu-smbios.sh}         |  2 +-
 virt-what.in                                                 | 10 +++++-----
 8 files changed, 12 insertions(+), 12 deletions(-)
 rename tests/{qemu-arm-acpi => qemu-smbios}/proc/cpuinfo (100%)
 rename tests/{qemu-arm-acpi => qemu-smbios}/proc/self/status (100%)
 rename tests/{qemu-arm-acpi => qemu-smbios}/sbin/dmidecode (100%)
 rename tests/{qemu-arm-acpi => qemu-smbios}/sbin/uname (100%)
 rename tests/{qemu-arm-acpi => qemu-smbios}/sbin/virt-what-cpuid-helper (100%)
 rename tests/{test-qemu-arm-acpi.sh => test-qemu-smbios.sh} (98%)

diff --git a/Makefile.am b/Makefile.am
index 2c958ca..0045bcb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -53,7 +53,7 @@ TESTS = \
 	tests/test-parallels-desktop.sh \
 	tests/test-qemu.sh \
 	tests/test-qemu-arm.sh \
-	tests/test-qemu-arm-acpi.sh \
+	tests/test-qemu-smbios.sh \
 	tests/test-rhel5-xen-dom0.sh \
 	tests/test-rhel5-xen-domU-hvm.sh \
 	tests/test-rhel5-xen-domU-hvm-ia64.sh \
@@ -138,11 +138,11 @@ EXTRA_DIST = \
 	tests/qemu-arm/sbin/dmidecode \
 	tests/qemu-arm/sbin/uname \
 	tests/qemu-arm/sbin/virt-what-cpuid-helper \
-	tests/qemu-arm-acpi/proc/cpuinfo \
-	tests/qemu-arm-acpi/proc/self/status \
-	tests/qemu-arm-acpi/sbin/dmidecode \
-	tests/qemu-arm-acpi/sbin/uname \
-	tests/qemu-arm-acpi/sbin/virt-what-cpuid-helper \
+	tests/qemu-smbios/proc/cpuinfo \
+	tests/qemu-smbios/proc/self/status \
+	tests/qemu-smbios/sbin/dmidecode \
+	tests/qemu-smbios/sbin/uname \
+	tests/qemu-smbios/sbin/virt-what-cpuid-helper \
 	tests/rhel5-xen-dom0/proc/cpuinfo \
 	tests/rhel5-xen-dom0/proc/self/status \
 	tests/rhel5-xen-dom0/proc/xen/balloon \
diff --git a/tests/qemu-arm-acpi/proc/cpuinfo b/tests/qemu-smbios/proc/cpuinfo
similarity index 100%
rename from tests/qemu-arm-acpi/proc/cpuinfo
rename to tests/qemu-smbios/proc/cpuinfo
diff --git a/tests/qemu-arm-acpi/proc/self/status b/tests/qemu-smbios/proc/self/status
similarity index 100%
rename from tests/qemu-arm-acpi/proc/self/status
rename to tests/qemu-smbios/proc/self/status
diff --git a/tests/qemu-arm-acpi/sbin/dmidecode b/tests/qemu-smbios/sbin/dmidecode
similarity index 100%
rename from tests/qemu-arm-acpi/sbin/dmidecode
rename to tests/qemu-smbios/sbin/dmidecode
diff --git a/tests/qemu-arm-acpi/sbin/uname b/tests/qemu-smbios/sbin/uname
similarity index 100%
rename from tests/qemu-arm-acpi/sbin/uname
rename to tests/qemu-smbios/sbin/uname
diff --git a/tests/qemu-arm-acpi/sbin/virt-what-cpuid-helper b/tests/qemu-smbios/sbin/virt-what-cpuid-helper
similarity index 100%
rename from tests/qemu-arm-acpi/sbin/virt-what-cpuid-helper
rename to tests/qemu-smbios/sbin/virt-what-cpuid-helper
diff --git a/tests/test-qemu-arm-acpi.sh b/tests/test-qemu-smbios.sh
similarity index 98%
rename from tests/test-qemu-arm-acpi.sh
rename to tests/test-qemu-smbios.sh
index 64db9eb..114470a 100755
--- a/tests/test-qemu-arm-acpi.sh
+++ b/tests/test-qemu-smbios.sh
@@ -15,7 +15,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-root=tests/qemu-arm-acpi
+root=tests/qemu-smbios
 
 output="$(./virt-what --test-root=$root 2>&1)"
 expected="qemu"
diff --git a/virt-what.in b/virt-what.in
index 2c2e6ac..355e438 100644
--- a/virt-what.in
+++ b/virt-what.in
@@ -262,6 +262,11 @@ fi
 if ! "$skip_qemu_kvm"; then
     if [ "$cpuid" = "KVMKVMKVM" ]; then
         echo kvm
+    elif echo "$dmi" | grep -q 'Manufacturer: QEMU'; then
+        # We don't have enough information to determine if we're
+        # using KVM acceleration or not.
+        echo qemu
+        skip_lkvm=true
     elif [ "$arch" = "arm" ] || [ "$arch" = "aarch64" ]; then
         if [ -d "${root}/proc/device-tree" ] &&
             ls "${root}/proc/device-tree" | grep -q "fw-cfg"; then
@@ -269,11 +274,6 @@ if ! "$skip_qemu_kvm"; then
             # using KVM acceleration or not.
             echo qemu
             skip_lkvm=true
-        elif echo "$dmi" | grep -q 'Manufacturer: QEMU'; then
-            # We don't have enough information to determine if we're
-            # using KVM acceleration or not.
-            echo qemu
-            skip_lkvm=true
         fi
     else
         # XXX This is known to fail for qemu with the explicit -cpu
-- 
2.10.2