From 8e966147ad5adb3b8fbcc75cbf1492c12a08c498 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Thu, 22 Aug 2024 00:53:53 +0000 Subject: [PATCH] fuzz.sh: add new boards/native_sim_libfuzzer.conf Extract -DCONFIG_* definitions hardcoded inside the script and move them to a new .conf file where they belong. This is a first, baby-step towards addressing the more general lack of .config control described in #9386 Signed-off-by: Marc Herbert --- app/boards/native_sim_libfuzzer.conf | 11 +++++++++++ scripts/fuzz.sh | 16 +++------------- 2 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 app/boards/native_sim_libfuzzer.conf diff --git a/app/boards/native_sim_libfuzzer.conf b/app/boards/native_sim_libfuzzer.conf new file mode 100644 index 000000000000..4aa87bef34fe --- /dev/null +++ b/app/boards/native_sim_libfuzzer.conf @@ -0,0 +1,11 @@ +# See https://docs.zephyrproject.org/latest/build/kconfig/setting.html#initial-conf + +CONFIG_ZEPHYR_POSIX=y +CONFIG_ASSERT=y +CONFIG_EXCEPTION_DEBUG=y +CONFIG_ARCH_POSIX_TRAP_ON_FATAL=y +CONFIG_SYS_HEAP_BIG_ONLY=y +CONFIG_ZEPHYR_NATIVE_DRIVERS=y +CONFIG_ARCH_POSIX_LIBFUZZER=y +CONFIG_ZEPHYR_POSIX_FUZZ_TICKS=100 +CONFIG_ASAN=y diff --git a/scripts/fuzz.sh b/scripts/fuzz.sh index 9a5b39ebd2ab..cd08d980d786 100755 --- a/scripts/fuzz.sh +++ b/scripts/fuzz.sh @@ -103,18 +103,8 @@ main() # This also drops _leading_ '--'. shift $((OPTIND-1)) - # Move this to a new fuzz.conf EXTRA_CONF_FILE if it grows bigger - local fuzz_configs=( - -DCONFIG_ZEPHYR_POSIX=y - -DCONFIG_ASSERT=y - -DCONFIG_EXCEPTION_DEBUG=y - -DCONFIG_ARCH_POSIX_TRAP_ON_FATAL=y - -DCONFIG_SYS_HEAP_BIG_ONLY=y - -DCONFIG_ZEPHYR_NATIVE_DRIVERS=y - -DCONFIG_ARCH_POSIX_LIBFUZZER=y - -DCONFIG_ZEPHYR_POSIX_FUZZ_TICKS=100 - -DCONFIG_ASAN=y - ) + # https://docs.zephyrproject.org/latest/build/kconfig/setting.html#initial-conf + local conf_files_list='prj.conf;boards/native_sim_libfuzzer.conf' # Note there's never any reason to delete fuzz_corpus/. # Don't trust `west build -p` because it is not 100% unreliable, @@ -125,7 +115,7 @@ main() # When passing conflicting -DVAR='VAL UE1' -DVAR='VAL UE2' to CMake, # the last 'VAL UE2' wins. Previous ones are silently ignored. west build -d build-fuzz -b native_sim "$SOF_TOP"/app/ -- \ - "${fuzz_configs[@]}" "$@" + -DCONF_FILE="$conf_files_list" "$@" ) if $BUILD_ONLY; then