summaryrefslogtreecommitdiff
path: root/buildscripts/merge_corpus.sh
diff options
context:
space:
mode:
authorRoxane <roxane.fruytier@10gen.com>2019-06-26 14:50:57 -0400
committerRoxane <roxane.fruytier@10gen.com>2019-07-18 15:58:45 -0400
commit51a218fb13e02e59afe203c5efd665c9399bfde2 (patch)
treecb5f7186f1e9cdf9df5afec6a1d778f21d484b8b /buildscripts/merge_corpus.sh
parent7f15f3efd3a6e68211b168239259bff8c08147d3 (diff)
downloadmongo-51a218fb13e02e59afe203c5efd665c9399bfde2.tar.gz
SERVER-41796 Create Evergreen variant for libfuzzer targets
Diffstat (limited to 'buildscripts/merge_corpus.sh')
-rwxr-xr-xbuildscripts/merge_corpus.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/buildscripts/merge_corpus.sh b/buildscripts/merge_corpus.sh
new file mode 100755
index 00000000000..162f7037af5
--- /dev/null
+++ b/buildscripts/merge_corpus.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+# merge_corpus.sh
+#
+# Merges the corpus of each libfuzzer tests
+
+set -o verbose
+set -o errexit
+
+input="build/libfuzzer_tests.txt"
+corpus_dir="corpus"
+
+# We need to merge the corpus once it has been tested
+while IFS= read -r line
+do
+ mkdir "$corpus_dir"/corpus-"${line##*/}"-new
+ ./"$line" "$corpus_dir"/corpus-"${line##*/}"-new "$corpus_dir"/corpus-"${line##*/}" -merge=1
+done < "$input"
+
+# Delete old corpus
+find corpus/* -not -name '*-new' -type d -exec rm -rv {} +
+
+# Rename new corpus to old corpus
+for f in ./corpus/*
+do
+ mv "$f" "${f%-new}"
+done \ No newline at end of file