Skip to content

Commit 982f92d

Browse files
committed
lib.sh: disable logging with SOF_LOGGING=none env or missing .ldc
Some configurations don't support the logger. Others do but do not want to run it for various reasons. Supersedes #811, see earlier discussions there. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
1 parent 0a464ff commit 982f92d

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

case-lib/lib.sh

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ fake_kern_error()
7979

8080
}
8181

82+
# Prints the .ldc file found on stdout, errors on stderr.
8283
find_ldc_file()
8384
{
8485
local ldcFile
@@ -87,6 +88,7 @@ find_ldc_file()
8788
# and then on the standard location.
8889
if [ -n "$SOFLDC" ]; then
8990
ldcFile="$SOFLDC"
91+
>&2 dlogi "SOFLDC=${SOFLDC} overriding default locations"
9092
else
9193
local platf; platf=$(sof-dump-status.py -p) || {
9294
>&2 dloge "Failed to query platform with sof-dump-status.py"
@@ -98,7 +100,7 @@ find_ldc_file()
98100
fi
99101

100102
[[ -e "$ldcFile" ]] || {
101-
>&2 dloge "LDC file $ldcFile not found, check the SOFLDC environment variable or copy your sof-*.ldc to /etc/sof"
103+
>&2 dlogi "LDC file $ldcFile not found"
102104
return 1
103105
}
104106
printf '%s' "$ldcFile"
@@ -397,7 +399,27 @@ is_zephyr()
397399

398400
logger_disabled()
399401
{
400-
[[ ${OPT_VAL['s']} -eq 0 ]]
402+
local ldcFile
403+
# Some firmware/OS configurations do not support logging.
404+
ldcFile=$(find_ldc_file) || {
405+
dlogi '.ldc dictionary file not found, SOF logs collection disabled'
406+
return 0 # 0 is 'true'
407+
}
408+
409+
# Disable logging when available...
410+
if [ ${OPT_VAL['s']} -eq 0 ]; then
411+
return 0
412+
fi
413+
414+
# ... across all tests at once.
415+
# In the future we should support SOF_LOGGING=etrace (only), see
416+
# sof-test#726
417+
if [ "x$SOF_LOGGING" == 'xnone' ]; then
418+
dlogi 'SOF logs collection globally disabled by SOF_LOGGING=none'
419+
return 0
420+
fi
421+
422+
return 1
401423
}
402424

403425
print_module_params()

0 commit comments

Comments
 (0)