summaryrefslogtreecommitdiff
path: root/automation/ossfuzz
diff options
context:
space:
mode:
authorTim Taubert <ttaubert@mozilla.com>2017-02-15 11:11:36 +0100
committerTim Taubert <ttaubert@mozilla.com>2017-02-15 11:11:36 +0100
commit3fe2f26e80b51505913ff6350dddb2b5926ac29a (patch)
treefdc46abfb0329b836de27982339094b85ae3d232 /automation/ossfuzz
parentbf42c0b903cc523bb309fe65b3fb91e750b86bd4 (diff)
downloadnss-hg-3fe2f26e80b51505913ff6350dddb2b5926ac29a.tar.gz
Bug 1339539 - Build and run the TLS client fuzzer in non-TLS fuzzing mode r=franziskus
Differential Revision: https://nss-review.dev.mozaws.net/D215
Diffstat (limited to 'automation/ossfuzz')
-rwxr-xr-xautomation/ossfuzz/build.sh44
1 files changed, 34 insertions, 10 deletions
diff --git a/automation/ossfuzz/build.sh b/automation/ossfuzz/build.sh
index 08ffaa4c7..04dca18cf 100755
--- a/automation/ossfuzz/build.sh
+++ b/automation/ossfuzz/build.sh
@@ -9,17 +9,14 @@
# List of targets disabled for oss-fuzz.
declare -A disabled=([pkcs8]=1)
-# Build the library.
-CXX="$CXX -stdlib=libc++" LDFLAGS="$CFLAGS" \
- ./build.sh -c -v --fuzz=oss --fuzz=tls --disable-tests
+# List of targets we want to fuzz in TLS and non-TLS mode.
+declare -A tls_targets=([tls-client]=1)
-# Copy libFuzzer options
-cp fuzz/*.options $OUT/
-
-# Find fuzzing targets.
-for fuzzer in $(find ../dist/Debug/bin -name "nssfuzz-*" -printf "%f\n"); do
- name=${fuzzer:8}
- [ -n "${disabled[$name]:-}" ] && continue;
+# Helper function that copies a fuzzer binary and its seed corpus.
+copy_fuzzer()
+{
+ local fuzzer=$1
+ local name=$2
# Copy the binary.
cp ../dist/Debug/bin/$fuzzer $OUT/$name
@@ -30,4 +27,31 @@ for fuzzer in $(find ../dist/Debug/bin -name "nssfuzz-*" -printf "%f\n"); do
else
zip $OUT/${name}_seed_corpus.zip $SRC/nss-corpus/*/*
fi
+}
+
+# Copy libFuzzer options
+cp fuzz/*.options $OUT/
+
+# Build the library (non-TLS fuzzing mode).
+CXX="$CXX -stdlib=libc++" LDFLAGS="$CFLAGS" \
+ ./build.sh -c -v --fuzz=oss --fuzz --disable-tests
+
+# Copy fuzzing targets.
+for fuzzer in $(find ../dist/Debug/bin -name "nssfuzz-*" -printf "%f\n"); do
+ name=${fuzzer:8}
+ if [ -z "${disabled[$name]:-}" ]; then
+ [ -n "${tls_targets[$name]:-}" ] && name="${name}-no_fuzzer_mode"
+ copy_fuzzer $fuzzer $name
+ fi
+done
+
+# Build the library again (TLS fuzzing mode).
+CXX="$CXX -stdlib=libc++" LDFLAGS="$CFLAGS" \
+ ./build.sh -c -v --fuzz=oss --fuzz=tls --disable-tests
+
+# Copy dual mode targets in TLS mode.
+for name in "${!tls_targets[@]}"; do
+ if [ -z "${disabled[$name]:-}" ]; then
+ copy_fuzzer nssfuzz-$name $name
+ fi
done