Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/testbench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ on:
jobs:
build-and-test:
runs-on: ubuntu-24.04
env:
SOF_WORKSPACE=$HOME:/work/sof/sof

steps:
- name: Checkout SOF repository (PR source)
Expand Down
22 changes: 18 additions & 4 deletions scripts/sof-testbench-build-profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,32 @@ usage() {
echo " -h shows this text"
echo " -p <platform> sets platform for scripts/rebuild-testbench.sh"
echo
echo "This script must be run from the sof firmware toplevel or workspace directory"
}

MODULES_S32="asrc dcblock drc drc_multiband eqfir eqiir gain src tdfb"
MODULES_S24="aria"

if [ -z "${SOF_WORKSPACE}" ]; then
echo "Error: environment variable SOF_WORKSPACE need to be set to top level sof directory"
# This script can be executed from the sof firmware toplevel or workspace directory
# First check for the worksapce environment variable
if [ -z "$SOF_WORKSPACE" ]; then
# Environment variable is empty or unset so use default
BASE_DIR="$HOME/work/sof"
else
# Environment variable exists and has a value
BASE_DIR="$SOF_WORKSPACE"
fi
cd "$BASE_DIR"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cannot we use something like

SCRIPTS_DIR=$(dirname "${BASH_SOURCE[0]}")
SOF_DIR=$SCRIPTS_DIR/../

like other SOF scripts do to avoid guessing?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we have a bit of complexity today as CI has some hard coded rules (with config outside this repo). Long term trying to move to an environment variable where the scripts could be executed in any directory under SOF_WORKSPACE.
I do like this idea, will make the change.


# check we are in the workspace directory
if [ ! -d "sof" ]; then
echo "Error: can't find SOF firmware directory. Please check your installation."
exit 1
fi

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

while getopts "hp:d:" opt; do
case "${opt}" in
Expand All @@ -43,7 +57,7 @@ done
shift $((OPTIND-1))

# Build
SCRIPTS=$SOF_WORKSPACE/sof/scripts
SCRIPTS=$PWD/sof/scripts
mkdir -p "$PDIR"
"$SCRIPTS"/rebuild-testbench.sh -p "$PLATFORM"
HELPER="$SCRIPTS"/sof-testbench-helper.sh
Expand Down
26 changes: 19 additions & 7 deletions scripts/sof-testbench-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,22 @@ usage() {
echo "Example: check component eqiir with valgrind"
echo "$0 -v -m eqiir"
echo
echo This script must be run from the sof firmware toplevel or workspace directory
}

if [ -z "${SOF_WORKSPACE}" ]; then
echo "Error: environment variable SOF_WORKSPACE need to be set to top level sof directory"
# First check for the workspace environment variable
if [ -z "$SOF_WORKSPACE" ]; then
# Environment variable is empty or unset so use default
BASE_DIR="$HOME/work/sof"
else
# Environment variable exists and has a value
BASE_DIR="$SOF_WORKSPACE"
fi
cd "$BASE_DIR"

# check we are in the workspace directory
if [ ! -d "sof" ]; then
echo "Error: can't find SOF firmware directory. Please check your installation."
exit 1
fi

Expand Down Expand Up @@ -119,13 +131,13 @@ else
sox --encoding signed-integer "$CLIP" -L -r "$RATE_IN" -c "$CHANNELS_IN" -b "$BITS" "$INFILE1"
fi

TB4="$SOF_WORKSPACE/sof/tools/testbench/build_testbench/install/bin/sof-testbench4"
XTB4="$SOF_WORKSPACE/sof/tools/testbench/build_xt_testbench/sof-testbench4"
XTB4_SETUP="$SOF_WORKSPACE/sof/tools/testbench/build_xt_testbench/xtrun_env.sh"
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"
if [ -z "$TPLG0" ]; then
TPLG="$SOF_WORKSPACE/sof/tools/build_tools/topology/topology2/development/sof-hda-benchmark-${MODULE}${BITS}.tplg"
TPLG="$PWD/sof/tools/build_tools/topology/topology2/development/sof-hda-benchmark-${MODULE}${BITS}.tplg"
else
TPLG="$SOF_WORKSPACE/sof/tools/build_tools/topology/topology2/$TPLG0"
TPLG="$PWD/sof/tools/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