x86-run: Print a meaningful message if the qemu binary isn't found
PATCH 1/1 x86-run: Print a meaningful message if the qemu binary isn't found
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
--- x86/run | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-)
x86/run +26 -11
@@ -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
Signature · 1 line
2.1.0
Quoted 57 lines · Bandan Das
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 variableSigned-off-by Bandan Das <[email protected]>--- x86/run | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-)x86/run +19
-11@@ -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}" ]
x86/run line 35
Quoted 10 lines
x86/run +7
-0+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
Paolo Bonzini
maintainerQuoted 6 lines · Paolo Bonzini
Quoted 5 lines · Bandan Das
Before:
./x86-run ./x86/msr.flat
QEMU binary has no support for test device. Exiting.
Quoted 6 lines
Quoted 6 lines
After:
./x86-run ./x86/msr.flat
A QEMU binary was not found, You can set a custom location by using the QEMU=<path> environment variableSigned-off-by Bandan Das <[email protected]>
This breaks "QEMU=... ./x86-run ./x86/msr.flat"
Fixed as follows:
x86/run +9 -10
@@ -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
Paolo Bonzini <[email protected]> writes:
...
Quoted 19 lines
This breaks "QEMU=... ./x86-run ./x86/msr.flat"
Fixed as follows:
x86/run +0
-7@@ -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}" ]
x86/run else · line 29
Quoted 10 lines
x86/run +7
-3-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 -
x86/run +1 -0
@@ -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
Quoted 8 lines
x86/run +2
-0+ exit ${TESTDEVNOTSUPP} + fi fi ifwhich apart from reindentation is just moving a "fi" down. Paolo
Bandan Das <[email protected]> writes:
...
x86/run qemusystem="${QEMU:-qemu-system-x86_64}" · line 12
Quoted 11 lines
I think we still want to print this if the user supplied qemu has no test device support. I think this is better -
x86/run +1
-0@@ -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
Quoted 11 lines
x86/run +0
-0for qemucmds in ${qemukvm} ${qemusystem} doQuoted 9 lines
(quoted diff) +2
-0+ exit ${TESTDEVNOTSUPP} + fi fi ifwhich apart from reindentation is just moving a "fi" down. Paolo
Paolo Bonzini
maintainerQuoted 26 lines · Bandan Das
Paolo Bonzini <[email protected]> writes:
...Quoted 24 lines
This breaks "QEMU=... ./x86-run ./x86/msr.flat"
Fixed as follows:
x86/run +2
-10@@ -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
Quoted 8 lines
x86/run else · line 29
Quoted 5 lines
x86/run +5
-0+ 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