From 3fcd238fe849199d3aae9d5070cba3a16ddb691b Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Fri, 26 Jun 2020 22:20:38 -0700 Subject: [PATCH 1/2] qemu-check.sh: make $ROM a quoted bash array "${ROM[@]}" Removes shellcheck warning and could allow directory names with whitespace in a very distant future. Silence printf "$@" shellcheck warning in die() function. Signed-off-by: Marc Herbert --- scripts/qemu-check.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/qemu-check.sh b/scripts/qemu-check.sh index e2cfb408c452..14e6730a10ee 100755 --- a/scripts/qemu-check.sh +++ b/scripts/qemu-check.sh @@ -15,6 +15,8 @@ rm -f dump-*.txt die() { >&2 printf '%s ERROR: ' "$0" + # We want die() to be usable exactly like printf + # shellcheck disable=SC2059 >&2 printf "$@" exit 1 } @@ -145,15 +147,14 @@ do esac if $has_rom; then - ROM="-r ${SOF_BUILDS}/build_${platform}_gcc" - ROM+="/src/arch/xtensa/rom-$platform.bin" + ROM=(-r "${SOF_BUILDS}/build_${platform}_gcc/src/arch/xtensa/rom-$platform.bin") fi xtensa_host_sh=$(find_qemu_xtensa) ${xtensa_host_sh} "$PLATFORM" -k \ "${SOF_BUILDS}"/build_"${platform}"_gcc/src/arch/xtensa/"$FWNAME" \ - $ROM \ + "${ROM[@]}" \ -o 2.0 "${SOF_BUILDS}"/dump-"$platform".txt || true # timeout # dump log into sof.git incase running in docker From aaea5a7f012f44ca93863216ca5a63bcbe26183c Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Fri, 26 Jun 2020 22:24:03 -0700 Subject: [PATCH 2/2] qemu-check.sh: restore error messages when test fails Fixes 428804e1c ("scripts/qemu-check.sh: add set -e") which failed to consider the case of an empty $IPC_REG or $IPC_MSG. Signed-off-by: Marc Herbert --- scripts/qemu-check.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/qemu-check.sh b/scripts/qemu-check.sh index 14e6730a10ee..57500490fa6f 100755 --- a/scripts/qemu-check.sh +++ b/scripts/qemu-check.sh @@ -162,9 +162,12 @@ do SHM_IPC_REG_FILE=$(ls /dev/shm/ | grep -E $SHM_IPC_REG) # check if ready ipc header is in the ipc regs - IPC_REG=$(hexdump -C /dev/shm/"$SHM_IPC_REG_FILE" | grep "$READY_IPC") + IPC_REG=$(hexdump -C /dev/shm/"$SHM_IPC_REG_FILE" | + grep "$READY_IPC") || true + # check if ready ipc message is in the mbox - IPC_MSG=$(hexdump -C /dev/shm/$SHM_MBOX | grep -A 4 "$READY_MSG" | grep -A 4 "$OUTBOX_OFFSET") + IPC_MSG=$(hexdump -C /dev/shm/$SHM_MBOX | grep -A 4 "$READY_MSG" | + grep -A 4 "$OUTBOX_OFFSET") || true if [ "$IPC_REG" ]; then echo "ipc reg dump:"