aboutsummaryrefslogtreecommitdiff
path: root/driver/BUILD.bazel
blob: 2c17b9478937df9ffe5507a318dccec3eca5a6e4 (plain)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
load(
    "@bazel_tools//tools/jdk:default_java_toolchain.bzl",
    "java_runtime_files",
)
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")

cc_library(
    name = "sanitizer_hooks_with_pc",
    srcs = ["sanitizer_hooks_with_pc.cpp"],
    hdrs = ["sanitizer_hooks_with_pc.h"],
)

cc_test(
    name = "sanitizer_hooks_with_pc_test",
    size = "small",
    srcs = ["sanitizer_hooks_with_pc_test.cpp"],
    deps = [
        ":sanitizer_hooks_with_pc",
        "@googletest//:gtest_main",
    ],
)

cc_library(
    name = "jvm_tooling_lib",
    srcs = [
        "coverage_tracker.cpp",
        "fuzz_target_runner.cpp",
        "fuzzed_data_provider.cpp",
        "jvm_tooling.cpp",
        "libfuzzer_callbacks.cpp",
        "libfuzzer_driver.cpp",
        "severity_annotator.cpp",
        "signal_handler.cpp",
        "utils.cpp",
    ],
    hdrs = [
        "coverage_tracker.h",
        "fuzz_target_runner.h",
        "fuzzed_data_provider.h",
        "java_reproducer_templates.h",
        "jvm_tooling.h",
        "libfuzzer_callbacks.h",
        "libfuzzer_driver.h",
        "sanitizer_hooks_with_pc.h",
        "severity_annotator.h",
        "signal_handler.h",
        "utils.h",
    ],
    visibility = ["//visibility:public"],
    deps = [
        ":sanitizer_hooks_with_pc",
        "//third_party/jni",
        "@com_github_gflags_gflags//:gflags",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/strings:str_format",
        "@com_google_glog//:glog",
    ],
)

cc_binary(
    name = "jazzer_driver",
    srcs = ["libfuzzer_fuzz_target.cpp"],
    data = [
        "//agent:jazzer_agent_deploy.jar",
    ],
    linkopts = [
        "-Wl,--wrap=__sanitizer_set_death_callback",
        "-fsanitize=fuzzer",
    ],
    visibility = ["//visibility:public"],
    deps = [
        ":jvm_tooling_lib",
    ],
)

cc_binary(
    name = "jazzer_driver_asan",
    srcs = ["libfuzzer_fuzz_target.cpp"],
    data = [
        "//agent:jazzer_agent_deploy.jar",
    ],
    linkopts = [
        "-Wl,--wrap=__sanitizer_set_death_callback",
        "-fsanitize=fuzzer,address",
    ],
    visibility = ["//visibility:public"],
    deps = [
        ":jvm_tooling_lib",
    ],
)

cc_test(
    name = "jvm_tooling_test",
    size = "small",
    srcs = [
        "jvm_tooling_test.cpp",
        "sanitizer_symbols_for_tests.cpp",
    ],
    args = [
        "--cp=$(location //driver/testdata:fuzz_target_mocks_deploy.jar)",
        "--agent_path=$(rootpath //agent:jazzer_agent_deploy.jar)",
    ],
    data = [
        "//agent:jazzer_agent_deploy.jar",
        "//driver/testdata:fuzz_target_mocks_deploy.jar",
    ],
    includes = ["."],
    deps = [
        ":jvm_tooling_lib",
        ":test_main",
        "@com_github_gflags_gflags//:gflags",
        "@googletest//:gtest",
    ],
)

cc_test(
    name = "fuzzed_data_provider_test",
    size = "medium",
    srcs = [
        "fuzzed_data_provider_test.cpp",
        "sanitizer_symbols_for_tests.cpp",
    ],
    args = [
        "--cp=$(location //driver/testdata:fuzz_target_mocks_deploy.jar)",
        "--agent_path=$(rootpath //agent:jazzer_agent_deploy.jar)",
    ],
    data = [
        "//agent:jazzer_agent_deploy.jar",
        "//driver/testdata:fuzz_target_mocks_deploy.jar",
    ],
    includes = ["."],
    deps = [
        ":jvm_tooling_lib",
        ":test_main",
        "@com_github_gflags_gflags//:gflags",
        "@googletest//:gtest",
    ],
)

cc_library(
    name = "test_main",
    srcs = ["test_main.cpp"],
    deps = [
        "@com_github_gflags_gflags//:gflags",
        "@googletest//:gtest",
    ],
)