1#!/bin/bash -eu 2# Copyright 2021 Google Inc. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16################################################################################ 17 18FUZZERS_BASE=$SRC/hcl/hclsyntax/fuzz 19FUZZERS_PACKAGE=github.com/hashicorp/hcl/v2/hclsyntax/fuzz 20FUZZER_CLASS=Fuzz 21 22for THE_FUZZER in config expr template traversal 23do 24 THE_FUZZER_NAME="fuzz_"$THE_FUZZER 25 compile_go_fuzzer $FUZZERS_PACKAGE/$THE_FUZZER $FUZZER_CLASS $THE_FUZZER_NAME 26 27 OUTDIR=$OUT/$THE_FUZZER_NAME"_seed_corpus" 28 mkdir $OUTDIR 29 find $FUZZERS_BASE/$THE_FUZZER/corpus -type f | while read FNAME 30 do 31 SHASUM_NAME=$(shasum "$FNAME" | awk '{print $1}') 32 cp "$FNAME" $OUTDIR 33 done 34 zip -r $OUTDIR".zip" $OUTDIR 35 rm -rf $OUTDIR 36done