@@ -17,7 +17,7 @@ dependencies {
1717}
1818
1919// Create the fuzz test task
20- tasks.register<Test >(" fuzz" ) {
20+ val fuzz = tasks.register<Test >(" fuzz" ) {
2121 description = " Run fuzz tests using Jazzer"
2222 group = " verification"
2323
@@ -42,15 +42,34 @@ tasks.register<Test>("fuzz") {
4242
4343 // Jazzer configuration
4444 systemProperty(" jazzer.valueprofile" , " 1" )
45- systemProperty(" jazzer.coverage_report" , " ${project.layout.buildDirectory} /reports/jazzer" )
4645
4746 systemProperty(" jazzer.instrumentation_includes" , " software.amazon.smithy.java.**" )
4847
4948 val corpusDir = " ${project.projectDir} /src/fuzz/resources/corpus"
49+ var argIndex = 0 ;
5050 if (file(corpusDir).exists()) {
51- systemProperty(" jazzer.internal.arg.0 " , corpusDir)
51+ systemProperty(" jazzer.internal.arg.${argIndex ++ } " , corpusDir)
5252 }
5353
5454 val maxDuration = project.findProperty(" fuzz.maxDuration" ) ? : " 1h"
5555 systemProperty(" jazzer.max_duration" , maxDuration)
56+ }
57+
58+ // Generate JaCoCo coverage report for fuzz tests
59+ val fuzzReport = tasks.register<JacocoReport >(" jacocoFuzzReport" ) {
60+ description = " Generate JaCoCo coverage report for fuzz tests"
61+ group = " verification"
62+
63+ dependsOn(fuzz)
64+ executionData(layout.buildDirectory.files(" jacoco/${fuzz.name} .exec" ))
65+ sourceSets(project.the<SourceSetContainer >()[" main" ])
66+
67+ reports {
68+ xml.required.set(false )
69+ csv.required.set(false )
70+ }
71+ }
72+
73+ fuzz {
74+ finalizedBy(fuzzReport)
5675}
0 commit comments