blob: 162f7037af55b92a841706aedffa3c49f50bd4dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
|