From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: [kvm-unit-tests PATCH] runtime: better handling of QEMU aborts Date: Tue, 15 Nov 2016 15:28:43 +0100 Message-ID: <1479220123-25984-1-git-send-email-drjones@redhat.com> Cc: rkrcmar@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:52316 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936467AbcKOO2r (ORCPT ); Tue, 15 Nov 2016 09:28:47 -0500 Sender: kvm-owner@vger.kernel.org List-ID: 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. Reported-by: Peter Maydell Signed-off-by: Andrew Jones --- scripts/arch-run.bash | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash index 8e75c6ed6e17..2b288205ab55 100644 --- a/scripts/arch-run.bash +++ b/scripts/arch-run.bash @@ -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 -- 2.7.4