-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test project for the Bazel fuzzing rules. #4936
Merged
inferno-chromium
merged 7 commits into
google:master
from
stefanbucur:bazel-rules-fuzzing
Jan 22, 2021
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7b12cff
Proof of concept for Bazel support in OSS Fuzz.
stefanbucur 337be0a
Moved the Bazel rules project under a directory with a "-test" suffix…
stefanbucur 18f07db
Added copyright header.
stefanbucur bd9b8e7
Update year in copyright note.
stefanbucur 326f454
Factor out the '_oss_fuzz' package suffix to bash var.
stefanbucur fc20604
Moving 'disabled' attribute at the end of the yaml file.
stefanbucur c284ed9
Simplified Dockerfile due to base image update.
stefanbucur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2021 Google LLC | ||
# | ||
# 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 | ||
# | ||
# http://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. | ||
# | ||
################################################################################ | ||
|
||
FROM gcr.io/oss-fuzz-base/base-builder | ||
|
||
RUN git clone https://github.com/bazelbuild/rules_fuzzing.git | ||
WORKDIR $SRC/rules_fuzzing/ | ||
COPY build.sh $SRC/ |
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,29 @@ | ||
#!/bin/bash -eu | ||
# | ||
# Copyright 2021 Google LLC | ||
# | ||
# 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 | ||
# | ||
# http://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. | ||
# | ||
################################################################################ | ||
|
||
declare -r QUERY=' | ||
let all_fuzz_tests = attr(tags, "fuzz-test", "//...") in | ||
$all_fuzz_tests - attr(tags, "no-oss-fuzz", $all_fuzz_tests) | ||
' | ||
declare -r PACKAGE_SUFFIX="_oss_fuzz" | ||
declare -r OSS_FUZZ_TESTS="$(bazel query "${QUERY}" | sed "s/$/${PACKAGE_SUFFIX}/")" | ||
|
||
bazel build -c opt --config=oss-fuzz --linkopt=-lc++ ${OSS_FUZZ_TESTS[*]} | ||
for oss_fuzz_archive in $(find bazel-bin/ -name "*${PACKAGE_SUFFIX}.tar"); do | ||
tar -xvf "${oss_fuzz_archive}" -C "${OUT}" | ||
done |
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,18 @@ | ||
homepage: "https://github.com/bazelbuild/rules_fuzzing" | ||
language: c++ | ||
primary_contact: "test@example.com" | ||
|
||
fuzzing_engines: | ||
- libfuzzer | ||
- afl | ||
- honggfuzz | ||
- dataflow | ||
|
||
sanitizers: | ||
- address | ||
- undefined | ||
- memory | ||
- dataflow | ||
|
||
# This is a test project. | ||
disabled: true |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is test project, it is good to add comments on each step in this file. Can you do this in next PR. Also, need to remember to add docs on subsection of https://google.github.io/oss-fuzz/getting-started/new-project-guide/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just seen this. Let me do this in #5039.
Good point, let me do this in a subsequent PR. I'm planning to overhaul documentation in the
rules_fuzzing
library, too.