Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions case-lib/hijack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ function func_exit_handler()
{
local exit_status=${1:-0}

dlogi "Starting func_exit_handler($exit_status)"

# call trace
if [ "$exit_status" -ne 0 ] ; then
dloge "Starting ${FUNCNAME[0]}(), exit status=$exit_status, FUNCNAME stack:"
Expand Down Expand Up @@ -86,22 +88,6 @@ function func_exit_handler()
exit_status=1
fi

if test -e "$logfile"; then

wcLog=$(wc -l "$logfile") # show both line count and filename
dlogi "nlines=$wcLog"

local nlines; nlines=$(wc -l < "$logfile") # line count only
# The first line is the sof-logger header
if [ "$nlines" -le 1 ]; then
dloge "Empty logger trace"
exit_status=1
fi
else
dloge "Log file not found: $logfile"
exit_status=1
fi

fi

if [ "$SOF_LOGGING" != 'none' ] && is_ipc4 && is_firmware_file_zephyr; then
Expand All @@ -113,6 +99,24 @@ function func_exit_handler()
}
fi

# Check $logfile when there is one
if [ -n "$logfile" ]; then
if test -e "$logfile"; then
wcLog=$(wc -l "$logfile") # show both line count and filename
dlogi "nlines=$wcLog"

local nlines; nlines=$(wc -l < "$logfile") # line count only
# The first line is the sof-logger banner
if [ "$nlines" -le 1 ]; then
dloge "Empty logfile"
exit_status=1
fi
else
dloge "Log file not found: $logfile"
exit_status=1
fi
fi

stop_test || exit_status=1

if [ "$ENABLE_STORAGE_CHECKS" = '1' ]; then
Expand Down
13 changes: 7 additions & 6 deletions case-lib/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ find_ldc_file()

func_mtrace_collect()
{
local clogfile=$LOG_ROOT/mtrace.txt
local clogfile="$1"

if [ -z "$MTRACE" ]; then
MTRACE=$(command -v mtrace-reader.py) || {
Expand All @@ -330,8 +330,8 @@ func_mtrace_collect()
}
fi

local mtraceCmd="$MTRACE"
dlogi "Starting ${mtraceCmd[*]}"
local mtraceCmd=("$MTRACE")
dlogi "Starting ${mtraceCmd[*]} >& $clogfile &"
# Cleaned up by func_exit_handler() in hijack.sh
# shellcheck disable=SC2024
sudo "${mtraceCmd[@]}" >& "$clogfile" &
Expand All @@ -358,7 +358,7 @@ func_sof_logger_collect()
# The logger does not like empty '' arguments and $logopt can be
# shellcheck disable=SC2206
local loggerCmd=("$SOFLOGGER" $logopt -l "$ldcFile")
dlogi "Starting ${loggerCmd[*]}"
dlogi "Starting ${loggerCmd[*]} > $logfile &"
# Cleaned up by func_exit_handler() in hijack.sh
# shellcheck disable=SC2024
sudo "${loggerCmd[@]}" > "$logfile" &
Expand Down Expand Up @@ -398,7 +398,8 @@ func_lib_start_log_collect()

if [ "X$is_etrace" == "X0" ]; then
if is_ipc4 && is_firmware_file_zephyr; then
func_mtrace_collect
logfile="$LOG_ROOT"/mtrace.txt
func_mtrace_collect "$logfile"
else
log_file=$LOG_ROOT/slogger.txt
log_opt="-t"
Expand All @@ -416,7 +417,7 @@ func_lib_start_log_collect()

}

check_error_in_file()
check_error_in_fw_logfile()
{
local platf; platf=$(sof-dump-status.py -p)

Expand Down
2 changes: 1 addition & 1 deletion test-case/check-sof-logger.sh
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ main()

for f in "${stdout_files[@]}"; do
local tracef="$LOG_ROOT/logger.$f.txt"
check_error_in_file "$tracef" || {
check_error_in_fw_logfile "$tracef" || {
OK=false; printf '\n'
}
done
Expand Down