Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1ca1f10 authored by Zach Johnson's avatar Zach Johnson
Browse files

Add fuzzing/run script to run fuzz targets easily

Test: gd/fuzzing/run --host bluetooth_gd_hci_fuzz_test
Change-Id: I0c26d59cf5873b69cb9c6aee15ae3d473153c4c5
parent 4058ed00
Loading
Loading
Loading
Loading

system/gd/fuzzing/run

0 → 100755
+32 −0
Original line number Diff line number Diff line
#! /bin/bash

if [[ -z "${ANDROID_BUILD_TOP}" ]]; then
  echo "ANDROID_BUILD_TOP is not set"
fi

if [[ -z "${ANDROID_HOST_OUT}" ]]; then
  echo "ANDROID_HOST_OUT is not set for host run"
fi

HOST=false
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
    --host)
    HOST=true
    shift # past argument
    ;;
    *)    # unknown option
    POSITIONAL+=("$1") # save it in an array for later
    shift # past argument
    ;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters

if [ "$HOST" == true ] ; then
  HOST_ARCH=$($ANDROID_BUILD_TOP/build/soong/soong_ui.bash --dumpvar-mode HOST_ARCH)
  SANITIZE_HOST=address $ANDROID_BUILD_TOP/build/soong/soong_ui.bash --build-mode --"all-modules" --dir="$(pwd)" $1 && ${ANDROID_HOST_OUT}/fuzz/$HOST_ARCH/$1/$1
fi