summaryrefslogtreecommitdiffstats
path: root/tools/oss-fuzzshark/build.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtools/oss-fuzzshark/build.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/oss-fuzzshark/build.sh b/tools/oss-fuzzshark/build.sh
new file mode 100755
index 00000000..bc86cdc0
--- /dev/null
+++ b/tools/oss-fuzzshark/build.sh
@@ -0,0 +1,22 @@
+#!/bin/bash -eux
+# Copyright 2017 Google Inc.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+# TODO: support specifing targets in args. Google oss-fuzz specifies 'all'.
+
+# TODO update oss-fuzz configuration to build with OSS_FUZZ=1? This is necessary
+# to build the fuzzshark_* targets for oss-fuzz.
+cmake -DOSS_FUZZ=1 .
+
+cmake --build . --target all-fuzzers
+
+for file in run/fuzzshark_*; do
+ fuzzer_name="${file##*/}"
+ fuzzer_target="${fuzzer_name#fuzzshark_}"
+ mv "$file" "$OUT/"
+ echo -en "[libfuzzer]\nmax_len = 1024\n" > $OUT/${fuzzer_name}.options
+ if [ -d "$SAMPLES_DIR/${fuzzer_target}" ]; then
+ zip -j $OUT/${fuzzer_name}_seed_corpus.zip $SAMPLES_DIR/${fuzzer_target}/*/*.bin
+ fi
+done