* [PATCH] x86-run: Print a meaningful message if the qemu binary isn't found
@ 2015-04-01 21:12 Bandan Das
2015-04-02 12:47 ` Paolo Bonzini
0 siblings, 1 reply; 6+ messages in thread
From: Bandan Das @ 2015-04-01 21:12 UTC (permalink / raw)
To: kvm; +Cc: Paolo Bonzini, Marcelo Tosatti
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
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] x86-run: Print a meaningful message if the qemu binary isn't found
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
2015-04-09 16:44 ` Paolo Bonzini
0 siblings, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2015-04-02 12:47 UTC (permalink / raw)
To: Bandan Das, kvm; +Cc: Marcelo Tosatti
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86-run: Print a meaningful message if the qemu binary isn't found
2015-04-02 12:47 ` Paolo Bonzini
@ 2015-04-09 16:44 ` Paolo Bonzini
2015-04-09 17:14 ` Bandan Das
0 siblings, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2015-04-09 16:44 UTC (permalink / raw)
To: Bandan Das, kvm; +Cc: Marcelo Tosatti
On 02/04/2015 14:47, Paolo Bonzini wrote:
> 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>
This breaks "QEMU=... ./x86-run ./x86/msr.flat"
Fixed as follows:
diff --git a/x86/run b/x86/run
index d5adf8d..219a93b 100755
--- a/x86/run
+++ b/x86/run
@@ -20,16 +20,15 @@ else
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}
+ 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
fi
if
which apart from reindentation is just moving a "fi" down.
Paolo
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] x86-run: Print a meaningful message if the qemu binary isn't found
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
0 siblings, 2 replies; 6+ messages in thread
From: Bandan Das @ 2015-04-09 17:14 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, Marcelo Tosatti
Paolo Bonzini <pbonzini@redhat.com> writes:
...
> This breaks "QEMU=... ./x86-run ./x86/msr.flat"
>
> Fixed as follows:
>
> diff --git a/x86/run b/x86/run
> index d5adf8d..219a93b 100755
> --- a/x86/run
> +++ b/x86/run
> @@ -20,16 +20,15 @@ else
> 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}
> + 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"
I think we still want to print this if the user supplied qemu has no test
device support. I think this is better -
--- a/x86/run
+++ b/x86/run
@@ -8,6 +8,7 @@ qemusystem="${QEMU:-qemu-system-x86_64}"
if ! [ -z "${QEMU}" ]
then
qemu="${QEMU}"
+ QEMUFOUND=1
else
for qemucmds in ${qemukvm} ${qemusystem}
do
> + exit ${TESTDEVNOTSUPP}
> + fi
> fi
>
> if
>
> which apart from reindentation is just moving a "fi" down.
> Paolo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86-run: Print a meaningful message if the qemu binary isn't found
2015-04-09 17:14 ` Bandan Das
@ 2015-04-09 17:17 ` Paolo Bonzini
2015-04-09 17:20 ` Bandan Das
1 sibling, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2015-04-09 17:17 UTC (permalink / raw)
To: Bandan Das; +Cc: kvm, Marcelo Tosatti
On 09/04/2015 19:14, Bandan Das wrote:
> Paolo Bonzini <pbonzini@redhat.com> writes:
> ...
>> This breaks "QEMU=... ./x86-run ./x86/msr.flat"
>>
>> Fixed as follows:
>>
>> diff --git a/x86/run b/x86/run
>> index d5adf8d..219a93b 100755
>> --- a/x86/run
>> +++ b/x86/run
>> @@ -20,16 +20,15 @@ else
>> 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}
>> + 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"
>
> I think we still want to print this if the user supplied qemu has no test
> device support.
Yes, but we do not go through the "for" in that case...
Can you make a patch on top of master?
Paolo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86-run: Print a meaningful message if the qemu binary isn't found
2015-04-09 17:14 ` Bandan Das
2015-04-09 17:17 ` Paolo Bonzini
@ 2015-04-09 17:20 ` Bandan Das
1 sibling, 0 replies; 6+ messages in thread
From: Bandan Das @ 2015-04-09 17:20 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, Marcelo Tosatti
Bandan Das <bsd@redhat.com> writes:
...
>
> I think we still want to print this if the user supplied qemu has no test
> device support. I think this is better -
> --- a/x86/run
> +++ b/x86/run
> @@ -8,6 +8,7 @@ qemusystem="${QEMU:-qemu-system-x86_64}"
> if ! [ -z "${QEMU}" ]
> then
> qemu="${QEMU}"
> + QEMUFOUND=1
> else
Damn, please ignore the previous message. This does nothing and I
need more sleep.
Bandan
> for qemucmds in ${qemukvm} ${qemusystem}
> do
>
>> + exit ${TESTDEVNOTSUPP}
>> + fi
>> fi
>>
>> if
>>
>> which apart from reindentation is just moving a "fi" down.
>> Paolo
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-04-09 17:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.