Skip to content

Commit b4af9d9

Browse files
singalsukv2019i
authored andcommitted
Tools: Test: Changes for process_test.m run with xt-xcc
This patch adds to process_test() sixth argument to run the tests with xt-run environment with argument set to 'xt-run' or 'xt-run --turbo'. The set and print of LD_LIBRARY_PATH is no more needed with static testbench version. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 10d0b3b commit b4af9d9

3 files changed

Lines changed: 59 additions & 17 deletions

File tree

tools/test/audio/comp_run.sh

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ FS_OUT=48000
2727
FN_IN=input.raw
2828
FN_OUT=output.raw
2929
FN_TRACE:=trace.txt # This is default value if FN_TRACE is not set via -e option
30-
VALGRIND=yes
30+
VALGRIND=true
31+
XTRUN=
3132
EOFHELP
3233
}
3334

@@ -42,10 +43,11 @@ parse_args ()
4243
FS_IN=48000
4344
FS_OUT=
4445
VALGRIND=true
45-
DEBUG=
46+
DEBUG=-q
4647
SOURCED_CONFIG=false
4748
FN_TRACE=
4849
EXTRA_OPTS=
50+
XTRUN=
4951

5052
while getopts ":he:t:" opt; do
5153
case "${opt}" in
@@ -121,18 +123,42 @@ run_testbench ()
121123

122124
parse_args "$@"
123125

124-
# Paths
125-
HOST_ROOT=../../testbench/build_testbench
126-
HOST_EXE=$HOST_ROOT/install/bin/testbench
127-
HOST_LIB=$HOST_ROOT/sof_ep/install/lib
128-
TPLG_LIB=$HOST_ROOT/sof_parser/install/lib
126+
# Path to topologies
129127
TPLG_DIR=../../build_tools/test/topology
130128

129+
# Testbench path and executable
130+
if [[ -z $XTRUN ]]; then
131+
TESTBENCH=../../testbench/build_testbench/install/bin/testbench
132+
else
133+
BUILD_DIR=../../testbench/build_xt_testbench
134+
TESTBENCH="$BUILD_DIR"/testbench
135+
source "$BUILD_DIR"/xtrun_env.sh
136+
XTRUN_CMD=$XTENSA_PATH/$XTRUN
137+
if $VALGRIND; then
138+
>&2 printf "WARNING: Ignoring VALGRIND with xt-run\n"
139+
VALGRIND=false
140+
fi
141+
fi
142+
143+
if $VALGRIND; then
144+
VALGRIND_CMD="valgrind --leak-check=yes --error-exitcode=1"
145+
else
146+
VALGRIND_CMD=
147+
fi
148+
149+
HOST_EXE="$XTRUN_CMD $TESTBENCH"
150+
131151
# Use topology from component test topologies
132152
INFMT=s${BITS_IN}le
133153
OUTFMT=s${BITS_OUT}le
134154
TPLGFN=test-${DIRECTION}-ssp5-mclk-0-I2S-${COMP}-${INFMT}-${OUTFMT}-48k-24576k-codec.tplg
135155
TPLG=${TPLG_DIR}/${TPLGFN}
156+
[ -f "$TPLG" ] || {
157+
echo
158+
echo "Error: topology $TPLG does not exist."
159+
echo "Please run scripts/build-tools.sh -t"
160+
exit 1
161+
}
136162

137163
# If binary test vectors
138164
if [ "${FN_IN: -4}" == ".raw" ]; then
@@ -146,17 +172,9 @@ OPTS="$DEBUG -r $FS_IN -R $FS_OUT -c $CHANNELS_IN -n $CHANNELS_OUT $BINFMT -t $T
146172
DATA="-i $FN_IN -o $FN_OUT"
147173
ARG="$OPTS $EXTRA_OPTS $DATA"
148174
CMD="$HOST_EXE $ARG"
149-
if "$VALGRIND"; then
150-
VALGRIND_CMD="valgrind --leak-check=yes --error-exitcode=1"
151-
else
152-
VALGRIND_CMD=
153-
fi
154-
155-
export LD_LIBRARY_PATH=$HOST_LIB:$TPLG_LIB
156175

157176
# Run test bench
158177
echo "Command: $HOST_EXE"
159178
echo "Argument: $ARG"
160-
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"
161179

162180
run_testbench

tools/test/audio/process_test.m

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
% process_test - test objective audio quality parameters
22
%
3-
% process_test(comp, bits_in_list, bits_out_list, fs)
3+
% process_test(comp, bits_in_list, bits_out_list, fs, fulltest, xtrun)
4+
%
5+
% Inputs
6+
% comp - component to test
7+
% bits_in_list - input word lengths
8+
% bits_out_list - output workd lengths
9+
% fs - sample rate
10+
% fulltest - 0 perform only chirp test, 1 perform all
11+
% xtrun - set to 'xt-run' or 'xt-run --turbo' to test with xt-testbench
12+
%
13+
% E.g.
14+
% process_test('eq-iir', 32, 32, 48000, 0, 'xt-run --turbo');
15+
% process_test('eq-iir', 32, 32);
416

517
% SPDX-License-Identifier: BSD-3-Clause
618
% Copyright(c) 2017-2022 Intel Corporation. All rights reserved.
719
% Author: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
820

9-
function [n_fail, n_pass, n_na] = process_test(comp, bits_in_list, bits_out_list, fs, fulltest)
21+
function [n_fail, n_pass, n_na] = process_test(comp, bits_in_list, bits_out_list, fs, fulltest, xtrun)
1022
%% Defaults for call parameters
1123
if nargin < 1
1224
comp = 'EQIIR';
@@ -28,6 +40,10 @@
2840
fulltest = 1;
2941
end
3042

43+
if nargin < 6
44+
xtrun = '';
45+
end
46+
3147
%% Paths
3248
t.blobpath = '../../topology/topology1/m4';
3349
plots = 'plots';
@@ -44,6 +60,7 @@
4460
t.bits_in = bits_in_list; % Input word length from func arguments
4561
t.bits_out = bits_out_list; % Output word length from func arguments
4662
t.full_test = fulltest; % 0 is quick check only, 1 is full test
63+
t.xtrun = xtrun;
4764

4865
%% Show graphics or not. With visible plot windows Octave may freeze if too
4966
% many windows are kept open. As workaround setting close windows to
@@ -335,6 +352,7 @@
335352
test.ch = t.ch;
336353
test.fs = t.fs;
337354
test.plot_visible = t.plot_visible;
355+
test.xtrun = t.xtrun;
338356

339357
% Misc
340358
test.quick = 0;

tools/test/audio/test_utils/test_run.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@
8686
fprintf(fh, 'FN_TRACE=\"/dev/null"\n');
8787
end
8888

89+
if isfield(test, 'xtrun')
90+
fprintf(fh, 'XTRUN=\"%s\"\n', test.xtrun);
91+
else
92+
fprintf(fh, 'XTRUN=\n');
93+
end
94+
8995
% Override defaults in comp_run.sh
9096
fprintf(fh, 'VALGRIND=false\n');
9197
fclose(fh);

0 commit comments

Comments
 (0)