#!/bin/bash set -e print_help() { cat <"$FUZZER_STDOUT" build-fuzz/zephyr/zephyr.exe ./fuzz_corpus || timeoutret=$? if [ $timeoutret -eq 124 ]; then # The current ASAN seems overly sensitive: it frequently (but not always) complains # loudly that it has been aborted with a so-called DEADLYSIGNAL when the timeout # command above actually delivers just a gentle TERM by default. Counteracts the # wrong impression this unpredictable whining can give with a proud "successfully" # message. printf '\n\nSuccessfully aborted fuzzer after %d seconds test duration with DEADLYSIGNAL\n' \ "$TEST_DURATION" else die 'zephyr.exe fuzzer stopped before timing out: %d\n' $timeoutret fi date } setup() { SOF_TOP=$(cd "$(dirname "$0")/.." && pwd) export SOF_TOP export ZEPHYR_TOOLCHAIN_VARIANT=llvm # ZEPHYR_BASE. Does not seem required. local WS_TOP WS_TOP=$(cd "$SOF_TOP"; west topdir) # The manifest itself is not a west project ZEP_DIR=$(2>/dev/null west list -f '{path}' zephyr || echo 'zephyr') export ZEPHYR_BASE="$WS_TOP/$ZEP_DIR" } die() { >&2 printf '%s ERROR: ' "$0" # We want die() to be usable exactly like printf # shellcheck disable=SC2059 >&2 printf "$@" >&2 printf '\n' exit 1 } main "$@"