Skip to content

Commit

Permalink
fuzz: add support for 64 bit builds
Browse files Browse the repository at this point in the history
This is needed for MSAN

Signed-off-by: Curtis Malainey <[email protected]>
  • Loading branch information
cujomalainey committed Oct 1, 2024
1 parent 6949112 commit 6750233
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions scripts/fuzz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Usage:
relatively verbose stderr is not redirected by -o.
-j n Number of concurrent -jobs=n. Defaults to 1.
The value 0 uses the output of the 'nproc' command.
-a arch The architecture to build against (i386, x86_64)
Arguments after -- are passed as is to CMake (through west).
When passing conflicting -DVAR='VAL UE1' -DVAR='VAL UE2' to CMake,
Expand Down Expand Up @@ -89,10 +90,12 @@ main()
local FUZZER_STDOUT=/dev/stdout # bashism
local TEST_DURATION=3
local SANITIZER=address
local ARCH=i386
local IPC
local BOARD

# Parse "$@". getopts stops after '--'
while getopts "i:hj:ps:o:t:b" opt; do
while getopts "i:hj:ps:a:o:t:b" opt; do
case "$opt" in
i) IPC="$OPTARG";;
h) print_help; exit 0;;
Expand All @@ -101,6 +104,7 @@ main()
s) SANITIZER="$OPTARG";;
o) FUZZER_STDOUT="$OPTARG";;
t) TEST_DURATION="$OPTARG";;
a) ARCH="$OPTARG";;
b) BUILD_ONLY=true;;
*) print_help; exit 1;;
esac
Expand All @@ -124,6 +128,12 @@ main()
*) echo "Unknown fuzzer type"; print_help; exit 1;;
esac

case $ARCH in
i386) BOARD="native_sim";;
x86_64) BOARD="native_sim/native/64";;
*) echo "Unknown arch type"; print_help; exit 1;;
esac

# Note there's never any reason to delete fuzz_corpus/.
# Don't trust `west build -p` because it is not 100% unreliable,
# especially not when doing unusual toolchain things.
Expand All @@ -139,7 +149,7 @@ main()
cmake_args+=( "$@" )

(set -x
west build -d build-fuzz -b native_sim "$SOF_TOP"/app/ -- "${cmake_args[@]}"
west build -d build-fuzz -b $BOARD "$SOF_TOP"/app/ -- "${cmake_args[@]}"
)

if $BUILD_ONLY; then
Expand Down

0 comments on commit 6750233

Please sign in to comment.