aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Meumertzheim <meumertzheim@code-intelligence.com>2023-09-13 16:48:16 +0200
committerFabian Meumertzheim <fabian@meumertzhe.im>2023-09-15 09:36:58 +0200
commit94b558c16366b429bbb9168fbaa9dfe5c42540da (patch)
tree4dc79f429d7b2056b4b720a0bebf5c944f510bc4
parentabdd3e6d434f58cd4128bcccfec7d7387b846e12 (diff)
downloadjazzer-api-94b558c16366b429bbb9168fbaa9dfe5c42540da.tar.gz
BREAKING: junit: Set default lifecycle to `PER_TEST`
This is a temporary reversal of the breaking change in 1ca007d04325014d4fa0e48d239745f3ecc8fbcf until we support `TestInstancePostProcessor`s.
-rw-r--r--examples/junit/src/test/java/com/example/PerExecutionLifecycleFuzzTest.java3
-rw-r--r--examples/junit/src/test/java/com/example/PerTestLifecycleFuzzTest.java3
-rw-r--r--src/main/java/com/code_intelligence/jazzer/junit/FuzzTest.java2
3 files changed, 4 insertions, 4 deletions
diff --git a/examples/junit/src/test/java/com/example/PerExecutionLifecycleFuzzTest.java b/examples/junit/src/test/java/com/example/PerExecutionLifecycleFuzzTest.java
index 27aed6bb..87ba3170 100644
--- a/examples/junit/src/test/java/com/example/PerExecutionLifecycleFuzzTest.java
+++ b/examples/junit/src/test/java/com/example/PerExecutionLifecycleFuzzTest.java
@@ -21,6 +21,7 @@ import static java.util.Arrays.asList;
import static java.util.Collections.unmodifiableList;
import com.code_intelligence.jazzer.junit.FuzzTest;
+import com.code_intelligence.jazzer.junit.Lifecycle;
import com.example.PerExecutionLifecycleFuzzTest.LifecycleCallbacks1;
import com.example.PerExecutionLifecycleFuzzTest.LifecycleCallbacks2;
import com.example.PerExecutionLifecycleFuzzTest.LifecycleCallbacks3;
@@ -79,7 +80,7 @@ class PerExecutionLifecycleFuzzTest {
throw new AssertionError("This test should not be executed");
}
- @FuzzTest(maxExecutions = RUNS)
+ @FuzzTest(maxExecutions = RUNS, lifecycle = Lifecycle.PER_EXECUTION)
void lifecycleFuzz(byte[] data) {
events.add("lifecycleFuzz");
assertThat(beforeEachCalledOnInstance).isTrue();
diff --git a/examples/junit/src/test/java/com/example/PerTestLifecycleFuzzTest.java b/examples/junit/src/test/java/com/example/PerTestLifecycleFuzzTest.java
index cc31f957..181dc68a 100644
--- a/examples/junit/src/test/java/com/example/PerTestLifecycleFuzzTest.java
+++ b/examples/junit/src/test/java/com/example/PerTestLifecycleFuzzTest.java
@@ -21,7 +21,6 @@ import static java.util.Arrays.asList;
import static java.util.Collections.unmodifiableList;
import com.code_intelligence.jazzer.junit.FuzzTest;
-import com.code_intelligence.jazzer.junit.Lifecycle;
import com.example.PerTestLifecycleFuzzTest.LifecycleCallbacks1;
import com.example.PerTestLifecycleFuzzTest.LifecycleCallbacks2;
import com.example.PerTestLifecycleFuzzTest.LifecycleCallbacks3;
@@ -80,7 +79,7 @@ class PerTestLifecycleFuzzTest {
throw new AssertionError("This test should not be executed");
}
- @FuzzTest(maxExecutions = RUNS, lifecycle = Lifecycle.PER_TEST)
+ @FuzzTest(maxExecutions = RUNS)
void lifecycleFuzz(byte[] data) {
events.add("lifecycleFuzz");
assertThat(beforeEachCalledOnInstance).isTrue();
diff --git a/src/main/java/com/code_intelligence/jazzer/junit/FuzzTest.java b/src/main/java/com/code_intelligence/jazzer/junit/FuzzTest.java
index d8e4b5b6..7a4c4f81 100644
--- a/src/main/java/com/code_intelligence/jazzer/junit/FuzzTest.java
+++ b/src/main/java/com/code_intelligence/jazzer/junit/FuzzTest.java
@@ -131,7 +131,7 @@ public @interface FuzzTest {
* <p>During regression testing, fuzz tests always go through the full JUnit lifecycle for every
* execution regardless of the value of this option.
*/
- Lifecycle lifecycle() default Lifecycle.PER_EXECUTION;
+ Lifecycle lifecycle() default Lifecycle.PER_TEST;
}
// Internal use only.