From 956043fe4a27a8e3b2cb9fe6237cf593b389b817 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Sat, 28 Oct 2023 00:08:01 +0000 Subject: [PATCH] scripts/fuzz.sh: fix multiple issues with "stub" overlays Fixes commit deed9a8808eb ("scripts: fuzz: add support for build and overlays") The main issue was the way fuzz.sh was trying to parse the overlay file. Drop that and just pass it as is to `west` and `cmake` instead, they know what to do with it. Also: - Fix invalid syntax in stub_build_all_ipc4.conf - Make fuzz.sh shellcheck-clean again. Always use shellcheck. - Temporarily disable `CONFIG_COMP_SMART_AMP` in stub_build_all_ipc3.conf because `smart_amp.c` does not compile (in any configuration) ``` sof/src/audio/smart_amp/smart_amp.c:748:9: error: no member named 'in_channels' in 'struct smart_amp_data' sad->in_channels = audio_stream_get_channels(&source_buffer->stream); ``` Signed-off-by: Marc Herbert --- .github/workflows/build_all.yml | 2 +- app/stub_build_all_ipc3.conf | 7 +++++-- app/stub_build_all_ipc4.conf | 10 +++++----- scripts/fuzz.sh | 16 ++++++---------- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index 886b53cf2d7a..16aae15274e9 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -61,4 +61,4 @@ jobs: cd workspace clang --verbose set -x - sof/scripts/fuzz.sh -b -c stub_build_all_${{ matrix.IPC }}.conf -- "$cmake_arg" + sof/scripts/fuzz.sh -b -- -DOVERLAY_CONFIG=stub_build_all_${{ matrix.IPC }}.conf diff --git a/app/stub_build_all_ipc3.conf b/app/stub_build_all_ipc3.conf index 9dcfbb50f1fb..b96ffe48adac 100644 --- a/app/stub_build_all_ipc3.conf +++ b/app/stub_build_all_ipc3.conf @@ -4,11 +4,14 @@ CONFIG_COMP_TONE=n CONFIG_COMP_CROSSOVER=y CONFIG_COMP_DRC=y CONFIG_COMP_MULTIBAND_DRC=y -CONFIG_COMP_SMART_AMP=y CONFIG_PASSTHROUGH_CODEC=y CONFIG_WAVES_CODEC=y CONFIG_DTS_CODEC=y CONFIG_COMP_IGO_NR=y CONFIG_COMP_RTNR=y -CONFIG_COMP_SMART_AMP=y +# temporarily disabled until it compiles: +# sof/src/audio/smart_amp/smart_amp.c:748:9: error: +# no member named 'in_channels' in 'struct smart_amp_data' +# sad->in_channels = audio_stream_get_channels(&source_buffer->stream); +CONFIG_COMP_SMART_AMP=n CONFIG_MAXIM_DSM=y diff --git a/app/stub_build_all_ipc4.conf b/app/stub_build_all_ipc4.conf index f111940b17b6..178b70388c01 100644 --- a/app/stub_build_all_ipc4.conf +++ b/app/stub_build_all_ipc4.conf @@ -1,5 +1,5 @@ --DCONFIG_COMP_STUBS=y --DCONFIG_COMP_ARIA=y --DCONFIG_COMP_CHAIN_DMA=y --DCONFIG_COMP_UP_DOWN_MIXER=y --DCONFIG_IPC_MAJOR_4=y +CONFIG_COMP_STUBS=y +CONFIG_COMP_ARIA=y +CONFIG_COMP_CHAIN_DMA=y +CONFIG_COMP_UP_DOWN_MIXER=y +CONFIG_IPC_MAJOR_4=y diff --git a/scripts/fuzz.sh b/scripts/fuzz.sh index d999beeb476a..47bd565d40ab 100755 --- a/scripts/fuzz.sh +++ b/scripts/fuzz.sh @@ -49,14 +49,14 @@ main() { setup + BUILD_ONLY=false # Parse "$@". getopts stops after '--' - while getopts "ho:t:c:b" opt; do + while getopts "ho:t:b" opt; do case "$opt" in h) print_help; exit 0;; o) FUZZER_STDOUT="$OPTARG";; t) TEST_DURATION="$OPTARG";; - b) BUILD_ONLY=1;; - c) OVERLAY="$OPTARG";; + b) BUILD_ONLY=true;; *) print_help; exit 1;; esac done @@ -80,15 +80,11 @@ main() -DCONFIG_ASAN=y ) - if [ ! -z $OVERLAY ]; then - overlay_config=$(xargs -a "$SOF_TOP/app/$OVERLAY" printf -- "-D%s ") - fi - west build -d build-fuzz -b native_posix "$SOF_TOP"/app/ -- \ - "${fuzz_configs[@]}" "$overlay_config" "$@" + "${fuzz_configs[@]}" "$@" - if [ $BUILD_ONLY -eq 1 ]; then - exit + if $BUILD_ONLY; then + exit 0 fi mkdir -p ./fuzz_corpus