Re: [kvm-unit-tests PATCH v2 3/4] arm/run: introduce usingkvm var and use it

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

 



On Tue, Jul 07, 2015 at 08:03:32AM +0100, Alex Bennée wrote:
> This makes the script a little cleaner by only checking for KVM support
> in one place.
> 
> Signed-off-by: Alex Bennée <alex.bennee@xxxxxxxxxx>
> ---
>  arm/run | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/arm/run b/arm/run
> index 6b42a2e..493ce0d 100755
> --- a/arm/run
> +++ b/arm/run
> @@ -8,6 +8,16 @@ fi
>  source config.mak
>  processor="$PROCESSOR"
>  
> +# Default to using KVM if available and on the right ARM host
> +usingkvm=0

I actually prefer

usingkvm=no # or to just not declare it at all, or to do just usingkvm=

if [ should-use-kvm ]; then
	usingkvm=yes
fi

if [ "$usingkvm" = "yes" ]; then
...
fi

The reason is because '=' is a string comparison operator, so
you're using the string "0" and the string "1", but without
quotes. To use integers 0 and 1, the operator '-eq' is necessary.

Sorry, I should have mentioned that yesterday.

Thanks,
drew

> +if [ -c /dev/kvm ]; then
> +	if [ "$HOST" = "arm" ] && [ "$ARCH" = "arm" ]; then
> +		usingkvm=1
> +	elif [ "$HOST" = "aarch64" ]; then
> +		usingkvm=1
> +	fi
> +fi
> +
>  qemu="${QEMU:-qemu-system-$ARCH_NAME}"
>  qpath=$(which $qemu 2>/dev/null)
>  
> @@ -39,7 +49,7 @@ chr_testdev='-device virtio-serial-device'
>  chr_testdev+=' -device virtconsole,chardev=ctd -chardev testdev,id=ctd'
>  
>  # arm64 must use '-cpu host' with kvm
> -if [ "$(arch)" = "aarch64" ] && [ "$ARCH" = "arm64" ] && [ -c /dev/kvm ]; then
> +if [ $usingkvm = 1 ] && [ "$ARCH" = "arm64" ]; then
>  	processor="host"
>  fi
>  
> -- 
> 2.4.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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