[PATCH kvm-unit-tests] arch-run: more qemu binary search cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We use tabs in scripts/arch-run.bash, which the import of the
function forgot to convert to.  Also, while touching all lines
to add the tabs, apply some more cleanups and simplifications.

Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx>
---
 scripts/arch-run.bash | 39 ++++++++++++++++++---------------------
 1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
index d526d98bcc40..5c10828e30f9 100644
--- a/scripts/arch-run.bash
+++ b/scripts/arch-run.bash
@@ -134,27 +134,24 @@ migration_cmd ()
 	fi
 }
 
-# qemu binary search function for all arches
 search_qemu_binary ()
 {
-    local save_path=$PATH
-    local qemucmd QEMUFOUND qemu
-    export PATH=$PATH:/usr/libexec
-    for qemucmd in ${QEMU:-qemu-system-$ARCH_NAME qemu-kvm}
-    do
-        unset QEMUFOUND
-        unset qemu
-        if ! [ -z "${QEMUFOUND=$(${qemucmd} --help 2>/dev/null  | grep "QEMU")}" ]
-        then
-            qemu="${qemucmd}"
-            break
-        fi
-    done
-
-    if [ -z "${QEMUFOUND}" ]; then
-        echo "A QEMU binary was not found, You can set a custom location by using the QEMU=<path> environment variable"
-        exit 2
-    fi
-    which $qemu
-    export PATH=$save_path
+	local save_path=$PATH
+	local qemucmd qemu
+
+	export PATH=$PATH:/usr/libexec
+	for qemucmd in ${QEMU:-qemu-system-$ARCH_NAME qemu-kvm}; do
+		if $qemucmd --help 2>/dev/null | grep -q 'QEMU'; then
+			qemu="$qemucmd"
+			break
+		fi
+	done
+
+	if [ -z "$qemu" ]; then
+		echo "A QEMU binary was not found."
+		echo "You can set a custom location by using the QEMU=<path> environment variable."
+		exit 2
+	fi
+	command -v $qemu
+	export PATH=$save_path
 }
-- 
2.9.3




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux