From 1174328929e88ccacded79e30d66bce5f233027d Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Fri, 18 Jun 2021 20:25:13 -0700 Subject: [PATCH 1/2] check-sof-logger.sh: when stderr is empty add a placeholder instead Empty tabs are confusing, especially so because there's nothing that says "stderr" in their name or anywhere. Signed-off-by: Marc Herbert --- test-case/check-sof-logger.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test-case/check-sof-logger.sh b/test-case/check-sof-logger.sh index 0ba4b428..1763707b 100755 --- a/test-case/check-sof-logger.sh +++ b/test-case/check-sof-logger.sh @@ -111,9 +111,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 +132,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: From 1398009aef8f54d2dc358b903c553b28f0de9d1a Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Fri, 18 Jun 2021 19:47:37 -0700 Subject: [PATCH 2/2] check-sof-logger: fix bug that did not kill/clean sof-logger -t Killing sudo does NOT kill the sof-logger child! Use timeout as root instead. We probably got away with it because of the various "pkill sof-logger" out there. Fixes 8732f67c9ecb ("check-sof-logger: rewrite most of it so it can actually find bugs ") Signed-off-by: Marc Herbert --- test-case/check-sof-logger.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/test-case/check-sof-logger.sh b/test-case/check-sof-logger.sh index 1763707b..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 }