runtime: better handling of QEMU aborts
PATCH 1/1 runtime: better handling of QEMU aborts
Add two changes to run_qemu. The first saves/restores terminal settings. This solves an annoying loss of terminal echo when QEMU aborts during a test run. The second ensures we see a message about the abort, because the "Aborted (core dumped)" message we should see gets eaten.
Note, the first change is necessary because QEMU modifies the terminal settings when using '-serial stdio', but calling abort() invokes exit without first calling qemu_chr_free(serial_hds[0]) to restore them.
--- scripts/arch-run.bash | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
scripts/arch-run.bash +7 -1
@@ -26,13 +26,19 @@ ############################################################################## run_qemu () { - local stdout errors ret sig + local stdout errors ret sig tty # stdout to {stdout}, stderr to $errors + tty=$(stty -g) exec {stdout}>&1 errors=$("${@}" 2>&1 1>&${stdout}) ret=$? exec {stdout}>&- + stty "$tty" + + if [ $ret -eq 134 ]; then + errors=$(printf "%s\n" "$errors"; echo "QEMU Aborted") + fi if [ "$errors" ]; then printf "%s\n" "$errors" >&2
Signature · 1 line
2.7.4
Quoted 26 lines · Andrew Jones
Add two changes to
run_qemu. The first saves/restores terminal settings. This solves an annoying loss of terminal echo when QEMU aborts during a test run. The second ensures we see a message about the abort, because the "Aborted (core dumped)" message we should see gets eaten.Note, the first change is necessary because QEMU modifies the terminal settings when using '-serial stdio', but calling
abort()invokes exit without first callingqemu_chr_free(serial_hds[0])to restore them.Reported-by Peter Maydell <[email protected]>Signed-off-by Andrew Jones <[email protected]>--- scripts/arch-run.bash | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)scripts/arch-run.bash +1
-1@@ -26,13 +26,19 @@ ############################################################################## run_qemu () { - local stdout errors ret sig + local stdout errors ret sig tty
scripts/arch-run.bash line 40
Quoted 10 lines
scripts/arch-run.bash +5
-0# stdout to {stdout}, stderr to $errors + tty=$(stty -g) exec {stdout}>&1 errors=$("${@}" 2>&1 1>&${stdout}) ret=$? exec {stdout}>&- + stty "$tty" + + if [ $ret -eq 134 ]; then + errors=$(printf "%s\n" "$errors"; echo "QEMU Aborted")
Doh, this prints an empty line when errors is empty. Anyway, Radim just reminded me that code here has changed with some in-flight patch. I'll rebase on that when it lands.
Quoted 11 lines
scripts/arch-run.bash +1
-0+ fi if [ "$errors" ]; then printf "%s\n" "$errors" >&2Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html