diff mbox

[kvm-unit-tests,6/7] arm/run: introduce basic option parsing

Message ID 1435931327-8073-7-git-send-email-alex.bennee@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Bennée July 3, 2015, 1:48 p.m. UTC
So far this simple option parsing loop allows us to --force-tcg even
when running on ARM hardware.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 arm/run | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Andrew Jones July 6, 2015, 1:22 p.m. UTC | #1
On Fri, Jul 03, 2015 at 02:48:46PM +0100, Alex Bennée wrote:
> So far this simple option parsing loop allows us to --force-tcg even
> when running on ARM hardware.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  arm/run | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/arm/run b/arm/run
> index a3a33b3..43d7508 100755
> --- a/arm/run
> +++ b/arm/run
> @@ -18,6 +18,23 @@ if [ -c /dev/kvm ]; then
>  	fi
>  fi
>  
> +while :; do
> +	case $1 in
> +		--force-tcg)
> +			usingkvm=0
> +			shift
> +			;;
> +		--)
> +			# End of all options.
> +			shift
> +			break
> +			;;
> +		*)
> +			break
> +			;;
> +	esac
> +done
> +
>  qemu="${QEMU:-qemu-system-$ARCH_NAME}"
>  qpath=$(which $qemu 2>/dev/null)

I don't think we need this. If we eventually do, then I think it should
be in a common location sharable by all architectures, and also
run_tests.sh should be taught how to pass options through. For this use
though, Paolo's suggestion should be good enough. That is to do

arm/run arm/some-test.flat -machine accel=tcg

IIUC, since this -machine option will come later on the command line
than the one in arm/run, then it will override whatever we've already
done there. It doesn't look like we need to specify virt again though,
so it must add to what we have, and only override the earlier specified
option with what we specify later. The qemu command line is a
complicated animal...

Thanks,
drew
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arm/run b/arm/run
index a3a33b3..43d7508 100755
--- a/arm/run
+++ b/arm/run
@@ -18,6 +18,23 @@  if [ -c /dev/kvm ]; then
 	fi
 fi
 
+while :; do
+	case $1 in
+		--force-tcg)
+			usingkvm=0
+			shift
+			;;
+		--)
+			# End of all options.
+			shift
+			break
+			;;
+		*)
+			break
+			;;
+	esac
+done
+
 qemu="${QEMU:-qemu-system-$ARCH_NAME}"
 qpath=$(which $qemu 2>/dev/null)