-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pw_fuzzer: Improve .bazelrc fuzzing support
This CL drops the fuzztest.bazelrc generated by FuzzTest, and instead adds imports two new files from //pw_fuzzer: libfuzzer.bazelrc and fuzztest.bazelrc. These facilitate adding fuzzing support to downstream projects' .bazelrc files as well. Additionally, this CL fixes up the Bazel support for FuzzTest. It uses the //pw_toolchain/host_clang:asan_feature and adds a //pw_toolchain/host_clang:fuzztest_feature instead of using FuzzTest's approach of setting {c|link}opts directly. Finally, this CL extands the same support for libFuzzer, in the form of //pw_fuzzer/libfuzzer.bazelrc. Bug: b/347696410 Change-Id: I39ae203574a1065f76a6ca0ac0b1e08242cb380a Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/216112 Reviewed-by: Ted Pudlik <[email protected]> Lint: Lint 🤖 <[email protected]> Commit-Queue: Aaron Green <[email protected]>
- Loading branch information
1 parent
82759cc
commit 993b55e
Showing
12 changed files
with
149 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright 2024 The Pigweed Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
# Adapted from @com_google_fuzztest//bazel:setup_configs | ||
|
||
build:fuzztest --@pigweed//pw_toolchain/host_clang:fuzztest | ||
build:fuzztest --dynamic_mode=off | ||
build:fuzztest \ | ||
--per_file_copt=+//,-fuzztest/.*,-googletest/.*,-googlemock/.*@-fsanitize-coverage=inline-8bit-counters,-fsanitize-coverage=trace-cmp | ||
build:fuzztest \ | ||
--@pigweed//pw_fuzzer:fuzztest_backend=@com_google_fuzztest//fuzztest:fuzztest_core | ||
build:fuzztest \ | ||
--@pigweed//pw_unit_test:backend=@pigweed//pw_unit_test:googletest | ||
build:fuzztest \ | ||
--@pigweed//pw_unit_test:main=@com_google_fuzztest//fuzztest:fuzztest_gtest_main | ||
|
||
# For fuzzing, we want to disregard any test strategy options and execute each | ||
# test locally and one at a time. We also want to display as much information as | ||
# soon as it is available, including PRNG seeds and corpus statistics. | ||
# Both of these are achieved by streaming the test output. | ||
test:fuzztest --test_output=streamed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2024 The Pigweed Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
# TODO(b/347696410): Currently, building with `--config=libfuzzer` causes link | ||
# errors for `pw_target_runner`. | ||
|
||
build:libfuzzer \ | ||
--@rules_fuzzing//fuzzing:cc_engine=@rules_fuzzing//fuzzing/engines:libfuzzer | ||
build:libfuzzer \ | ||
--@rules_fuzzing//fuzzing:cc_engine_instrumentation=libfuzzer | ||
build:libfuzzer --@rules_fuzzing//fuzzing:cc_engine_sanitizer=asan | ||
|
||
test:libfuzzer --test_output=streamed | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.