github.phpd.cn/thought-machine/please@v12.2.0+incompatible/src/parse/asp/fuzz/fuzz.sh (about)

     1  #!/bin/bash
     2  # This script should be run from the repo root.
     3  set -eu
     4  
     5  function notice {
     6      >&2 echo -e "\033[32m$1\033[0m"
     7  }
     8  
     9  notice "Setting up fuzzing corpus..."
    10  TARGET="$(plz query outputs -p //src/parse/asp/fuzz:build)"
    11  WORKDIR="$(dirname $TARGET)"
    12  CORPUS="${WORKDIR}/corpus"
    13  rm -rf "$WORKDIR/crashers"
    14  mkdir -p "$CORPUS"
    15  for FILE in `git ls-files | grep -E "(BUILD|build_defs)"`; do
    16      cp "$FILE" "${CORPUS}/$(echo $FILE | tr '/' '_')"
    17  done
    18  
    19  notice "Instrumenting fuzzer binary..."
    20  plz-out/bin/src/please build //src/parse/asp/fuzz:build
    21  notice "Beginning fuzzing. Work dir: $WORKDIR Binary: $TARGET"
    22  plz-out/bin/src/please run //third_party/go:go-fuzz -- -bin "$TARGET" -workdir="$WORKDIR" -minimize 20s