-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoverageReport.sh
executable file
·56 lines (40 loc) · 1.36 KB
/
coverageReport.sh
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
#
#
# Small helper script to produce a coverage report when executing the fuzz-model
# against the current corpus.
#
set -eu
# Build the fuzzer and fetch dependency-jars
./gradlew shadowJar getDeps
# extract jar-files of Apache Commons Compress
mkdir -p build/compressfiles
cd build/compressfiles
# then unpack the class-files
for i in `find ../runtime -name commons-compress-*.jar`; do
echo $i
unzip -o -q $i
done
cd -
# Fetch JaCoCo Agent
test -f jacoco-0.8.12.zip || wget --continue https://repo1.maven.org/maven2/org/jacoco/jacoco/0.8.12/jacoco-0.8.12.zip
unzip -o jacoco-0.8.12.zip lib/jacocoagent.jar lib/jacococli.jar
mv lib/jacocoagent.jar lib/jacococli.jar build/
rmdir lib
mkdir -p build/jacoco
# Run Jazzer with JaCoCo-Agent to produce coverage information
./jazzer \
--cp=build/libs/compress-fuzz-all.jar \
--instrumentation_includes=org.apache.commons.** \
--target_class=org.dstadler.compress.fuzz.Fuzz \
--nohooks \
--jvm_args="-javaagent\\:build/jacocoagent.jar=destfile=build/jacoco/corpus.exec" \
-rss_limit_mb=4096 \
-runs=0 \
corpus
# Finally create the JaCoCo report
java -jar build/jacococli.jar report build/jacoco/corpus.exec \
--classfiles build/compressfiles \
--sourcefiles /opt/apache/commons-compress/git/src/main/java/ \
--html build/reports/jacoco
echo All Done, report is at build/reports/jacoco/index.html