Skip to content

Commit 787c763

Browse files
lgirdwoodlrgirdwo
authored andcommitted
scripts: testbench: move build output outside of source directory
Move all testbench build and test collateral outside of the SOF source directory to the workspace directory. Signed-off-by: Liam Girdwood <liam.r.girdwood@intel.com>
1 parent 540b506 commit 787c763

File tree

4 files changed

+35
-19
lines changed

4 files changed

+35
-19
lines changed

scripts/rebuild-testbench.sh

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,32 @@
55
# stop on most errors
66
set -e
77

8-
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
9-
SOF_REPO=$(dirname "$SCRIPT_DIR")
10-
TESTBENCH_DIR="$SOF_REPO"/tools/testbench
8+
# This script can be executed from the sof firmware toplevel or workspace directory
9+
# First check for the worksapce environment variable
10+
if [ -z "$SOF_WORKSPACE" ]; then
11+
# Environment variable is empty or unset so use default
12+
BASE_DIR="$HOME/work/sof"
13+
else
14+
# Environment variable exists and has a value
15+
BASE_DIR="$SOF_WORKSPACE"
16+
fi
17+
cd "$BASE_DIR"
18+
19+
# check we are in the workspace directory
20+
if [ ! -d "sof" ]; then
21+
echo "Error: can't find SOF firmware directory. Please check your installation."
22+
exit 1
23+
fi
24+
25+
TESTBENCH_DIR=$BASE_DIR/sof/tools/testbench
1126

1227
# Defaults
1328
BUILD_BACKEND='make'
1429
BUILD_TYPE=native
15-
BUILD_DIR_NAME=build_testbench
30+
BUILD_DIR_NAME=$BASE_DIR/build_testbench
1631
BUILD_TARGET=install
1732
: "${SOF_AFL:=$HOME/sof/work/AFL/afl-gcc}"
33+
SCRIPT_DIR=$BASE_DIR/sof/scripts
1834

1935
print_usage()
2036
{
@@ -59,7 +75,7 @@ setup_xtensa_tools_build()
5975
{
6076
BUILD_TYPE=xt
6177
BUILD_TARGET=
62-
BUILD_DIR_NAME=build_xt_testbench
78+
BUILD_DIR_NAME=$BASE_DIR/build_xt_testbench
6379

6480
# check needed environment variables
6581
test -n "${XTENSA_TOOLS_ROOT}" || die "XTENSA_TOOLS_ROOT need to be set.\n"
@@ -90,7 +106,7 @@ setup_xtensa_tools_build()
90106

91107
export_xtensa_setup()
92108
{
93-
export_dir=$TESTBENCH_DIR/$BUILD_DIR_NAME
109+
export_dir=$BUILD_DIR_NAME
94110
export_script=$export_dir/xtrun_env.sh
95111
xtbench=$export_dir/sof-testbench4
96112
xtbench_run="XTENSA_CORE=$XTENSA_CORE \$XTENSA_TOOLS_ROOT/$install_bin/xt-run $xtbench"
@@ -114,14 +130,14 @@ Success!
114130
115131
For temporary, interactive Kconfiguration use:
116132
117-
$BUILD_BACKEND -C $TESTBENCH_DIR/$BUILD_DIR_NAME/sof_ep/build/ menuconfig
133+
$BUILD_BACKEND -C $BUILD_DIR_NAME/sof_ep/build/ menuconfig
118134
119135
Permanent configuration is "src/arch/host/configs/library_defconfig".
120136
121137
For instant, incremental build:
122138
123139
$src_env_msg
124-
$BUILD_BACKEND -C $TESTBENCH_DIR/$BUILD_DIR_NAME/ -j$(nproc)
140+
$BUILD_BACKEND -C $BUILD_DIR_NAME/ -j$(nproc)
125141
126142
EOF0
127143

scripts/sof-testbench-build-profile.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fi
3434

3535
#set default values
3636
PLATFORM=none
37-
PDIR=$PWD/sof/tools/testbench/profile
37+
PDIR=$PWD/testbench/profile
3838

3939
while getopts "hp:d:" opt; do
4040
case "${opt}" in

scripts/sof-testbench-helper.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,14 @@ if [[ "$BITS" == "24" ]]; then
130130
else
131131
sox --encoding signed-integer "$CLIP" -L -r "$RATE_IN" -c "$CHANNELS_IN" -b "$BITS" "$INFILE1"
132132
fi
133-
134-
TB4="$PWD/sof/tools/testbench/build_testbench/install/bin/sof-testbench4"
135-
XTB4="$PWD/sof/tools/testbench/build_xt_testbench/sof-testbench4"
136-
XTB4_SETUP="$PWD/sof/tools/testbench/build_xt_testbench/xtrun_env.sh"
133+
TOOLSDIR="$PWD/build_tools/testbench"
134+
TB4="$PWD/build-testbench/install/bin/sof-testbench4"
135+
XTB4="$PWD/build-xt-testbench/sof-testbench4"
136+
XTB4_SETUP="$PWD/build-xt-testbench/xtrun_env.sh"
137137
if [ -z "$TPLG0" ]; then
138-
TPLG="$PWD/sof/tools/build_tools/topology/topology2/development/sof-hda-benchmark-${MODULE}${BITS}.tplg"
138+
TPLG="$PWD/build_tools/topology/topology2/development/sof-hda-benchmark-${MODULE}${BITS}.tplg"
139139
else
140-
TPLG="$PWD/sof/tools/build_tools/topology/topology2/$TPLG0"
140+
TPLG="$PWD/build_tools/topology/topology2/$TPLG0"
141141
fi
142142
FMT="S${BITS}_LE"
143143
OPTS="-r $RATE_IN -R $RATE_OUT -c $CHANNELS_IN -c $CHANNELS_OUT -b $FMT -p $PIPELINES -t $TPLG -i $INFILE1 -o $OUTFILE1"

tools/test/audio/comp_run.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ run_testbench ()
132132
parse_args "$@"
133133

134134
# Path to topologies
135-
TPLG_DIR=../../build_tools/test/topology
135+
TPLG_DIR=../../../../build_tools/test/topology
136136

137137
# Testbench path and executable
138138
if [[ -z $XTRUN ]]; then
139-
PATH_TESTBENCH=../../testbench/build_testbench/install/bin/$TESTBENCH
139+
PATH_TESTBENCH=../../../../build_testbench/install/bin/$TESTBENCH
140140
else
141-
BUILD_DIR=../../testbench/build_xt_testbench
141+
BUILD_DIR=../../../../build_xt_testbench
142142
PATH_TESTBENCH="$BUILD_DIR"/$TESTBENCH
143143
source "$BUILD_DIR"/xtrun_env.sh
144144
XTRUN_CMD=$XTENSA_PATH/$XTRUN
@@ -168,7 +168,7 @@ PIPELINES=
168168
[[ $DIRECTION == "playback" ]] && PIPELINES="-p 1,2"
169169
[[ $DIRECTION == "capture" ]] && PIPELINES="-p 3,4"
170170
TPLGFN=sof-hda-benchmark-${COMP}${BITS_IN}.tplg
171-
TPLG_DIR="../../build_tools/topology/topology2/development"
171+
TPLG_DIR="../../../../build_tools/topology/topology2/development"
172172
TPLG_BUILD_TIP="Please run scripts/build-tools.sh"
173173
}
174174

0 commit comments

Comments
 (0)