Merge github.com:grpc/grpc into qps_failya

pull/12856/head
Craig Tiller 7 years ago
commit e08e39d148
  1. 12
      CMakeLists.txt
  2. 12
      Makefile
  3. 2
      binding.gyp
  4. 2
      build.yaml
  5. 2
      config.m4
  6. 2
      config.w32
  7. 2
      gRPC-Core.podspec
  8. 2
      grpc.gemspec
  9. 8
      grpc.gyp
  10. 2
      package.xml
  11. 4
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
  12. 2
      src/python/grpcio/grpc_core_dependencies.py
  13. 14
      test/core/slice/BUILD
  14. 8
      test/core/util/BUILD
  15. 136
      test/core/util/fuzzer_corpus_test.cc
  16. 20
      test/core/util/grpc_fuzzer.bzl
  17. 2
      tools/doxygen/Doxyfile.core.internal
  18. 2
      tools/run_tests/generated/sources_and_headers.json

@ -954,7 +954,7 @@ endif (gRPC_BUILD_TESTS)
add_library(grpc
src/core/lib/surface/init.cc
src/core/lib/backoff/backoff.c
src/core/lib/backoff/backoff.cc
src/core/lib/channel/channel_args.cc
src/core/lib/channel/channel_stack.cc
src/core/lib/channel/channel_stack_builder.cc
@ -1306,7 +1306,7 @@ endif()
add_library(grpc_cronet
src/core/lib/surface/init.cc
src/core/lib/backoff/backoff.c
src/core/lib/backoff/backoff.cc
src/core/lib/channel/channel_args.cc
src/core/lib/channel/channel_stack.cc
src/core/lib/channel/channel_stack_builder.cc
@ -1626,7 +1626,7 @@ add_library(grpc_test_util
test/core/util/port_server_client.c
test/core/util/slice_splitter.c
test/core/util/trickle_endpoint.c
src/core/lib/backoff/backoff.c
src/core/lib/backoff/backoff.cc
src/core/lib/channel/channel_args.cc
src/core/lib/channel/channel_stack.cc
src/core/lib/channel/channel_stack_builder.cc
@ -1890,7 +1890,7 @@ add_library(grpc_test_util_unsecure
test/core/util/port_server_client.c
test/core/util/slice_splitter.c
test/core/util/trickle_endpoint.c
src/core/lib/backoff/backoff.c
src/core/lib/backoff/backoff.cc
src/core/lib/channel/channel_args.cc
src/core/lib/channel/channel_stack.cc
src/core/lib/channel/channel_stack_builder.cc
@ -2140,7 +2140,7 @@ endif (gRPC_BUILD_TESTS)
add_library(grpc_unsecure
src/core/lib/surface/init.cc
src/core/lib/surface/init_unsecure.cc
src/core/lib/backoff/backoff.c
src/core/lib/backoff/backoff.cc
src/core/lib/channel/channel_args.cc
src/core/lib/channel/channel_stack.cc
src/core/lib/channel/channel_stack_builder.cc
@ -2898,7 +2898,7 @@ add_library(grpc++_cronet
src/core/ext/transport/chttp2/transport/stream_map.cc
src/core/ext/transport/chttp2/transport/varint.cc
src/core/ext/transport/chttp2/transport/writing.cc
src/core/lib/backoff/backoff.c
src/core/lib/backoff/backoff.cc
src/core/lib/channel/channel_args.cc
src/core/lib/channel/channel_stack.cc
src/core/lib/channel/channel_stack_builder.cc

@ -2945,7 +2945,7 @@ endif
LIBGRPC_SRC = \
src/core/lib/surface/init.cc \
src/core/lib/backoff/backoff.c \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
src/core/lib/channel/channel_stack.cc \
src/core/lib/channel/channel_stack_builder.cc \
@ -3297,7 +3297,7 @@ endif
LIBGRPC_CRONET_SRC = \
src/core/lib/surface/init.cc \
src/core/lib/backoff/backoff.c \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
src/core/lib/channel/channel_stack.cc \
src/core/lib/channel/channel_stack_builder.cc \
@ -3616,7 +3616,7 @@ LIBGRPC_TEST_UTIL_SRC = \
test/core/util/port_server_client.c \
test/core/util/slice_splitter.c \
test/core/util/trickle_endpoint.c \
src/core/lib/backoff/backoff.c \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
src/core/lib/channel/channel_stack.cc \
src/core/lib/channel/channel_stack_builder.cc \
@ -3871,7 +3871,7 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \
test/core/util/port_server_client.c \
test/core/util/slice_splitter.c \
test/core/util/trickle_endpoint.c \
src/core/lib/backoff/backoff.c \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
src/core/lib/channel/channel_stack.cc \
src/core/lib/channel/channel_stack_builder.cc \
@ -4099,7 +4099,7 @@ endif
LIBGRPC_UNSECURE_SRC = \
src/core/lib/surface/init.cc \
src/core/lib/surface/init_unsecure.cc \
src/core/lib/backoff/backoff.c \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
src/core/lib/channel/channel_stack.cc \
src/core/lib/channel/channel_stack_builder.cc \
@ -4840,7 +4840,7 @@ LIBGRPC++_CRONET_SRC = \
src/core/ext/transport/chttp2/transport/stream_map.cc \
src/core/ext/transport/chttp2/transport/varint.cc \
src/core/ext/transport/chttp2/transport/writing.cc \
src/core/lib/backoff/backoff.c \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
src/core/lib/channel/channel_stack.cc \
src/core/lib/channel/channel_stack_builder.cc \

@ -657,7 +657,7 @@
],
'sources': [
'src/core/lib/surface/init.cc',
'src/core/lib/backoff/backoff.c',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
'src/core/lib/channel/channel_stack.cc',
'src/core/lib/channel/channel_stack_builder.cc',

@ -182,7 +182,7 @@ filegroups:
- grpc++_codegen_base
- name: grpc_base
src:
- src/core/lib/backoff/backoff.c
- src/core/lib/backoff/backoff.cc
- src/core/lib/channel/channel_args.cc
- src/core/lib/channel/channel_stack.cc
- src/core/lib/channel/channel_stack_builder.cc

@ -85,7 +85,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/support/tmpfile_windows.cc \
src/core/lib/support/wrap_memcpy.cc \
src/core/lib/surface/init.cc \
src/core/lib/backoff/backoff.c \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
src/core/lib/channel/channel_stack.cc \
src/core/lib/channel/channel_stack_builder.cc \

@ -62,7 +62,7 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\support\\tmpfile_windows.cc " +
"src\\core\\lib\\support\\wrap_memcpy.cc " +
"src\\core\\lib\\surface\\init.cc " +
"src\\core\\lib\\backoff\\backoff.c " +
"src\\core\\lib\\backoff\\backoff.cc " +
"src\\core\\lib\\channel\\channel_args.cc " +
"src\\core\\lib\\channel\\channel_stack.cc " +
"src\\core\\lib\\channel\\channel_stack_builder.cc " +

@ -460,7 +460,7 @@ Pod::Spec.new do |s|
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h',
'src/core/ext/filters/workarounds/workaround_utils.h',
'src/core/lib/surface/init.cc',
'src/core/lib/backoff/backoff.c',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
'src/core/lib/channel/channel_stack.cc',
'src/core/lib/channel/channel_stack_builder.cc',

@ -407,7 +407,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h )
s.files += %w( src/core/ext/filters/workarounds/workaround_utils.h )
s.files += %w( src/core/lib/surface/init.cc )
s.files += %w( src/core/lib/backoff/backoff.c )
s.files += %w( src/core/lib/backoff/backoff.cc )
s.files += %w( src/core/lib/channel/channel_args.cc )
s.files += %w( src/core/lib/channel/channel_stack.cc )
s.files += %w( src/core/lib/channel/channel_stack_builder.cc )

@ -223,7 +223,7 @@
],
'sources': [
'src/core/lib/surface/init.cc',
'src/core/lib/backoff/backoff.c',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
'src/core/lib/channel/channel_stack.cc',
'src/core/lib/channel/channel_stack_builder.cc',
@ -525,7 +525,7 @@
'test/core/util/port_server_client.c',
'test/core/util/slice_splitter.c',
'test/core/util/trickle_endpoint.c',
'src/core/lib/backoff/backoff.c',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
'src/core/lib/channel/channel_stack.cc',
'src/core/lib/channel/channel_stack_builder.cc',
@ -732,7 +732,7 @@
'test/core/util/port_server_client.c',
'test/core/util/slice_splitter.c',
'test/core/util/trickle_endpoint.c',
'src/core/lib/backoff/backoff.c',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
'src/core/lib/channel/channel_stack.cc',
'src/core/lib/channel/channel_stack_builder.cc',
@ -924,7 +924,7 @@
'sources': [
'src/core/lib/surface/init.cc',
'src/core/lib/surface/init_unsecure.cc',
'src/core/lib/backoff/backoff.c',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
'src/core/lib/channel/channel_stack.cc',
'src/core/lib/channel/channel_stack_builder.cc',

@ -419,7 +419,7 @@
<file baseinstalldir="/" name="src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/workarounds/workaround_utils.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/init.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/backoff/backoff.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/backoff/backoff.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_args.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack_builder.cc" role="src" />

@ -1010,6 +1010,10 @@ static void glb_shutdown_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) {
grpc_timer_cancel(exec_ctx, &glb_policy->lb_call_retry_timer);
glb_policy->retry_timer_active = false;
}
if (glb_policy->fallback_timer_active) {
grpc_timer_cancel(exec_ctx, &glb_policy->lb_fallback_timer);
glb_policy->fallback_timer_active = false;
}
pending_pick *pp = glb_policy->pending_picks;
glb_policy->pending_picks = NULL;

@ -61,7 +61,7 @@ CORE_SOURCE_FILES = [
'src/core/lib/support/tmpfile_windows.cc',
'src/core/lib/support/wrap_memcpy.cc',
'src/core/lib/surface/init.cc',
'src/core/lib/backoff/backoff.c',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
'src/core/lib/channel/channel_stack.cc',
'src/core/lib/channel/channel_stack_builder.cc',

@ -20,11 +20,23 @@ licenses(["notice"]) # Apache v2
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "percent_encode_fuzzer",
srcs = ["percent_encode_fuzzer.c"],
language = "C",
corpus = "percent_encode_corpus",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:grpc_test_util",
],
)
grpc_fuzzer(
name = "percent_decode_fuzzer",
srcs = ["percent_decode_fuzzer.c"],
language = "C",
corpus = "response_corpus",
corpus = "percent_decode_corpus",
deps = [
"//:gpr",
"//:grpc",

@ -89,12 +89,16 @@ grpc_cc_library(
)
grpc_cc_library(
name = "one_corpus_entry_fuzzer",
srcs = ["one_corpus_entry_fuzzer.c"],
name = "fuzzer_corpus_test",
srcs = ["fuzzer_corpus_test.cc"],
deps = [
":gpr_test_util",
"//:grpc",
],
external_deps = [
"gtest",
"gflags",
],
)
sh_library(

@ -0,0 +1,136 @@
/*
*
* Copyright 2016 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.
*
*/
#include <stdbool.h>
#include <dirent.h>
#include <gflags/gflags.h>
#include <grpc/support/log.h>
#include <gtest/gtest.h>
#include <stdio.h>
#include <sys/types.h>
#include "src/core/lib/iomgr/load_file.h"
#include "test/core/util/test_config.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
extern "C" bool squelch;
extern "C" bool leak_check;
DEFINE_string(file, "", "Use this file as test data");
DEFINE_string(directory, "", "Use this directory as test data");
class FuzzerCorpusTest : public ::testing::TestWithParam<std::string> {};
TEST_P(FuzzerCorpusTest, RunOneExample) {
gpr_log(GPR_DEBUG, "Example file: %s", GetParam().c_str());
grpc_slice buffer;
squelch = false;
leak_check = false;
GPR_ASSERT(GRPC_LOG_IF_ERROR("load_file",
grpc_load_file(GetParam().c_str(), 0, &buffer)));
LLVMFuzzerTestOneInput(GRPC_SLICE_START_PTR(buffer),
GRPC_SLICE_LENGTH(buffer));
grpc_slice_unref(buffer);
}
class ExampleGenerator
: public ::testing::internal::ParamGeneratorInterface<std::string> {
public:
virtual ::testing::internal::ParamIteratorInterface<std::string>* Begin()
const;
virtual ::testing::internal::ParamIteratorInterface<std::string>* End() const;
private:
void Materialize() const {
if (examples_.empty()) {
if (!FLAGS_file.empty()) examples_.push_back(FLAGS_file);
if (!FLAGS_directory.empty()) {
DIR* dp;
struct dirent* ep;
dp = opendir(FLAGS_directory.c_str());
if (dp != NULL) {
while ((ep = readdir(dp)) != nullptr) {
if (ep->d_type == DT_REG) {
examples_.push_back(FLAGS_directory + "/" + ep->d_name);
}
}
(void)closedir(dp);
} else {
perror("Couldn't open the directory");
abort();
}
}
}
}
mutable std::vector<std::string> examples_;
};
class ExampleIterator
: public ::testing::internal::ParamIteratorInterface<std::string> {
public:
ExampleIterator(const ExampleGenerator& base_,
std::vector<std::string>::const_iterator begin)
: base_(base_), begin_(begin), current_(begin) {}
virtual const ExampleGenerator* BaseGenerator() const { return &base_; }
virtual void Advance() { current_++; }
virtual ExampleIterator* Clone() const { return new ExampleIterator(*this); }
virtual const std::string* Current() const { return &*current_; }
virtual bool Equals(const ParamIteratorInterface<std::string>& other) const {
return &base_ == other.BaseGenerator() &&
current_ == dynamic_cast<const ExampleIterator*>(&other)->current_;
}
private:
ExampleIterator(const ExampleIterator& other)
: base_(other.base_), begin_(other.begin_), current_(other.current_) {}
const ExampleGenerator& base_;
const std::vector<std::string>::const_iterator begin_;
std::vector<std::string>::const_iterator current_;
};
::testing::internal::ParamIteratorInterface<std::string>*
ExampleGenerator::Begin() const {
Materialize();
return new ExampleIterator(*this, examples_.begin());
}
::testing::internal::ParamIteratorInterface<std::string>*
ExampleGenerator::End() const {
Materialize();
return new ExampleIterator(*this, examples_.end());
}
INSTANTIATE_TEST_CASE_P(
CorpusExamples, FuzzerCorpusTest,
::testing::internal::ParamGenerator<std::string>(new ExampleGenerator));
int main(int argc, char** argv) {
grpc_test_init(argc, argv);
::gflags::ParseCommandLineFlags(&argc, &argv, true);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

@ -12,19 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary")
load("//bazel:grpc_build_system.bzl", "grpc_cc_test")
def grpc_fuzzer(name, corpus, srcs = [], deps = [], **kwargs):
grpc_cc_binary(
name = '%s/one_entry.bin' % name,
grpc_cc_test(
name = name,
srcs = srcs,
deps = deps + ["//test/core/util:one_corpus_entry_fuzzer"],
deps = deps + ["//test/core/util:fuzzer_corpus_test"],
data = [corpus],
args = ['--directory', '$(location %s)' % corpus],
external_deps = [
'gtest',
],
**kwargs
)
for entry in native.glob(['%s/*' % corpus]):
native.sh_test(
name = '%s/one_entry/%s' % (name, entry),
data = [':%s/one_entry.bin' % name, entry],
srcs = ['//test/core/util:fuzzer_one_entry_runner'],
args = ['$(location :%s/one_entry.bin)' % name, '$(location %s)' % entry]
)

@ -1056,7 +1056,7 @@ src/core/ext/transport/inproc/inproc_plugin.cc \
src/core/ext/transport/inproc/inproc_transport.cc \
src/core/ext/transport/inproc/inproc_transport.h \
src/core/lib/README.md \
src/core/lib/backoff/backoff.c \
src/core/lib/backoff/backoff.cc \
src/core/lib/backoff/backoff.h \
src/core/lib/channel/README.md \
src/core/lib/channel/channel_args.cc \

@ -7994,7 +7994,7 @@
"language": "c",
"name": "grpc_base",
"src": [
"src/core/lib/backoff/backoff.c",
"src/core/lib/backoff/backoff.cc",
"src/core/lib/channel/channel_args.cc",
"src/core/lib/channel/channel_stack.cc",
"src/core/lib/channel/channel_stack_builder.cc",

Loading…
Cancel
Save