Skip to content

Commit 770e8f8

Browse files
committed
chore: add global MutationRuntime
For now it only stores the fuzz test method
1 parent 66cc9b4 commit 770e8f8

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

src/main/java/com/code_intelligence/jazzer/mutation/ArgumentsMutator.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import com.code_intelligence.jazzer.mutation.combinator.MutatorCombinators;
3131
import com.code_intelligence.jazzer.mutation.engine.SeededPseudoRandom;
3232
import com.code_intelligence.jazzer.mutation.mutator.Mutators;
33+
import com.code_intelligence.jazzer.mutation.runtime.MutationRuntime;
3334
import com.code_intelligence.jazzer.mutation.support.Preconditions;
3435
import com.code_intelligence.jazzer.utils.Log;
3536
import java.io.ByteArrayInputStream;
@@ -97,6 +98,8 @@ public static Optional<ArgumentsMutator> forMethod(
9798
Log.error(validationError.getMessage());
9899
throw validationError;
99100
}
101+
MutationRuntime.fuzzTestMethod = method;
102+
DictionaryProvider[] typeDictionaries = method.getAnnotationsByType(DictionaryProvider.class);
100103
return toArrayOrEmpty(
101104
stream(method.getAnnotatedParameterTypes())
102105
.map(

src/main/java/com/code_intelligence/jazzer/mutation/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ java_library(
1111
"//src/main/java/com/code_intelligence/jazzer/mutation/combinator",
1212
"//src/main/java/com/code_intelligence/jazzer/mutation/engine",
1313
"//src/main/java/com/code_intelligence/jazzer/mutation/mutator",
14+
"//src/main/java/com/code_intelligence/jazzer/mutation/runtime",
1415
"//src/main/java/com/code_intelligence/jazzer/mutation/support",
1516
"//src/main/java/com/code_intelligence/jazzer/utils:log",
1617
],
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
java_library(
2+
name = "runtime",
3+
srcs = glob(["*.java"]),
4+
visibility = [
5+
"//selffuzz/src/test/java/com/code_intelligence/selffuzz/mutation/mutator/lang:__pkg__",
6+
"//src/main/java/com/code_intelligence/jazzer/mutation:__pkg__",
7+
"//src/main/java/com/code_intelligence/jazzer/mutation:__subpackages__",
8+
"//src/test/java/com/code_intelligence/jazzer/mutation:__pkg__",
9+
"//src/test/java/com/code_intelligence/jazzer/mutation:__subpackages__",
10+
],
11+
)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2024 Code Intelligence GmbH
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.code_intelligence.jazzer.mutation.runtime;
18+
19+
import java.lang.reflect.Method;
20+
21+
/** Runtime information to be used by mutators. */
22+
public class MutationRuntime {
23+
/** The fuzz test method currently being executed. */
24+
public static Method fuzzTestMethod;
25+
}

0 commit comments

Comments
 (0)