-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBUILD
More file actions
69 lines (63 loc) · 2.71 KB
/
BUILD
File metadata and controls
69 lines (63 loc) · 2.71 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
load("@contrib_rules_jvm//java:defs.bzl", "JUNIT5_DEPS", "java_test_suite")
load("@rules_jvm_external//:defs.bzl", "artifact")
java_library(
name = "junit-jupiter-starter-bazel",
srcs = glob(["src/main/java/**/*.java"]),
)
java_test_suite(
name = "junit-jupiter-starter-bazel-tests",
size = "small",
srcs = glob(["src/test/java/**/*.java"]),
# Used when fuzzing with `bazel run`.
data = [
":generated_corpus_base",
# Provide the inputs directory when fuzzing---all findings will be written here.
":inputs_base",
],
env = {
# Also use the generated corpus directory when regression testing.
"JAZZER_COVERAGE": "1",
# Continue fuzzing until 10 unique (deduplicated) crashes are found.
# Same as "-Djazzer.keep_going=10" jvm_flag below
# "JAZZER_KEEP_GOING": "10",
},
jvm_flags = [
"-Djazzer.keep_going=10", # Continue fuzzing until 10 unique (deduplicated) crashes are found.
# "-Djazzer.internal.basedir=$${PWD}", # In case we want to change Jazzer's basedir
# Arguments to libFuzzer (active only in fuzzing mode). Have to be numbered starting from 0.
"-Djazzer.internal.arg.0=ignored", # Placeholder for the target class name. Must be present. Value is ignored.
"-Djazzer.internal.arg.1=-print_final_stats=1", # Prints libFuzzer stats when the process is terminated.
# "-Djazzer.internal.arg.2=-help=1", # Prints all arguments supported by libFuzzer and exits.
# Disable regex sanitizers during fuzzing and regression.
"-Djazzer.disabled_hooks=com.code_intelligence.jazzer.sanitizers.RegexRoadblocks:com.code_intelligence.jazzer.sanitizers.RegexInjection",
],
# Resources to be bundled into the test Jar. Only used when regression testing with Jazzer.
resources = glob(
[
# Bundle the input directories (crash files) and other resources into the Jar when regression testing.
"src/test/resources/**",
# Bundle the generated corpus directory into the Jar when regression testing.
".cifuzz-corpus/**",
],
allow_empty = True,
),
runner = "junit5",
test_suffixes = ["Tests.java"],
runtime_deps = JUNIT5_DEPS,
deps = [
":junit-jupiter-starter-bazel",
artifact("org.junit.jupiter:junit-jupiter-api"),
artifact("org.junit.jupiter:junit-jupiter-params"),
artifact("com.code-intelligence:jazzer-junit"),
],
)
filegroup(
name = "generated_corpus_base",
srcs = [".cifuzz-corpus"],
visibility = ["//visibility:public"],
)
filegroup(
name = "inputs_base",
srcs = ["src/test/resources"],
visibility = ["//visibility:public"],
)