third_party.pigweed.src/pw_fuzzer/examples/build_and_run_toy_fuzzer.sh
Keir Mierle 6a106368c2 pw_fuzzer: Restore fuzzer
The fuzzer hasn't worked for a bit due to the build refactor. This is a
CL to bring it back. Some design discussion may be needed around how
the toolchains are selected.

Change-Id: I2e81a69a4badeed6fff59a57bc757f06d13dfed9
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/29580
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Ali Zhang <alizhang@google.com>
2021-01-23 00:44:39 +00:00

53 lines
1.3 KiB
Bash
Executable File

#! /bin/bash
# Copyright 2020 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
# TODO(pwbug/177): Pythonize this, or otherwise replace it.
set -e
OUT_DIR="out/host"
confirm() {
echo
while [ -n "$1" ] ; do
echo "$1"
shift
done
echo
read -p "Do you wish to continue? [yN]" confirm
case $confirm in
[Yy]* ) ;;
* ) exit;;
esac
echo
}
confirm "This script builds and runs a example fuzzer." \
"This script is about to delete $OUT_DIR."
set -x
rm -rf $OUT_DIR
mkdir -p $OUT_DIR
echo 'pw_toolchain_SANITIZER="address"' >> $OUT_DIR/args.gn
gn gen $OUT_DIR
ninja -C $OUT_DIR
set +x
confirm "The toy_fuzzer was built successfully!" \
"This script is about to start fuzzing."
set -x
$OUT_DIR/host_clang_debug/obj/pw_fuzzer/bin/toy_fuzzer