Skip to content

Commit 2c917cc

Browse files
author
Jazzer release pipeline
committed
Automated update: jazzer-junit docs
1 parent 4b83aee commit 2c917cc

11 files changed

Lines changed: 329 additions & 26 deletions

jazzer-junit/allclasses-index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ <h1 title="All Classes and Interfaces" class="title">All Classes and Interfaces<
7070
<div class="col-last even-row-color all-classes-table all-classes-table-tab2">
7171
<div class="block">The libFuzzer-compatible CLI entrypoint for Jazzer.</div>
7272
</div>
73+
<div class="col-first odd-row-color all-classes-table all-classes-table-tab2"><a href="com/code_intelligence/jazzer/junit/JUnitLifecycleMethodsInvoker.html" title="class in com.code_intelligence.jazzer.junit">JUnitLifecycleMethodsInvoker</a></div>
74+
<div class="col-last odd-row-color all-classes-table all-classes-table-tab2">
75+
<div class="block">Adapts JUnit BeforeEach and AfterEach callbacks to <code>FuzzTargetRunner</code> lifecycle hooks.</div>
76+
</div>
7377
</div>
7478
</div>
7579
</div>

jazzer-junit/com/code_intelligence/jazzer/Jazzer.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ <h1 title="Class Jazzer" class="title">Class Jazzer</h1>
8181
<div class="block">The libFuzzer-compatible CLI entrypoint for Jazzer.
8282

8383
<p>Arguments to Jazzer are passed as command-line arguments or <code>jazzer.*</code> system
84-
properties. For example, setting the property <code>jazzer.target_class</code> to
85-
<code>com.example.FuzzTest</code> is equivalent to passing the argument
86-
<code>--target_class=com.example.FuzzTest</code>.
84+
properties. For example, setting the property <code>jazzer.target_class</code> to <code>
85+
com.example.FuzzTest</code> is equivalent to passing the argument <code>
86+
--target_class=com.example.FuzzTest</code>.
8787

8888
<p>Arguments to libFuzzer are passed as command-line arguments.</div>
8989
</section>

jazzer-junit/com/code_intelligence/jazzer/junit/FuzzTest.html

Lines changed: 49 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ <h1 title="Annotation Interface FuzzTest" class="title">Annotation Interface Fuz
6767
</div>
6868
<section class="class-description" id="class-description">
6969
<hr>
70-
<div class="type-signature"><span class="annotations"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/annotation/Target.html" title="class or interface in java.lang.annotation" class="external-link">@Target</a>(<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/annotation/ElementType.html#METHOD" title="class or interface in java.lang.annotation" class="external-link">METHOD</a>)
70+
<div class="type-signature"><span class="annotations"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/annotation/Target.html" title="class or interface in java.lang.annotation" class="external-link">@Target</a>({<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/annotation/ElementType.html#METHOD" title="class or interface in java.lang.annotation" class="external-link">METHOD</a>,<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/annotation/ElementType.html#ANNOTATION_TYPE" title="class or interface in java.lang.annotation" class="external-link">ANNOTATION_TYPE</a>})
7171
<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/annotation/Retention.html" title="class or interface in java.lang.annotation" class="external-link">@Retention</a>(<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/annotation/RetentionPolicy.html#RUNTIME" title="class or interface in java.lang.annotation" class="external-link">RUNTIME</a>)
7272
<a href="https://junit.org/junit5/docs/current/api/org.junit.jupiter.params/org/junit/jupiter/params/provider/ArgumentsSource.html" title="class or interface in org.junit.jupiter.params.provider" class="external-link">@ArgumentsSource</a>(com.code_intelligence.jazzer.junit.SeedArgumentsProvider.class)
7373
<a href="https://junit.org/junit5/docs/current/api/org.junit.jupiter.api/org/junit/jupiter/api/extension/ExtendWith.html" title="class or interface in org.junit.jupiter.api.extension" class="external-link">@ExtendWith</a>(com.code_intelligence.jazzer.junit.FuzzTestExtensions.class)
@@ -81,28 +81,32 @@ <h2>Test parameters</h2>
8181
<p>Methods annotated with <a href="FuzzTest.html" title="annotation interface in com.code_intelligence.jazzer.junit"><code>FuzzTest</code></a> can take either of the following types of parameters:
8282

8383
<dl>
84-
<dt><code>byte[]</code></dt>
85-
<dd>Raw byte input mutated by the fuzzer. Use this signature when your fuzz test naturally
86-
handles raw bytes (e.g. when fuzzing a binary format parser). This is the most efficient, but
87-
also the least convenient way to write a fuzz test.</dd>
88-
89-
<dt><a href="https://codeintelligencetesting.github.io/jazzer-docs/jazzer-api/com/code_intelligence/jazzer/api/FuzzedDataProvider.html" title="class or interface in com.code_intelligence.jazzer.api" class="external-link"><code>FuzzedDataProvider</code></a></dt>
90-
<dd>Provides convenience methods that generate instances of commonly used Java types from the raw
91-
fuzzer input. This is generally the best way to write fuzz tests.</dd>
92-
93-
<dt>any non-zero number of parameters of any type</dt>
94-
<dd>In this case, Jazzer will rely on reflection and class path scanning to instantiate concrete
95-
arguments. While convenient and a good way to get started, fuzz tests using this feature will
96-
generally be less efficient than fuzz tests using any of the other possible signatures. Due to
97-
the reliance on class path scanning, any change to the class path may also render previous
98-
findings unreproducible.</dd>
84+
<dt><code>byte[]</code>
85+
<dd>Raw byte input mutated by the fuzzer. Use this signature when your fuzz test naturally
86+
handles raw bytes (e.g. when fuzzing a binary format parser). This is the most efficient,
87+
but also the least convenient way to write a fuzz test.
88+
<dt><a href="https://codeintelligencetesting.github.io/jazzer-docs/jazzer-api/com/code_intelligence/jazzer/api/FuzzedDataProvider.html" title="class or interface in com.code_intelligence.jazzer.api" class="external-link"><code>FuzzedDataProvider</code></a>
89+
<dd>Provides convenience methods that generate instances of commonly used Java types from the
90+
raw fuzzer input. This is generally the best way to write fuzz tests.
91+
<dt>any non-zero number of parameters of any type
92+
<dd>In this case, Jazzer will rely on reflection and class path scanning to instantiate
93+
concrete arguments. While convenient and a good way to get started, fuzz tests using this
94+
feature will generally be less efficient than fuzz tests using any of the other possible
95+
signatures. Due to the reliance on class path scanning, any change to the class path may
96+
also render previous findings unreproducible.
9997
</dl>
10098

99+
<p>The <a href="FuzzTest.html" title="annotation interface in com.code_intelligence.jazzer.junit"><code>FuzzTest</code></a> annotation can also be applied to another annotations as a
100+
meta-annotation and then applies to all methods annotated with that annotation. This can be used
101+
to create reusable custom annotations for fuzz tests combined with other JUnit annotations such
102+
as <a href="https://junit.org/junit5/docs/current/api/org.junit.jupiter.api/org/junit/jupiter/api/Timeout.html" title="class or interface in org.junit.jupiter.api" class="external-link"><code>Timeout</code></a> or <a href="https://junit.org/junit5/docs/current/api/org.junit.jupiter.api/org/junit/jupiter/api/Tag.html" title="class or interface in org.junit.jupiter.api" class="external-link"><code>Tag</code></a>.
103+
101104
<h2>Test modes</h2>
102105

103106
A fuzz test can be run in two modes: fuzzing and regression testing.
104107

105108
<h3>Fuzzing</h3>
109+
106110
<p>When the environment variable <code>JAZZER_FUZZ</code> is set to any non-empty value, fuzz tests
107111
run in "fuzzing" mode. In this mode, the method annotated with <a href="FuzzTest.html" title="annotation interface in com.code_intelligence.jazzer.junit"><code>FuzzTest</code></a> are invoked
108112
repeatedly with inputs that Jazzer generates and mutates based on feedback obtained from
@@ -120,15 +124,16 @@ <h3>Fuzzing</h3>
120124
will be skipped.
121125

122126
<h3>Regression testing</h3>
127+
123128
<p>By default, a fuzz test is executed as a regular JUnit <a href="https://junit.org/junit5/docs/current/api/org.junit.jupiter.params/org/junit/jupiter/params/ParameterizedTest.html" title="class or interface in org.junit.jupiter.params" class="external-link"><code>ParameterizedTest</code></a> running on a
124129
fixed set of inputs. It can be run together with regular unit tests and used to verify that past
125130
findings remain fixed. In IDEs with JUnit 5 integration, it can also be used to conveniently
126131
debug individual findings.
127132

128133
<p>Fuzz tests are always executed on the empty input as well as all input files contained in the
129-
resource directory called <code>&lt;TestClassName&gt;Inputs</code> in the current package. For example,
130-
all fuzz tests contained in the class <code>com.example.MyFuzzTests</code> would run on all files
131-
under <code>src/test/resources/com/example/MyFuzzTestsInputs</code>.</div>
134+
resource directory called <code>&lt;TestClassName&gt;Inputs</code> in the current package. For example, all
135+
fuzz tests contained in the class <code>com.example.MyFuzzTests</code> would run on all files under
136+
<code>src/test/resources/com/example/MyFuzzTestsInputs</code>.</div>
132137
</section>
133138
<section class="summary">
134139
<ul class="summary-list">
@@ -147,6 +152,12 @@ <h2>Optional Element Summary</h2>
147152
<div class="block">A duration string such as "1h 2m 30s" indicating for how long the fuzz test should be executed
148153
during fuzzing.</div>
149154
</div>
155+
<div class="col-first odd-row-color"><code>long</code></div>
156+
<div class="col-second odd-row-color"><code><a href="#maxExecutions()" class="member-name-link">maxExecutions</a></code></div>
157+
<div class="col-last odd-row-color">
158+
<div class="block">If set to a positive number, the fuzz test function will be executed at most this many times
159+
during fuzzing.</div>
160+
</div>
150161
</div>
151162
</section>
152163
</li>
@@ -166,13 +177,32 @@ <h3>maxDuration</h3>
166177
<div class="block">A duration string such as "1h 2m 30s" indicating for how long the fuzz test should be executed
167178
during fuzzing.
168179

180+
<p>To remove the default limit of 5 minutes, set this element to <code>""</code>.
181+
169182
<p>This option has no effect during regression testing.</div>
170183
<dl class="notes">
171184
<dt>Default:</dt>
172185
<dd>"5m"</dd>
173186
</dl>
174187
</section>
175188
</li>
189+
<li>
190+
<section class="detail" id="maxExecutions()">
191+
<h3>maxExecutions</h3>
192+
<div class="member-signature"><span class="return-type">long</span>&nbsp;<span class="element-name">maxExecutions</span></div>
193+
<div class="block">If set to a positive number, the fuzz test function will be executed at most this many times
194+
during fuzzing. Otherwise (default), there is no bound on the number of executions.
195+
196+
<p>Prefer this element over <a href="#maxDuration()"><code>maxDuration()</code></a> if you want to ensure comparable levels of
197+
fuzzing across machine's with different performance characteristics.
198+
199+
<p>This option has no effect during regression testing.</div>
200+
<dl class="notes">
201+
<dt>Default:</dt>
202+
<dd>0L</dd>
203+
</dl>
204+
</section>
205+
</li>
176206
</ul>
177207
</section>
178208
</li>

0 commit comments

Comments
 (0)