From bd896ece32f18778607681751627fa2d492424aa Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Wed, 13 May 2020 11:35:27 -0700 Subject: [PATCH 1/2] run timeout in the foreground so it can be killed When a kernel is hung, we currently have to wait the timeout to exit, (or ctrl+z, pkill timeout). For complicated reasons, running timeout from a shell script won't forward signals to timeout. Adding --foreground is the simplest option for this to work, via: https://unix.stackexchange.com/a/233685/388381 See other answers in that thread for *why* this is the case. --- boot-qemu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot-qemu.sh b/boot-qemu.sh index 06c6e96..6367abd 100755 --- a/boot-qemu.sh +++ b/boot-qemu.sh @@ -207,7 +207,7 @@ function setup_qemu_args() { # Invoke QEMU function invoke_qemu() { - ${INTERACTIVE} || QEMU=(timeout "${TIMEOUT:=3m}" unbuffer "${QEMU[@]}") + ${INTERACTIVE} || QEMU=(timeout --foreground "${TIMEOUT:=3m}" unbuffer "${QEMU[@]}") [[ -z ${QEMU_RAM} ]] && QEMU_RAM=512m if ${GDB:=false}; then while true; do From b316030de692369de47e6a037aceedd390aeff21 Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Wed, 13 May 2020 11:40:38 -0700 Subject: [PATCH 2/2] also, don't run qemu without a timeout when using gdb --- boot-qemu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot-qemu.sh b/boot-qemu.sh index 6367abd..d918ecf 100755 --- a/boot-qemu.sh +++ b/boot-qemu.sh @@ -207,7 +207,6 @@ function setup_qemu_args() { # Invoke QEMU function invoke_qemu() { - ${INTERACTIVE} || QEMU=(timeout --foreground "${TIMEOUT:=3m}" unbuffer "${QEMU[@]}") [[ -z ${QEMU_RAM} ]] && QEMU_RAM=512m if ${GDB:=false}; then while true; do @@ -243,6 +242,7 @@ function invoke_qemu() { done fi + ${INTERACTIVE} || QEMU=(timeout --foreground "${TIMEOUT:=3m}" unbuffer "${QEMU[@]}") set -x "${QEMU[@]}" \ "${QEMU_ARCH_ARGS[@]}" \