From 28e1868401f92427d71ed6b3e9d8ad2850ea7160 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Fri, 5 Apr 2024 13:56:21 -0700 Subject: [PATCH] lib.sh: install func_exit_handler() from start_test() func_exit_handler() makes sense only when used with start_test() start_test() is a "mandatory" right now because it's invoked from lib.sh. But this is wrong because it should be possible to import lib.sh functions without actually running anything and it's causing various issues like sof_remove.sh depending on the firmware being loaded, see discussion in #1169 This commit will make it possible NOT to use start_test(). Signed-off-by: Marc Herbert --- case-lib/hijack.sh | 1 - case-lib/lib.sh | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/case-lib/hijack.sh b/case-lib/hijack.sh index b8f43c1a..a489f982 100644 --- a/case-lib/hijack.sh +++ b/case-lib/hijack.sh @@ -2,7 +2,6 @@ SUDO_CMD=$(command -v sudo) -trap 'func_exit_handler $?' EXIT # Overwrite other functions' exit to perform environment cleanup function func_exit_handler() { diff --git a/case-lib/lib.sh b/case-lib/lib.sh index d80a9be8..1d9284ab 100644 --- a/case-lib/lib.sh +++ b/case-lib/lib.sh @@ -77,6 +77,9 @@ start_test() return 0 } + # func_exit_handler() is in hijack.sh + trap 'func_exit_handler $?' EXIT + if test -z "$MAX_WAIT_FW_LOADING"; then local _pltf; _pltf=$("$SCRIPT_HOME/tools/sof-dump-status.py" -p) case "$_pltf" in