diff options
author | Sara Golemon <sara.golemon@mongodb.com> | 2019-11-12 16:28:42 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-11-12 16:28:42 +0000 |
commit | 5616923be4dfce1b2e938f8be5819f25e891c2b8 (patch) | |
tree | 8a1fa946d794a312b95df96444e9e610689f5646 /buildscripts/merge_corpus.sh | |
parent | 25101f418ecc42d62339ad5e219177a6822bd59b (diff) | |
download | mongo-5616923be4dfce1b2e938f8be5819f25e891c2b8.tar.gz |
SERVER-44314 Refactor merge_corpus.sh
Diffstat (limited to 'buildscripts/merge_corpus.sh')
-rwxr-xr-x | buildscripts/merge_corpus.sh | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/buildscripts/merge_corpus.sh b/buildscripts/merge_corpus.sh index ab50ee0aee8..a7e0a598c5d 100755 --- a/buildscripts/merge_corpus.sh +++ b/buildscripts/merge_corpus.sh @@ -14,18 +14,29 @@ if [ ! -f $input ] || [ ! -d $corpus_dir ]; then exit 0 fi -# 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 +# For each test, merge in new data. +while IFS= read -r line; do + corpus_file="$corpus_dir/corpus-${line##*/}" + + if [ -d "${corpus_file}-new" ]; then + if [ ! -d "${corpus_file}" ]; then + # An error in a prior run left old corpus data orphaned, reclaim it. + mv -v "${corpus_file}-new" "${corpus_file}" + else + # Somehow we have multiple corpii, treat non '-new' as official. + rm -rv "${corpus_file}-new" + fi + fi + + # Create a new merge from old corpus and new run. + mkdir -v "${corpus_file}-new" + ./"$line" "${corpus_file}-new" "$corpus_file" -merge=1 done < "$input" -# Delete old corpus +# 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}" +# Rename new corpus to old corpus. +for f in "$corpus_dir"/*-new; do + mv -v "$f" "${f%-new}" done |