From: Paolo Bonzini <pbonzini@redhat.com>
To: Bandan Das <bsd@redhat.com>, kvm@vger.kernel.org
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: [PATCH] x86-run: Print a meaningful message if the qemu binary isn't found
Date: Thu, 02 Apr 2015 14:47:03 +0200 [thread overview]
Message-ID: <551D3A47.1030404@redhat.com> (raw)
In-Reply-To: <jpg384j1rkm.fsf@redhat.com>
On 01/04/2015 23:12, Bandan Das wrote:
>
> Before:
> ./x86-run ./x86/msr.flat
> QEMU binary has no support for test device. Exiting.
>
> After:
> ./x86-run ./x86/msr.flat
> A QEMU binary was not found, You can set a custom
> location by using the QEMU=<path> environment variable
>
> Signed-off-by: Bandan Das <bsd@redhat.com>
> ---
> x86/run | 37 ++++++++++++++++++++++++++-----------
> 1 file changed, 26 insertions(+), 11 deletions(-)
>
> diff --git a/x86/run b/x86/run
> index af37eb4..d5adf8d 100755
> --- a/x86/run
> +++ b/x86/run
> @@ -1,20 +1,35 @@
> #!/bin/bash
> +NOTFOUND=1
> +TESTDEVNOTSUPP=2
>
> qemukvm="${QEMU:-qemu-kvm}"
> qemusystem="${QEMU:-qemu-system-x86_64}"
> -if
> - ${qemukvm} -device '?' 2>&1 | grep -F -e \"testdev\" -e \"pc-testdev\" > /dev/null;
> +
> +if ! [ -z "${QEMU}" ]
> then
> - qemu="${qemukvm}"
> + qemu="${QEMU}"
> else
> - if
> - ${qemusystem} -device '?' 2>&1 | grep -F -e \"testdev\" -e \"pc-testdev\" > /dev/null;
> - then
> - qemu="${qemusystem}"
> - else
> - echo QEMU binary ${QEMU} has no support for test device. Exiting.
> - exit 2
> - fi
> + for qemucmds in ${qemukvm} ${qemusystem}
> + do
> + unset QEMUFOUND
> + unset qemu
> + if ! [ -z "${QEMUFOUND=$(${qemucmds} --help 2>/dev/null | grep "QEMU")}" ] &&
> + ${qemucmds} -device '?' 2>&1 | grep -F -e \"testdev\" -e \"pc-testdev\" > /dev/null;
> + then
> + qemu="${qemucmds}"
> + break
> + fi
> + done
> +fi
> +
> +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 ${NOTFOUND}
> +elif [ -z "${qemu}" ]
> +then
> + echo "No Qemu test device support found"
> + exit ${TESTDEVNOTSUPP}
> fi
>
> if
>
Thanks, applied.
Paolo
next prev parent reply other threads:[~2015-04-02 12:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-01 21:12 [PATCH] x86-run: Print a meaningful message if the qemu binary isn't found Bandan Das
2015-04-02 12:47 ` Paolo Bonzini [this message]
2015-04-09 16:44 ` Paolo Bonzini
2015-04-09 17:14 ` Bandan Das
2015-04-09 17:17 ` Paolo Bonzini
2015-04-09 17:20 ` Bandan Das
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=551D3A47.1030404@redhat.com \
--to=pbonzini@redhat.com \
--cc=bsd@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox