diff --git a/test-case/check-sof-logger.sh b/test-case/check-sof-logger.sh index 0ba4b428..473a5e2f 100755 --- a/test-case/check-sof-logger.sh +++ b/test-case/check-sof-logger.sh @@ -71,16 +71,21 @@ func_lib_check_sudo run_loggers() { - local loggerPID etrace_exit + local etrace_exit + + # This test is not really supposed to run while the DSP is busy at + # the same time, so $data_file will hopefully not be long. + local dma_collect_secs=2 dlogi "Trying to get the DMA trace log with background sof-logger ..." dlogc \ "sudo $loggerBin -t -f 3 -l $ldcFile -o $data_file 2> $error_file &" - sudo "$loggerBin" -t -f 3 -l "$ldcFile" -o "$data_file" 2> "$error_file" & loggerPID=$! + sudo timeout -k 3 --preserve-status "$dma_collect_secs" \ + "$loggerBin" -t -f 3 -l "$ldcFile" \ + -o "$data_file" 2> "$error_file" & dmaPID=$! - # This test is not really supposed to run while the DSP is busy at - # the same time, so $data_file should be short enough. - sleep 2 + sleep "$dma_collect_secs" + wait "$dmaPID" dlogi "Trying to get the etrace mailbox ..." dlogc \ @@ -90,9 +95,6 @@ run_loggers() printf '\n' - dlogc "kill $loggerPID # DMA trace" - kill "$loggerPID" - return $etrace_exit } @@ -111,9 +113,9 @@ print_logs_exit() for ftype in data etrace error etrace_stderr; do printf '\n\n' bname="logger.$ftype.txt" - dlogi "Log $ftype BEG::" + dlogi "Log file $bname BEG::" cat "$LOG_ROOT/$bname" || true # we already checked these - dlogi "::END $ftype" + dlogi "::END log file $bname" done test -z "$errmsg" || dloge "$errmsg" exit "$exit_code" @@ -132,6 +134,8 @@ main() if test -s "$stderr_file"; then print_logs_exit 1 "stderr $stderr_file is not empty" fi + printf 'GOOD: %s was empty, no stderr output from that sof-logger instance\n' \ + logger."$f".txt > "$stderr_file" done # Search for the log header, should be something like this: