Skip to content

Commit

Permalink
check-sof-logger: catch ERROR in firmware traces and fail
Browse files Browse the repository at this point in the history
Add function find_logger_error() in case-lib so it can re-used by other
tests later.

Signed-off-by: Marc Herbert <[email protected]>
  • Loading branch information
marc-hb committed May 26, 2022
1 parent 6a91a64 commit 31640e2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
14 changes: 14 additions & 0 deletions case-lib/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,20 @@ find_ldc_file()
printf '%s' "$ldcFile"
}

# -B 2 shows the header line when the first etrace message is an ERROR
# -A 1 shows whether the ERROR is last or not.
check_logger_error()
{
test -r "$1" || {
dloge "logfile NOT FOUND: '$1'"
return 1
}

if grep -B 2 -A 1 -E '[[:blank:]]ERRO?R?[[:blank:]]' "$1"; then
return 1
fi
}

SOF_LOG_COLLECT=0
# This function starts a logger in the background using '&'
#
Expand Down
26 changes: 25 additions & 1 deletion test-case/check-sof-logger.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ run_loggers()

if is_zephyr; then
dlogi "Skipping etrace for now because it's totally different with Zephyr"
sudo touch "$etrace_stderr_file" "$etrace_file"
return 0
fi

Expand Down Expand Up @@ -224,8 +225,31 @@ main()
}
done

local platf; platf=$(sof-dump-status.py -p)
local ERROR_scan=true
local OK=true

case "$platf" in
byt|bdw)
dlogw 'not looking for ERROR on BYT/BDW because of known DMA issues #4333 and others'
ERROR_scan=false
;;
esac

if $ERROR_scan; then
for f in "${stdout_files[@]}"; do
local tracef="$LOG_ROOT/logger.$f.txt"
check_logger_error "$tracef" || {
OK=false; printf '\n'
}
done; fi

# Show all outputs even when everything went OK
print_logs_exit 0
if $OK; then
print_logs_exit 0
else
print_logs_exit 1 "^^ ERROR(s) found in firmware logs ^^"
fi
}

main "$@"

0 comments on commit 31640e2

Please sign in to comment.