Tools: Test: Audio: Delete only regular files in test begin

This patch adds test for to-be-deleted trace output file or
simulation output PCM data file. Doing delete only for regular
files allows to use e.g. /dev/null to redirect trace to
be not shown when not needed. Or run test in debugger without
need for output file.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This commit is contained in:
Seppo Ingalsuo 2022-01-26 13:56:02 +02:00 committed by Liam Girdwood
parent 15bf883ead
commit 0b4a796f72
1 changed files with 9 additions and 2 deletions

View File

@ -99,10 +99,17 @@ parse_args ()
fi
}
delete_file_check ()
{
if [ -f "$1" ]; then
rm -f "$1"
fi
}
run_testbench ()
{
rm -f "$FN_OUT"
rm -f "$FN_TRACE"
delete_file_check "$FN_OUT"
delete_file_check "$FN_TRACE"
if [ -z "$FN_TRACE" ]; then
# shellcheck disable=SC2086
$VALGRIND_CMD $CMD