Skip to content

Commit 1b9ddac

Browse files
authored
Add aliases for OSS-Fuzz engines (bazel-contrib#258)
This allows Bzlmod users to reference the engines without reaching into rules_fuzzing internals.
1 parent a8d424d commit 1b9ddac

File tree

3 files changed

+34
-10
lines changed

3 files changed

+34
-10
lines changed

.bazelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ build:asan-ubsan-replay --//fuzzing:cc_engine=//fuzzing/engines:replay
8484
build:asan-ubsan-replay --@rules_fuzzing//fuzzing:cc_engine_instrumentation=none
8585
build:asan-ubsan-replay --@rules_fuzzing//fuzzing:cc_engine_sanitizer=asan-ubsan
8686

87-
build:oss-fuzz --//fuzzing:cc_engine=@rules_fuzzing_oss_fuzz//:oss_fuzz_engine
88-
build:oss-fuzz --//fuzzing:java_engine=@rules_fuzzing_oss_fuzz//:oss_fuzz_java_engine
87+
build:oss-fuzz --//fuzzing:cc_engine=@rules_fuzzing//fuzzing/engines:oss_fuzz
88+
build:oss-fuzz --//fuzzing:java_engine=@rules_fuzzing//fuzzing/engines:oss_fuzz_java
8989
build:oss-fuzz --@rules_fuzzing//fuzzing:cc_engine_instrumentation=oss-fuzz
9090
build:oss-fuzz --@rules_fuzzing//fuzzing:cc_engine_sanitizer=none
9191

docs/guide.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1+
<!-- omit from toc -->
12
# Bazel Rules User Guide
23

4+
<!-- omit from toc -->
35
## Contents
46

5-
* [Defining fuzz tests](#defining-fuzz-tests)
6-
* [Integrating in your project](#integrating-in-your-project)
7-
* [Advanced topics](#advanced-topics)
8-
* [Defining fuzzing engines](#defining-fuzzing-engines)
9-
* [Customizing fuzz tests](#customizing-fuzz-tests)
10-
* [Rule reference](#rule-reference)
7+
- [Defining fuzz tests](#defining-fuzz-tests)
8+
- [Defining fuzz tests](#defining-fuzz-tests-1)
9+
- [Building and running](#building-and-running)
10+
- [Specifying seed corpora](#specifying-seed-corpora)
11+
- [Specifying dictionaries](#specifying-dictionaries)
12+
- [The fuzz test launcher](#the-fuzz-test-launcher)
13+
- [Built-in fuzzing engines](#built-in-fuzzing-engines)
14+
- [Configuration flags](#configuration-flags)
15+
- [Integrating in your project](#integrating-in-your-project)
16+
- [Configuring the .bazelrc file](#configuring-the-bazelrc-file)
17+
- [Advanced topics](#advanced-topics)
18+
- [Defining fuzzing engines](#defining-fuzzing-engines)
19+
- [Rule reference](#rule-reference)
1120

1221
## Defining fuzz tests
1322

@@ -121,11 +130,11 @@ Currently, the launcher offers the following options:
121130

122131
* `@rules_fuzzing//fuzzing/engines:libfuzzer` provides libFuzzer support. Must be used with the `libfuzzer` engine instrumentation.
123132

124-
* `@rules_fuzzing//fuzzing/engines:honggfuzz` provides Honggfuzz support. Must be used with the `honggfuzz` engine instrumentation. Requires importing its dependencies using the `honggfuzz_dependencies()` WORKSPACE function.
133+
* `@rules_fuzzing//fuzzing/engines:honggfuzz` provides Honggfuzz support. Must be used with the `honggfuzz` engine instrumentation. When using WORKSPACE, requires importing its dependencies using the `honggfuzz_dependencies()` WORKSPACE function.
125134

126135
* `@rules_fuzzing//fuzzing/engines:replay` provides a simple engine that just executes a set of test files. It can be combined with a sanitizer and can be used for regression tests or replaying crashes.
127136

128-
* `@rules_fuzzing_oss_fuzz//:oss_fuzz_engine` provides a fuzzing engine that reflects the environment configuration of an [OSS-Fuzz build][bazel-oss-fuzz]. This engine is useful in the `build.sh` script of an OSS-Fuzz project. Requires importing its dependencies using the `oss_fuzz_dependencies()` WORKSPACE function.
137+
* `@rules_fuzzing//fuzzing/engines:oss_fuzz` and `:oss_fuzz_java` provide fuzzing engines that reflect the environment configuration of an [OSS-Fuzz build][bazel-oss-fuzz]. These engines are useful in the `build.sh` script of an OSS-Fuzz project. When using WORKSPACE, this requires importing its dependencies using the `oss_fuzz_dependencies()` function.
129138

130139
### Configuration flags
131140

fuzzing/engines/BUILD

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,18 @@ java_library(
8080
"@rules_fuzzing_jazzer_api//jar",
8181
],
8282
)
83+
84+
# OSS-Fuzz specification.
85+
#########################
86+
87+
alias(
88+
name = "oss_fuzz",
89+
actual = "@rules_fuzzing_oss_fuzz//:oss_fuzz_engine",
90+
visibility = ["//visibility:public"],
91+
)
92+
93+
alias(
94+
name = "oss_fuzz_java",
95+
actual = "@rules_fuzzing_oss_fuzz//:oss_fuzz_java_engine",
96+
visibility = ["//visibility:public"],
97+
)

0 commit comments

Comments
 (0)