mirror of https://github.com/grpc/grpc.git
parent
dbb131b193
commit
522bed8cc6
15 changed files with 7 additions and 173 deletions
@ -1,25 +0,0 @@ |
||||
# Copyright 2023 gRPC 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 |
||||
# |
||||
# 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. |
||||
|
||||
load(":grpc_fuzz_test.bzl", "grpc_fuzz_test") |
||||
|
||||
grpc_fuzz_test( |
||||
name = "fuzztest_test", |
||||
srcs = ["fuzztest_test.cc"], |
||||
external_deps = ["gtest"], |
||||
deps = [ |
||||
"@com_google_fuzztest//fuzztest", |
||||
"@com_google_fuzztest//fuzztest:fuzztest_gtest_main", |
||||
], |
||||
) |
@ -1,7 +0,0 @@ |
||||
Tests that leverage fuzztest. |
||||
|
||||
These require C++17 and so cannot be run with the standard build configurations. |
||||
|
||||
To run these tests: |
||||
|
||||
bazel run //fuzztest/path/to:test -c dbg --config fuzztest |
@ -1,24 +0,0 @@ |
||||
// Copyright 2023 gRPC 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
|
||||
//
|
||||
// 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.
|
||||
|
||||
// Test to verify Fuzztest integration
|
||||
|
||||
#include "fuzztest/fuzztest.h" |
||||
|
||||
#include "gtest/gtest.h" |
||||
|
||||
TEST(MyTestSuite, OnePlustTwoIsTwoPlusOne) { EXPECT_EQ(1 + 2, 2 + 1); } |
||||
|
||||
void IntegerAdditionCommutes(int a, int b) { EXPECT_EQ(a + b, b + a); } |
||||
FUZZ_TEST(MyTestSuite, IntegerAdditionCommutes); |
@ -1,28 +0,0 @@ |
||||
# Copyright 2023 gRPC 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 |
||||
# |
||||
# 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. |
||||
|
||||
""" |
||||
Rules for using fuzztest. |
||||
""" |
||||
|
||||
load("//bazel:grpc_build_system.bzl", "grpc_cc_test") |
||||
|
||||
def grpc_fuzz_test(name, srcs = [], deps = [], tags = [], external_deps = []): |
||||
grpc_cc_test( |
||||
name = name, |
||||
srcs = srcs, |
||||
tags = tags + ["grpc-fuzzer", "no-cache"], |
||||
deps = deps, |
||||
external_deps = external_deps, |
||||
) |
@ -1,43 +0,0 @@ |
||||
### DO NOT EDIT. Generated file. |
||||
# |
||||
# To regenerate, run the following from your project's workspace: |
||||
# |
||||
# bazel run @com_google_fuzztest//bazel:setup_configs > fuzztest.bazelrc |
||||
# |
||||
# And don't forget to add the following to your project's .bazelrc: |
||||
# |
||||
# try-import %workspace%/fuzztest.bazelrc |
||||
|
||||
|
||||
### Common options. |
||||
# |
||||
# Do not use directly. |
||||
|
||||
# Link with Address Sanitizer (ASAN). |
||||
build:fuzztest-common --linkopt=-fsanitize=address |
||||
|
||||
# Standard define for "ifdef-ing" any fuzz test specific code. |
||||
build:fuzztest-common --copt=-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION |
||||
|
||||
# In fuzz tests, we want to catch assertion violations even in optimized builds. |
||||
build:fuzztest-common --copt=-UNDEBUG |
||||
|
||||
|
||||
### FuzzTest build configuration. |
||||
# |
||||
# Use with: --config=fuzztest |
||||
|
||||
build:fuzztest --config=fuzztest-common |
||||
|
||||
# Link statically. |
||||
build:fuzztest --dynamic_mode=off |
||||
|
||||
# We rely on the following flag instead of the compiler provided |
||||
# __has_feature(address_sanitizer) to know that we have an ASAN build even in |
||||
# the uninstrumented runtime. |
||||
build:fuzztest --copt=-DADDRESS_SANITIZER |
||||
|
||||
# We apply coverage tracking and ASAN instrumentation to everything but the |
||||
# FuzzTest framework itself (including GoogleTest and GoogleMock). |
||||
build:fuzztest --per_file_copt=+//,-fuzztest/.*,-googletest/.*,-googlemock/.*@-fsanitize=address,-fsanitize-coverage=inline-8bit-counters,-fsanitize-coverage=trace-cmp |
||||
|
Loading…
Reference in new issue