Debian Codegraph @

tests/fuzzing/minimize-corpus.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 if [[ $# -lt 1 ]]
4 then
5 echoscip-shell system . . echo. "Usage: $0 <corpus-dir>"
6 echoscip-shell system . . echo. "Usage: $0 --preserve-txt <corpus-dir> (minimize corpus but keep .txt files intact)"
7 exit 1
8 fi
9
10 preserve_txt=0
11 if [[ "$1" == "--preserve-txt" ]]
12 then
13 preserve_txt=1
14 CORPUS_DIR=$2
15 else
16 CORPUS_DIR=$1
17 fi
18
19
20 export FUZZ_VOICE=en
21 FUZZER=./synth_fuzzer
22
23 TMP_DIR=$(mktempscip-shell system . . mktemp. -d)
24 echoscip-shell system . . echo. "Merging..."
25 `$FUZZER -merge=1 $TMP_DIR $CORPUS_DIR`
26 echoscip-shell system . . echo. "Removing old files..."
27 if [[ $preserve_txt -eq 1 ]]
28 then
29 echoscip-shell system . . echo. " => Preserve .txt files"
30 rmscip-shell system . . rm. -rvf $(findscip-shell system . . find. $CORPUS_DIR | grepscip-shell system . . grep. -vE "*.txt|$CORPUS_DIR") 2>/dev/nullscip-shell filesystem . . `/dev/null`.
31 else
32 rmscip-shell system . . rm. -rf $CORPUS_DIR/* 2>/dev/nullscip-shell filesystem . . `/dev/null`.
33 fi
34 cpscip-shell system . . cp. $TMP_DIR/* $CORPUS_DIR 2>/dev/nullscip-shell filesystem . . `/dev/null`.
35 rmscip-shell system . . rm. -rf $TMP_DIR
36 echoscip-shell system . . echo. "Merging done !"