Skip to content

Commit

Permalink
scripts: testbench: move build output outside of source directory
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
lgirdwood authored and lrgirdwo committed Mar 5, 2025
1 parent 8a5b40e commit feded0f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
27 changes: 19 additions & 8 deletions scripts/rebuild-testbench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,27 @@
# stop on most errors
set -e

SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
SOF_REPO=$(dirname "$SCRIPT_DIR")
TESTBENCH_DIR="$SOF_REPO"/tools/testbench
# check if we are in the sof FW directory
if [ -f "Kconfig.sof" ]; then
# now go to parent sof workspace directory
cd ..
fi

# check we are in the workspace directory
if [ ! -d "sof" ]; then
echo "Error: This script must be run from the sof firmware toplevel or workspace directory"
exit 1
fi

TESTBENCH_DIR=$PWD/sof/tools/testbench

# Defaults
BUILD_BACKEND='make'
BUILD_TYPE=native
BUILD_DIR_NAME=build_testbench
BUILD_DIR_NAME=$PWD/build_testbench
BUILD_TARGET=install
: "${SOF_AFL:=$HOME/sof/work/AFL/afl-gcc}"
SCRIPT_DIR=$PWD/sof/scripts

print_usage()
{
Expand Down Expand Up @@ -59,7 +70,7 @@ setup_xtensa_tools_build()
{
BUILD_TYPE=xt
BUILD_TARGET=
BUILD_DIR_NAME=build_xt_testbench
BUILD_DIR_NAME=$PWD/build_xt_testbench

# check needed environment variables
test -n "${XTENSA_TOOLS_ROOT}" || die "XTENSA_TOOLS_ROOT need to be set.\n"
Expand Down Expand Up @@ -90,7 +101,7 @@ setup_xtensa_tools_build()

export_xtensa_setup()
{
export_dir=$TESTBENCH_DIR/$BUILD_DIR_NAME
export_dir=$BUILD_DIR_NAME
export_script=$export_dir/xtrun_env.sh
xtbench=$export_dir/sof-testbench4
xtbench_run="XTENSA_CORE=$XTENSA_CORE \$XTENSA_TOOLS_ROOT/$install_bin/xt-run $xtbench"
Expand All @@ -114,14 +125,14 @@ Success!
For temporary, interactive Kconfiguration use:
$BUILD_BACKEND -C $TESTBENCH_DIR/$BUILD_DIR_NAME/sof_ep/build/ menuconfig
$BUILD_BACKEND -C $BUILD_DIR_NAME/sof_ep/build/ menuconfig
Permanent configuration is "src/arch/host/configs/library_defconfig".
For instant, incremental build:
$src_env_msg
$BUILD_BACKEND -C $TESTBENCH_DIR/$BUILD_DIR_NAME/ -j$(nproc)
$BUILD_BACKEND -C $BUILD_DIR_NAME/ -j$(nproc)
EOF0

Expand Down
2 changes: 1 addition & 1 deletion scripts/sof-testbench-build-profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fi

#set default values
PLATFORM=none
PDIR=$PWD/sof/tools/testbench/profile
PDIR=$PWD/testbench/profile

while getopts "hp:d:" opt; do
case "${opt}" in
Expand Down
12 changes: 6 additions & 6 deletions scripts/sof-testbench-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ if [[ "$BITS" == "24" ]]; then
else
sox --encoding signed-integer "$CLIP" -L -r "$RATE_IN" -c "$CHANNELS_IN" -b "$BITS" "$INFILE1"
fi

TB4="$PWD/sof/tools/testbench/build_testbench/install/bin/sof-testbench4"
XTB4="$PWD/sof/tools/testbench/build_xt_testbench/sof-testbench4"
XTB4_SETUP="$PWD/sof/tools/testbench/build_xt_testbench/xtrun_env.sh"
TOOLSDIR="$PWD/build_tools/testbench"
TB4="$PWD/build_testbench/install/bin/sof-testbench4"
XTB4="$PWD/build_xt_testbench/sof-testbench4"
XTB4_SETUP="$PWD/build_xt_testbench/xtrun_env.sh"
if [ -z "$TPLG0" ]; then
TPLG="$PWD/sof/tools/build_tools/topology/topology2/development/sof-hda-benchmark-${MODULE}${BITS}.tplg"
TPLG="$PWD/build_tools/topology/topology2/development/sof-hda-benchmark-${MODULE}${BITS}.tplg"
else
TPLG="$PWD/sof/tools/build_tools/topology/topology2/$TPLG0"
TPLG="$PWD/build_tools/topology/topology2/$TPLG0"
fi
FMT="S${BITS}_LE"
OPTS="-r $RATE_IN -R $RATE_OUT -c $CHANNELS_IN -c $CHANNELS_OUT -b $FMT -p $PIPELINES -t $TPLG -i $INFILE1 -o $OUTFILE1"
Expand Down

0 comments on commit feded0f

Please sign in to comment.