From 9656c6f7356f54dfd75853eb8cc67b159b01a6b6 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Thu, 11 May 2023 18:33:36 +0000 Subject: [PATCH 1/3] rebuild-testbench.sh: testbench_usage(): add missing ;; Also: don't fail silently. Signed-off-by: Marc Herbert --- scripts/rebuild-testbench.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/rebuild-testbench.sh b/scripts/rebuild-testbench.sh index d7da4bda8420..71796e33a6fe 100755 --- a/scripts/rebuild-testbench.sh +++ b/scripts/rebuild-testbench.sh @@ -107,6 +107,8 @@ source $export_script \$XTENSA_PATH/xt-run $xtbench -h EOFUSAGE + ;; + *) >&2 printf 'testbench_usage: unknown/missing BUILD_TYPE=%s\n' "$BUILD_TYPE" ;; esac } From ae9a2225f461a04f22e065f98b9339ba4f0e6408 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Thu, 11 May 2023 18:38:21 +0000 Subject: [PATCH 2/3] rebuild-testbench.sh: add missing shellcheck source= Fixes last shellcheck -x warning Signed-off-by: Marc Herbert --- scripts/rebuild-testbench.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/rebuild-testbench.sh b/scripts/rebuild-testbench.sh index 71796e33a6fe..1c9cb629422e 100755 --- a/scripts/rebuild-testbench.sh +++ b/scripts/rebuild-testbench.sh @@ -59,6 +59,9 @@ setup_xtensa_tools_build() test -n "${XTENSA_TOOLS_ROOT}" || die "XTENSA_TOOLS_ROOT need to be set.\n" # Get compiler version for platform + + # 'shellcheck -x ...' works only from the top directory + # shellcheck source=scripts/set_xtensa_params.sh source "$SCRIPT_DIR/set_xtensa_params.sh" "$BUILD_PLATFORM" test -n "${XTENSA_TOOLS_VERSION}" || From f72a70f178b28514586b38a5f402c45049a2d348 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Thu, 11 May 2023 18:39:33 +0000 Subject: [PATCH 3/3] rebuild-testbench.sh: add -j jobs option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is required to investigate build failures. Because of the way the build is split, a failure in one component can become totally drown in the long build logs of another component. Example: with -j2 the `parser_ep` build failure below is completely drown by the long (and successful!) build logs of `sof_ep`: ``` ./scripts/rebuild-testbench.sh -j 1 -p tgl sof/tools/testbench/build_xt_testbench/sof_parser/build/include/alsa/ sound/asoc.h:196: error: expected specifier-qualifier-list before ‘__le32’ ``` Signed-off-by: Marc Herbert --- scripts/rebuild-testbench.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/rebuild-testbench.sh b/scripts/rebuild-testbench.sh index 1c9cb629422e..620b15dbeb26 100755 --- a/scripts/rebuild-testbench.sh +++ b/scripts/rebuild-testbench.sh @@ -17,6 +17,8 @@ usage: $0 [-f] [-p ] -p Build testbench binary for xt-run for selected platform, e.g. -p tgl -f Build testbench with compiler provided by fuzzer (default path: $HOME/sof/work/AFL/afl-gcc) + -j number of parallel make/ninja jobs. Defaults to /usr/bin/nproc. + You MUST re-run with -j1 when something is failing! EOFUSAGE } @@ -40,7 +42,7 @@ rebuild_testbench() cmake -DCMAKE_INSTALL_PREFIX=install .. - cmake --build . -- -j"$(nproc)" $BUILD_TARGET + cmake --build . -- -j"${jobs}" $BUILD_TARGET } export_CC_with_afl() @@ -122,13 +124,15 @@ main() BUILD_TESTBENCH_DIR="$SOF_REPO"/tools/testbench : "${SOF_AFL:=$HOME/sof/work/AFL/afl-gcc}" - while getopts "fhp:" OPTION; do + jobs=$(nproc) + while getopts "fhj:p:" OPTION; do case "$OPTION" in p) BUILD_PLATFORM="$OPTARG" setup_xtensa_tools_build ;; f) export_CC_with_afl;; + j) jobs=$(printf '%d' "$OPTARG") ;; h) print_usage; exit 1;; *) print_usage; exit 1;; esac