Merge pull request #4 from grpc/master

Merging upstream changes
pull/20605/head
chrisse74 5 years ago committed by GitHub
commit 73ea205c33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/ISSUE_TEMPLATE/bug_report.md
  2. 2
      .github/ISSUE_TEMPLATE/cleanup_request.md
  3. 2
      .github/ISSUE_TEMPLATE/feature_request.md
  4. 2
      .github/pull_request_template.md
  5. 10
      BUILD
  6. 10
      CMakeLists.txt
  7. 4
      CONTRIBUTING.md
  8. 1
      GOVERNANCE.md
  9. 82
      MAINTAINERS.md
  10. 8
      examples/cpp/helloworld/.gitignore
  11. 6
      include/grpcpp/impl/codegen/config_protobuf.h
  12. 4
      include/grpcpp/impl/codegen/proto_buffer_reader.h
  13. 2
      include/grpcpp/impl/codegen/proto_buffer_writer.h
  14. 4
      package.xml
  15. 28
      src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
  16. 4
      src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc
  17. 2
      src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h
  18. 3
      src/core/ext/filters/max_age/max_age_filter.cc
  19. 10
      src/core/ext/transport/inproc/inproc_transport.cc
  20. 16
      src/core/lib/channel/channel_args.cc
  21. 14
      src/core/lib/channel/channel_args.h
  22. 35
      src/core/lib/iomgr/poller/eventmanager_interface.h
  23. 13
      src/core/lib/iomgr/socket_utils_common_posix.cc
  24. 4
      src/core/lib/iomgr/socket_utils_posix.h
  25. 15
      src/core/lib/iomgr/tcp_client_posix.cc
  26. 13
      src/core/lib/iomgr/tcp_server_utils_posix_common.cc
  27. 7
      src/core/lib/surface/channel.cc
  28. 4
      src/core/lib/surface/server.cc
  29. 5792
      src/core/tsi/grpc_shadow_boringssl.h
  30. 4
      src/csharp/docfx/generate_reference_docs.sh
  31. 2
      src/csharp/experimental/build_native_ext_for_ios.sh
  32. 5804
      src/objective-c/BoringSSL-GRPC.podspec
  33. 2
      src/objective-c/CronetFramework.podspec
  34. 5792
      src/objective-c/grpc_shadow_boringssl_symbol_list
  35. 119
      src/objective-c/tests/PerfTests/PerfTests.m
  36. 30
      src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/PerfTests.xcscheme
  37. 85
      src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/PerfTestsPosix.xcscheme
  38. 22
      src/objective-c/tests/run_one_test.sh
  39. 64
      src/php/ext/grpc/channel.c
  40. 18
      src/php/tests/MemoryLeakTest/MemoryLeakTest.php
  41. 10
      templates/CMakeLists.txt.template
  42. 4
      templates/package.xml.template
  43. 4
      templates/tools/dockerfile/interoptest/grpc_interop_aspnetcore/build_interop.sh.template
  44. 127
      test/core/channel/channel_args_test.cc
  45. 4
      test/core/channel/channelz_test.cc
  46. 10
      test/core/client_channel/service_config_test.cc
  47. 4
      test/core/debug/stats_test.cc
  48. 5
      test/core/end2end/fuzzers/server_fuzzer.cc
  49. BIN
      test/core/end2end/fuzzers/server_fuzzer_corpus/hope.bin
  50. 3
      test/core/end2end/h2_ssl_cert_test.cc
  51. 6
      test/core/transport/bdp_estimator_test.cc
  52. 2
      test/core/transport/pid_controller_test.cc
  53. 2
      test/core/util/fuzzer_corpus_test.cc
  54. 4
      test/cpp/common/time_jump_test.cc
  55. 11
      test/cpp/end2end/async_end2end_test.cc
  56. 4
      test/cpp/end2end/cfstream_test.cc
  57. 4
      test/cpp/end2end/client_callback_end2end_test.cc
  58. 89
      test/cpp/end2end/client_lb_end2end_test.cc
  59. 10
      test/cpp/end2end/end2end_test.cc
  60. 4
      test/cpp/end2end/flaky_network_test.cc
  61. 4
      test/cpp/end2end/hybrid_end2end_test.cc
  62. 12
      test/cpp/end2end/message_allocator_end2end_test.cc
  63. 4
      test/cpp/end2end/port_sharing_end2end_test.cc
  64. 4
      test/cpp/end2end/server_builder_plugin_test.cc
  65. 4
      test/cpp/end2end/shutdown_test.cc
  66. 34
      tools/distrib/generate_grpc_shadow_boringssl_symbol_list.sh
  67. 0
      tools/dockerfile/grpc_artifact_python_manylinux1_x64/Dockerfile
  68. 0
      tools/dockerfile/grpc_artifact_python_manylinux1_x86/Dockerfile
  69. 38
      tools/dockerfile/grpc_artifact_python_manylinux2010_x64/Dockerfile
  70. 4
      tools/dockerfile/interoptest/grpc_interop_aspnetcore/build_interop.sh
  71. 2
      tools/internal_ci/linux/grpc_e2e_performance_singlevm.sh
  72. 6
      tools/internal_ci/linux/grpc_full_performance_master.sh
  73. 6
      tools/internal_ci/linux/grpc_full_performance_release.sh
  74. 41
      tools/run_tests/artifacts/artifact_targets.py
  75. 4
      tools/run_tests/artifacts/build_artifact_python.sh
  76. 23
      tools/run_tests/generated/tests.json
  77. 11
      tools/run_tests/run_performance_tests.py
  78. 18
      tools/run_tests/run_tests.py
  79. 8
      tools/run_tests/run_tests_matrix.py

@ -2,7 +2,7 @@
name: Report a bug
about: Create a report to help us improve
labels: kind/bug, priority/P2
assignees: veblush
assignees: nicolasnoble
---

@ -2,7 +2,7 @@
name: Request a cleanup
about: Suggest a cleanup in our repository
labels: kind/internal cleanup
assignees: veblush
assignees: nicolasnoble
---

@ -2,7 +2,7 @@
name: Request a feature
about: Suggest an idea for this project
labels: kind/enhancement
assignees: veblush
assignees: nicolasnoble
---

@ -8,4 +8,4 @@ If you know who should review your pull request, please remove the mentioning be
-->
@veblush
@nicolasnoble

10
BUILD

@ -1958,6 +1958,7 @@ grpc_cc_library(
deps = [
"grpc",
"grpc++_codegen_base",
"grpc++_codegen_base_src",
"grpc_health_upb",
],
)
@ -1970,6 +1971,7 @@ grpc_cc_library(
public_hdrs = GRPCXX_PUBLIC_HDRS,
deps = [
"grpc++_codegen_base",
"grpc++_codegen_base_src",
"grpc_health_upb",
"grpc_unsecure",
],
@ -2519,3 +2521,11 @@ filegroup(
],
visibility = ["//visibility:public"],
)
# Base classes of EventManagerInterface
grpc_cc_library(
name = "eventmanager_interface",
hdrs = [
"src/core/lib/iomgr/poller/eventmanager_interface.h",
],
)

@ -100,14 +100,16 @@ if (MSVC)
include(cmake/msvc_static_runtime.cmake)
add_definitions(-D_WIN32_WINNT=0x600 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS)
# needed to compile protobuf
add_definitions(/wd4065 /wd4506)
set(_gRPC_C_CXX_FLAGS "${_gRPC_C_CXX_FLAGS} /wd4065 /wd4506")
# TODO(jtattermusch): revisit warnings that were silenced as part of upgrade to protobuf3.6.0
add_definitions(/wd4200 /wd4291 /wd4244)
set(_gRPC_C_CXX_FLAGS "${_gRPC_C_CXX_FLAGS} /wd4200 /wd4291 /wd4244")
# TODO(jtattermusch): revisit C4267 occurrences throughout the code
add_definitions(/wd4267)
set(_gRPC_C_CXX_FLAGS "${_gRPC_C_CXX_FLAGS} /wd4267")
# TODO(jtattermusch): needed to build boringssl with VS2017, revisit later
add_definitions(/wd4987 /wd4774 /wd4819 /wd4996 /wd4619)
set(_gRPC_C_CXX_FLAGS "${_gRPC_C_CXX_FLAGS} /wd4987 /wd4774 /wd4819 /wd4996 /wd4619")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_gRPC_C_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_gRPC_C_CXX_FLAGS}")
if (gRPC_USE_PROTO_LITE)
set(_gRPC_PROTOBUF_LIBRARY_NAME "libprotobuf-lite")

@ -1,6 +1,8 @@
# How to contribute
We definitely welcome your patches and contributions to gRPC!
We definitely welcome your patches and contributions to gRPC! Please read the gRPC
organization's [governance rules](https://github.com/grpc/grpc-community/blob/master/governance.md)
and [contribution guidelines](https://github.com/grpc/grpc-community/blob/master/CONTRIBUTING.md) before proceeding.
If you are new to github, please start by reading [Pull Request
howto](https://help.github.com/articles/about-pull-requests/)

@ -0,0 +1 @@
This repository is governed by the gRPC organization's [governance rules](https://github.com/grpc/grpc-community/blob/master/governance.md).

@ -0,0 +1,82 @@
This page lists all active maintainers of this repository. If you were a
maintainer and would like to add your name to the Emeritus list, please send us a
PR.
See [GOVERNANCE.md](https://github.com/grpc/grpc-community/blob/master/governance.md)
for governance guidelines and how to become a maintainer.
See [CONTRIBUTING.md](https://github.com/grpc/grpc-community/blob/master/CONTRIBUTING.md)
for general contribution guidelines.
## Maintainers (in alphabetical order)
- [a11r](https://github.com/a11r), Google LLC
- [apolcyn](https://github.com/apolcyn), Google LLC
- [arjunroy](https://github.com/arjunroy), Google LLC
- [AspirinSJL](https://github.com/AspirinSJL), Google LLC
- [bogdandrutu](https://github.com/bogdandrutu), Google LLC
- [daniel-j-born](https://github.com/daniel-j-born), Google LLC
- [dapengzhang0](https://github.com/dapengzhang0), Google LLC
- [dfawley](https://github.com/dfawley), Google LLC
- [dklempner](https://github.com/dklempner), Google LLC
- [ejona86](https://github.com/ejona86), Google LLC
- [gnossen](https://github.com/gnossen), Google LLC
- [guantaol](https://github.com/guantaol), Google LLC
- [hcaseyal](https://github.com/hcaseyal), Google LLC
- [jboeuf](https://github.com/jboeuf), Google LLC
- [jiangtaoli2016](https://github.com/jiangtaoli2016), Google LLC
- [jkolhe](https://github.com/jkolhe), Google LLC
- [jtattermusch](https://github.com/jtattermusch), Google LLC
- [karthikravis](https://github.com/karthikravis), Google LLC
- [kumaralokgithub](https://github.com/kumaralokgithub), Google LLC
- [lidizheng](https://github.com/lidizheng), Google LLC
- [markdroth](https://github.com/markdroth), Google LLC
- [matthewstevenson88](https://github.com/matthewstevenson88), Google LLC
- [mehrdada](https://github.com/mehrdada), Dropbox, Inc.
- [mhaidrygoog](https://github.com/mhaidrygoog), Google LLC
- [murgatroid99](https://github.com/murgatroid99), Google LLC
- [muxi](https://github.com/muxi), Google LLC
- [nanahpang](https://github.com/nanahpang), Google LLC
- [nathanielmanistaatgoogle](https://github.com/nathanielmanistaatgoogle), Google LLC
- [nicolasnoble](https://github.com/nicolasnoble), Google LLC
- [qixuanl1](https://github.com/qixuanl1), Google LLC
- [ran-su](https://github.com/ran-su), Google LLC
- [rmstar](https://github.com/rmstar), Google LLC
- [sanjaypujare](https://github.com/sanjaypujare), Google LLC
- [sheenaqotj](https://github.com/sheenaqotj), Google LLC
- [soheilhy](https://github.com/soheilhy), Google LLC
- [sreecha](https://github.com/sreecha), LinkedIn
- [srini100](https://github.com/srini100), Google LLC
- [stanley-cheung](https://github.com/stanley-cheung), Google LLC
- [veblush](https://github.com/veblush), Google LLC
- [vishalpowar](https://github.com/vishalpowar), Google LLC
- [Vizerai](https://github.com/Vizerai), Google LLC
- [vjpai](https://github.com/vjpai), Google LLC
- [wcevans](https://github.com/wcevans), Google LLC
- [wenbozhu](https://github.com/wenbozhu), Google LLC
- [yang-g](https://github.com/yang-g), Google LLC
- [yashykt](https://github.com/yashykt), Google LLC
- [yihuazhang](https://github.com/yihuazhang), Google LLC
- [ZhouyihaiDing](https://github.com/ZhouyihaiDing), Google LLC
## Emeritus Maintainers (in alphabetical order)
- [adelez](https://github.com/adelez), Google LLC
- [billfeng327](https://github.com/billfeng327), Google LLC
- [ctiller](https://github.com/ctiller), Google LLC
- [dgquintas](https://github.com/dgquintas), Google LLC
- [ericgribkoff](https://github.com/ericgribkoff), Google LLC
- [fengli79](https://github.com/fengli79), Google LLC
- [jcanizales](https://github.com/jcanizales), Google LLC
- [jpalmerLinuxFoundation](https://github.com/jpalmerLinuxFoundation), Linux Foundation
- [justinburke](https://github.com/justinburke), Google LLC
- [kpayson64](https://github.com/kpayson64), Google LLC
- [lyuxuan](https://github.com/lyuxuan), Google LLC
- [matt-kwong](https://github.com/matt-kwong), Google LLC
- [mit-mit](https://github.com/mit-mit), Google LLC
- [mpwarres](https://github.com/mpwarres), Google LLC
- [ncteisen](https://github.com/ncteisen), Google LLC
- [pmarks-net](https://github.com/pmarks-net), Google LLC
- [slash-lib](https://github.com/slash-lib), Google LLC
- [soltanmm](https://github.com/soltanmm), Google LLC
- [summerxyt](https://github.com/summerxyt), Google LLC
- [y-zeng](https://github.com/y-zeng), Google LLC
- [zpencer](https://github.com/zpencer), Google LLC

@ -0,0 +1,8 @@
*.o
*.pb.cc
*.pb.h
greeter_client
greeter_server
greeter_async_client
greeter_async_client2
greeter_async_server

@ -21,11 +21,6 @@
#define GRPC_OPEN_SOURCE_PROTO
#ifndef GRPC_CUSTOM_PROTOBUF_INT64
#include <google/protobuf/stubs/common.h>
#define GRPC_CUSTOM_PROTOBUF_INT64 ::google::protobuf::int64
#endif
#ifndef GRPC_CUSTOM_MESSAGE
#ifdef GRPC_USE_PROTO_LITE
#include <google/protobuf/message_lite.h>
@ -79,7 +74,6 @@ namespace protobuf {
typedef GRPC_CUSTOM_MESSAGE Message;
typedef GRPC_CUSTOM_MESSAGELITE MessageLite;
typedef GRPC_CUSTOM_PROTOBUF_INT64 int64;
typedef GRPC_CUSTOM_DESCRIPTOR Descriptor;
typedef GRPC_CUSTOM_DESCRIPTORPOOL DescriptorPool;

@ -121,9 +121,7 @@ class ProtoBufferReader : public ::grpc::protobuf::io::ZeroCopyInputStream {
}
/// Returns the total number of bytes read since this object was created.
grpc::protobuf::int64 ByteCount() const override {
return byte_count_ - backup_count_;
}
int64_t ByteCount() const override { return byte_count_ - backup_count_; }
// These protected members are needed to support internal optimizations.
// they expose internal bits of grpc core that are NOT stable. If you have

@ -138,7 +138,7 @@ class ProtoBufferWriter : public ::grpc::protobuf::io::ZeroCopyOutputStream {
}
/// Returns the total number of bytes written since this object was created.
grpc::protobuf::int64 ByteCount() const override { return byte_count_; }
int64_t ByteCount() const override { return byte_count_; }
// These protected members are needed to support internal optimizations.
// they expose internal bits of grpc core that are NOT stable. If you have

@ -10,7 +10,7 @@
<email>grpc-packages@google.com</email>
<active>yes</active>
</lead>
<date>2018-01-19</date>
<date>2019-09-24</date>
<time>16:06:07</time>
<version>
<release>1.25.0dev</release>
@ -22,7 +22,7 @@
</stability>
<license>Apache 2.0</license>
<notes>
- TBD
- gRPC Core 1.25.0 update
</notes>
<contents>
<dir baseinstalldir="/" name="/">

@ -88,14 +88,21 @@ class RoundRobin : public LoadBalancingPolicy {
return last_connectivity_state_;
}
bool seen_failure_since_ready() const { return seen_failure_since_ready_; }
// Performs connectivity state updates that need to be done both when we
// first start watching and when a watcher notification is received.
void UpdateConnectivityStateLocked(
grpc_connectivity_state connectivity_state);
private:
// Performs connectivity state updates that need to be done only
// after we have started watching.
void ProcessConnectivityChangeLocked(
grpc_connectivity_state connectivity_state) override;
grpc_connectivity_state last_connectivity_state_ = GRPC_CHANNEL_IDLE;
bool seen_failure_since_ready_ = false;
};
// A list of subchannels.
@ -375,8 +382,25 @@ void RoundRobin::RoundRobinSubchannelData::UpdateConnectivityStateLocked(
grpc_connectivity_state_name(last_connectivity_state_),
grpc_connectivity_state_name(connectivity_state));
}
subchannel_list()->UpdateStateCountersLocked(last_connectivity_state_,
connectivity_state);
// Decide what state to report for aggregation purposes.
// If we haven't seen a failure since the last time we were in state
// READY, then we report the state change as-is. However, once we do see
// a failure, we report TRANSIENT_FAILURE and do not report any subsequent
// state changes until we go back into state READY.
if (!seen_failure_since_ready_) {
if (connectivity_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
seen_failure_since_ready_ = true;
}
subchannel_list()->UpdateStateCountersLocked(last_connectivity_state_,
connectivity_state);
} else {
if (connectivity_state == GRPC_CHANNEL_READY) {
seen_failure_since_ready_ = false;
subchannel_list()->UpdateStateCountersLocked(
GRPC_CHANNEL_TRANSIENT_FAILURE, connectivity_state);
}
}
// Record last seen connectivity state.
last_connectivity_state_ = connectivity_state;
}

@ -66,7 +66,7 @@ bool XdsDropConfig::ShouldDrop(const UniquePtr<char>** category_name) const {
return false;
}
grpc_slice XdsEdsRequestCreateAndEncode(const char* service_name) {
grpc_slice XdsEdsRequestCreateAndEncode(const char* server_name) {
upb::Arena arena;
// Create a request.
envoy_api_v2_DiscoveryRequest* request =
@ -83,7 +83,7 @@ grpc_slice XdsEdsRequestCreateAndEncode(const char* service_name) {
google_protobuf_Struct_FieldsEntry_mutable_value(field, arena.ptr());
google_protobuf_Value_set_bool_value(value, true);
envoy_api_v2_DiscoveryRequest_add_resource_names(
request, upb_strview_makez(service_name), arena.ptr());
request, upb_strview_makez(server_name), arena.ptr());
envoy_api_v2_DiscoveryRequest_set_type_url(request,
upb_strview_makez(kEdsTypeUrl));
// Encode the request.

@ -99,7 +99,7 @@ struct XdsUpdate {
};
// Creates an EDS request querying \a service_name.
grpc_slice XdsEdsRequestCreateAndEncode(const char* service_name);
grpc_slice XdsEdsRequestCreateAndEncode(const char* server_name);
// Parses the EDS response and returns the args to update locality map. If there
// is any error, the output update is invalid.

@ -29,6 +29,9 @@
#include "src/core/lib/surface/channel_init.h"
#include "src/core/lib/transport/http2_errors.h"
/* If these settings change, make sure that we are not sending a GOAWAY for
* inproc transport, since a GOAWAY to inproc ends up destroying the transport.
*/
#define DEFAULT_MAX_CONNECTION_AGE_MS INT_MAX
#define DEFAULT_MAX_CONNECTION_AGE_GRACE_MS INT_MAX
#define DEFAULT_MAX_CONNECTION_IDLE_MS INT_MAX

@ -1226,10 +1226,15 @@ grpc_channel* grpc_inproc_channel_create(grpc_server* server,
grpc_core::ExecCtx exec_ctx;
const grpc_channel_args* server_args = grpc_server_get_channel_args(server);
// Remove max_connection_idle and max_connection_age channel arguments since
// those do not apply to inproc transports.
const char* args_to_remove[] = {GRPC_ARG_MAX_CONNECTION_IDLE_MS,
GRPC_ARG_MAX_CONNECTION_AGE_MS};
const grpc_channel_args* server_args = grpc_channel_args_copy_and_remove(
grpc_server_get_channel_args(server), args_to_remove,
GPR_ARRAY_SIZE(args_to_remove));
// Add a default authority channel argument for the client
grpc_arg default_authority_arg;
default_authority_arg.type = GRPC_ARG_STRING;
default_authority_arg.key = (char*)GRPC_ARG_DEFAULT_AUTHORITY;
@ -1249,6 +1254,7 @@ grpc_channel* grpc_inproc_channel_create(grpc_server* server,
"inproc", client_args, GRPC_CLIENT_DIRECT_CHANNEL, client_transport);
// Free up created channel args
grpc_channel_args_destroy(server_args);
grpc_channel_args_destroy(client_args);
// Now finish scheduled operations

@ -22,6 +22,8 @@
#include <string.h>
#include <grpc/grpc.h>
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/impl/codegen/log.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
@ -361,3 +363,17 @@ char* grpc_channel_args_string(const grpc_channel_args* args) {
gpr_strvec_destroy(&v);
return result;
}
namespace {
grpc_channel_args_client_channel_creation_mutator g_mutator = nullptr;
} // namespace
void grpc_channel_args_set_client_channel_creation_mutator(
grpc_channel_args_client_channel_creation_mutator cb) {
GPR_DEBUG_ASSERT(g_mutator == nullptr);
g_mutator = cb;
}
grpc_channel_args_client_channel_creation_mutator
grpc_channel_args_get_client_channel_creation_mutator() {
return g_mutator;
}

@ -23,6 +23,8 @@
#include <grpc/grpc.h>
#include "src/core/lib/surface/channel_stack_type.h"
// Channel args are intentionally immutable, to avoid the need for locking.
/** Copy the arguments in \a src into a new instance */
@ -108,4 +110,16 @@ grpc_arg grpc_channel_arg_pointer_create(char* name, void* value,
// Callers takes ownership of result.
char* grpc_channel_args_string(const grpc_channel_args* args);
// Takes ownership of the old_args
typedef grpc_channel_args* (*grpc_channel_args_client_channel_creation_mutator)(
const char* target, grpc_channel_args* old_args,
grpc_channel_stack_type type);
// Should be called only once globaly before grpc is init'ed.
void grpc_channel_args_set_client_channel_creation_mutator(
grpc_channel_args_client_channel_creation_mutator cb);
// This will be called at the creation of each channel.
grpc_channel_args_client_channel_creation_mutator
grpc_channel_args_get_client_channel_creation_mutator();
#endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_H */

@ -0,0 +1,35 @@
/*
*
* Copyright 2019 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.
*
*/
#ifndef GRPC_CORE_LIB_IOMGR_POLLER_EVENTMANAGER_INTERFACE_H
#define GRPC_CORE_LIB_IOMGR_POLLER_EVENTMANAGER_INTERFACE_H
namespace grpc {
namespace experimental {
class BaseEventManagerInterface {
public:
virtual ~BaseEventManagerInterface() {}
};
class EpollEventManagerInterface : public BaseEventManagerInterface {};
} // namespace experimental
} // namespace grpc
#endif /* GRPC_CORE_LIB_IOMGR_POLLER_EVENTMANAGER_INTERFACE_H */

@ -330,6 +330,19 @@ grpc_error* grpc_set_socket_with_mutator(int fd, grpc_socket_mutator* mutator) {
return GRPC_ERROR_NONE;
}
grpc_error* grpc_apply_socket_mutator_in_args(int fd,
const grpc_channel_args* args) {
const grpc_arg* socket_mutator_arg =
grpc_channel_args_find(args, GRPC_ARG_SOCKET_MUTATOR);
if (socket_mutator_arg == nullptr) {
return GRPC_ERROR_NONE;
}
GPR_DEBUG_ASSERT(socket_mutator_arg->type == GRPC_ARG_POINTER);
grpc_socket_mutator* mutator =
static_cast<grpc_socket_mutator*>(socket_mutator_arg->value.pointer.p);
return grpc_set_socket_with_mutator(fd, mutator);
}
static gpr_once g_probe_ipv6_once = GPR_ONCE_INIT;
static int g_ipv6_loopback_available;

@ -91,6 +91,10 @@ grpc_error* grpc_set_socket_rcvbuf(int fd, int buffer_size_bytes);
/* Tries to set the socket using a grpc_socket_mutator */
grpc_error* grpc_set_socket_with_mutator(int fd, grpc_socket_mutator* mutator);
/* Extracts the first socket mutator from args if any and applies on the fd. */
grpc_error* grpc_apply_socket_mutator_in_args(int fd,
const grpc_channel_args* args);
/* An enum to keep track of IPv4/IPv6 socket modes.
Currently, this information is only used when a socket is first created, but

@ -84,17 +84,10 @@ static grpc_error* prepare_socket(const grpc_resolved_address* addr, int fd,
}
err = grpc_set_socket_no_sigpipe_if_possible(fd);
if (err != GRPC_ERROR_NONE) goto error;
if (channel_args) {
for (size_t i = 0; i < channel_args->num_args; i++) {
if (0 == strcmp(channel_args->args[i].key, GRPC_ARG_SOCKET_MUTATOR)) {
GPR_ASSERT(channel_args->args[i].type == GRPC_ARG_POINTER);
grpc_socket_mutator* mutator = static_cast<grpc_socket_mutator*>(
channel_args->args[i].value.pointer.p);
err = grpc_set_socket_with_mutator(fd, mutator);
if (err != GRPC_ERROR_NONE) goto error;
}
}
}
err = grpc_apply_socket_mutator_in_args(fd, channel_args);
if (err != GRPC_ERROR_NONE) goto error;
goto done;
error:

@ -173,17 +173,8 @@ grpc_error* grpc_tcp_server_prepare_socket(grpc_tcp_server* s, int fd,
err = grpc_set_socket_no_sigpipe_if_possible(fd);
if (err != GRPC_ERROR_NONE) goto error;
if (s->channel_args) {
for (size_t i = 0; i < s->channel_args->num_args; i++) {
if (0 == strcmp(s->channel_args->args[i].key, GRPC_ARG_SOCKET_MUTATOR)) {
GPR_ASSERT(s->channel_args->args[i].type == GRPC_ARG_POINTER);
grpc_socket_mutator* mutator = static_cast<grpc_socket_mutator*>(
s->channel_args->args[i].value.pointer.p);
err = grpc_set_socket_with_mutator(fd, mutator);
if (err != GRPC_ERROR_NONE) goto error;
}
}
}
err = grpc_apply_socket_mutator_in_args(fd, s->channel_args);
if (err != GRPC_ERROR_NONE) goto error;
if (bind(fd, reinterpret_cast<grpc_sockaddr*>(const_cast<char*>(addr->addr)),
addr->len) < 0) {

@ -257,6 +257,13 @@ grpc_channel* grpc_channel_create(const char* target,
get_default_authority(input_args);
grpc_channel_args* args =
build_channel_args(input_args, default_authority.get());
if (grpc_channel_stack_type_is_client(channel_stack_type)) {
auto channel_args_mutator =
grpc_channel_args_get_client_channel_creation_mutator();
if (channel_args_mutator != nullptr) {
args = channel_args_mutator(target, args, channel_stack_type);
}
}
grpc_channel_stack_builder_set_channel_arguments(builder, args);
grpc_channel_args_destroy(args);
grpc_channel_stack_builder_set_target(builder, target);

@ -633,7 +633,7 @@ static void start_new_rpc(grpc_call_element* elem) {
for (i = 0; i <= chand->registered_method_max_probes; i++) {
rm = &chand->registered_methods[(hash + i) %
chand->registered_method_slots];
if (!rm) break;
if (rm->server_registered_method == nullptr) break;
if (!rm->has_host) continue;
if (!grpc_slice_eq(rm->host, calld->host)) continue;
if (!grpc_slice_eq(rm->method, calld->path)) continue;
@ -651,7 +651,7 @@ static void start_new_rpc(grpc_call_element* elem) {
for (i = 0; i <= chand->registered_method_max_probes; i++) {
rm = &chand->registered_methods[(hash + i) %
chand->registered_method_slots];
if (!rm) break;
if (rm->server_registered_method == nullptr) break;
if (rm->has_host) continue;
if (!grpc_slice_eq(rm->method, calld->path)) continue;
if ((rm->flags & GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST) &&

File diff suppressed because it is too large Load Diff

@ -20,9 +20,9 @@ cd $(dirname $0)
# cleanup temporary files
rm -rf html obj grpc-gh-pages
# generate into src/csharp/doc/html directory
# generate into src/csharp/docfx/html directory
cd ..
docker run --rm -v "$(pwd)":/work -w /work/doc --user "$(id -u):$(id -g)" -it tsgkadot/docker-docfx:latest docfx
docker run --rm -v "$(pwd)":/work -w /work/docfx --user "$(id -u):$(id -g)" -it tsgkadot/docker-docfx:latest docfx
cd docfx
# prepare a clone of "gh-pages" branch where the generated docs are stored

@ -28,7 +28,7 @@ function build {
PATH_CC="$(xcrun --sdk $SDK --find clang)"
PATH_CXX="$(xcrun --sdk $SDK --find clang++)"
CPPFLAGS="-O2 -Wframe-larger-than=16384 -arch $ARCH -isysroot $(xcrun --sdk $SDK --show-sdk-path) -fembed-bitcode -mios-version-min=6.0 -DPB_NO_PACKED_STRUCTS=1"
CPPFLAGS="-O2 -Wframe-larger-than=16384 -arch $ARCH -isysroot $(xcrun --sdk $SDK --show-sdk-path) -mios-version-min=6.0 -DPB_NO_PACKED_STRUCTS=1"
LDFLAGS="-arch $ARCH -isysroot $(xcrun --sdk $SDK --show-sdk-path) -Wl,ios_version_min=6.0"
# TODO(jtattermusch): revisit the build arguments

File diff suppressed because it is too large Load Diff

@ -30,7 +30,7 @@
Pod::Spec.new do |s|
s.name = "CronetFramework"
v = '0.0.4'
v = '0.0.5'
s.version = v
s.summary = "Cronet, precompiled and used as a framework."
s.homepage = "http://chromium.org"

File diff suppressed because it is too large Load Diff

@ -76,11 +76,6 @@ extern const char *kCFStreamVarName;
@end
BOOL isUsingCFStream() {
NSString *enabled = @(getenv(kCFStreamVarName));
return [enabled isEqualToString:@"1"];
}
#pragma mark Tests
@implementation PerfTests {
@ -118,12 +113,6 @@ BOOL isUsingCFStream() {
return nil;
}
+ (void)setUp {
setenv("GRPC_TRACE", "tcp", 1);
setenv("GRPC_VERBOSITY", "DEBUG", 1);
NSLog(@"In setUp");
}
- (void)setUp {
self.continueAfterFailure = NO;
@ -137,6 +126,10 @@ BOOL isUsingCFStream() {
_service = [[self class] host] ? [RMTTestService serviceWithHost:[[self class] host]] : nil;
}
- (BOOL)isUsingCFStream {
return [NSStringFromClass([self class]) isEqualToString:@"PerfTestsCFStreamSSL"];
}
- (void)pingPongV2APIWithRequest:(RMTStreamingOutputCallRequest *)request
numMessages:(int)numMessages
options:(GRPCMutableCallOptions *)options {
@ -265,37 +258,41 @@ BOOL isUsingCFStream() {
}];
}
- (void)unaryRPCWithRequest:(RMTSimpleRequest *)request
numMessages:(int)numMessages
callOptions:(GRPCMutableCallOptions *)options {
const int kOutstandingRPCs = 10;
NSAssert(numMessages > kOutstandingRPCs, @"Number of RPCs must be > %d", kOutstandingRPCs);
- (void)unaryRPCsWithServices:(NSArray<RMTTestService *> *)services
request:(RMTSimpleRequest *)request
callsPerService:(int)callsPerService
maxOutstandingCalls:(int)maxOutstandingCalls
callOptions:(GRPCMutableCallOptions *)options {
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"unaryRPC"];
dispatch_semaphore_t sema = dispatch_semaphore_create(kOutstandingRPCs);
dispatch_semaphore_t sema = dispatch_semaphore_create(maxOutstandingCalls);
__block int index = 0;
for (int i = 0; i < numMessages; ++i) {
GRPCUnaryProtoCall *call = [_service
unaryCallWithMessage:request
responseHandler:[[PerfTestsBlockCallbacks alloc]
initWithInitialMetadataCallback:nil
messageCallback:nil
closeCallback:^(NSDictionary *trailingMetadata,
NSError *error) {
dispatch_semaphore_signal(sema);
@synchronized(self) {
++index;
if (index == numMessages) {
[expectation fulfill];
for (RMTTestService *service in services) {
for (int i = 0; i < callsPerService; ++i) {
GRPCUnaryProtoCall *call = [service
unaryCallWithMessage:request
responseHandler:[[PerfTestsBlockCallbacks alloc]
initWithInitialMetadataCallback:nil
messageCallback:nil
closeCallback:^(NSDictionary *trailingMetadata,
NSError *error) {
dispatch_semaphore_signal(sema);
@synchronized(self) {
++index;
if (index ==
callsPerService * [services count]) {
[expectation fulfill];
}
}
}
}]
callOptions:options];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
[call start];
}]
callOptions:options];
dispatch_time_t timeout =
dispatch_time(DISPATCH_TIME_NOW, (int64_t)(TEST_TIMEOUT * NSEC_PER_SEC));
dispatch_semaphore_wait(sema, timeout);
[call start];
}
}
[self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil];
@ -303,7 +300,7 @@ BOOL isUsingCFStream() {
- (void)testUnaryRPC {
// Workaround Apple CFStream bug
if (isUsingCFStream()) {
if ([self isUsingCFStream]) {
return;
}
@ -317,10 +314,54 @@ BOOL isUsingCFStream() {
options.hostNameOverride = [[self class] hostNameOverride];
// warm up
[self unaryRPCWithRequest:request numMessages:50 callOptions:options];
[self unaryRPCsWithServices:@[ self->_service ]
request:request
callsPerService:50
maxOutstandingCalls:10
callOptions:options];
[self measureBlock:^{
[self unaryRPCsWithServices:@[ self->_service ]
request:request
callsPerService:50
maxOutstandingCalls:10
callOptions:options];
}];
}
- (void)testMultipleChannels {
NSString *port = [[[self class] host] componentsSeparatedByString:@":"][1];
int kNumAddrs = 10;
NSMutableArray<NSString *> *addrs = [NSMutableArray arrayWithCapacity:kNumAddrs];
NSMutableArray<RMTTestService *> *services = [NSMutableArray arrayWithCapacity:kNumAddrs];
for (int i = 0; i < kNumAddrs; ++i) {
addrs[i] = [NSString stringWithFormat:@"127.0.0.%d", (i + 1)];
NSString *hostWithPort = [NSString stringWithFormat:@"%@:%@", addrs[i], port];
services[i] = [RMTTestService serviceWithHost:hostWithPort];
}
RMTSimpleRequest *request = [RMTSimpleRequest message];
request.responseSize = 0;
request.payload.body = [NSMutableData dataWithLength:0];
GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init];
options.transport = [[self class] transport];
options.PEMRootCertificates = [[self class] PEMRootCertificates];
options.hostNameOverride = [[self class] hostNameOverride];
// warm up
[self unaryRPCsWithServices:services
request:request
callsPerService:100
maxOutstandingCalls:100
callOptions:options];
[self measureBlock:^{
[self unaryRPCWithRequest:request numMessages:50 callOptions:options];
[self unaryRPCsWithServices:services
request:request
callsPerService:100
maxOutstandingCalls:100
callOptions:options];
}];
}

@ -41,6 +41,36 @@
<Test
Identifier = "PerfTests">
</Test>
<Test
Identifier = "PerfTestsCFStreamCleartext">
</Test>
<Test
Identifier = "PerfTestsCronet/testPingPongRPCWithFlowControl">
</Test>
<Test
Identifier = "PerfTestsCronet/testPingPongRPCWithInterceptor">
</Test>
<Test
Identifier = "PerfTestsCronet/testPingPongRPCWithV1API">
</Test>
<Test
Identifier = "PerfTestsNoCFStreamCleartext">
</Test>
<Test
Identifier = "PerfTestsNoCFStreamSSL">
</Test>
<Test
Identifier = "PerfTestsNoCFStreamSSL/testPingPongRPCWithFlowControl">
</Test>
<Test
Identifier = "PerfTestsNoCFStreamSSL/testPingPongRPCWithInterceptor">
</Test>
<Test
Identifier = "PerfTestsNoCFStreamSSL/testPingPongRPCWithV1API">
</Test>
<Test
Identifier = "TestBase">
</Test>
</SkippedTests>
</TestableReference>
</Testables>

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
</BuildAction>
<TestAction
buildConfiguration = "Test"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B0F2D0B9232991BA008C2575"
BuildableName = "PerfTests.xctest"
BlueprintName = "PerfTests"
ReferencedContainer = "container:Tests.xcodeproj">
</BuildableReference>
<SkippedTests>
<Test
Identifier = "PerfTests">
</Test>
<Test
Identifier = "PerfTestsCFStreamCleartext">
</Test>
<Test
Identifier = "PerfTestsCFStreamSSL">
</Test>
<Test
Identifier = "PerfTestsCronet">
</Test>
<Test
Identifier = "PerfTestsNoCFStreamCleartext">
</Test>
<Test
Identifier = "PerfTestsNoCFStreamSSL/testPingPongRPCWithFlowControl">
</Test>
<Test
Identifier = "PerfTestsNoCFStreamSSL/testPingPongRPCWithInterceptor">
</Test>
<Test
Identifier = "PerfTestsNoCFStreamSSL/testPingPongRPCWithV1API">
</Test>
<Test
Identifier = "TestBase">
</Test>
</SkippedTests>
</TestableReference>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

@ -43,7 +43,25 @@ TLS_PORT=$(curl localhost:32766/get)
$INTEROP --port=$PLAIN_PORT --max_send_message_size=8388608 &
$INTEROP --port=$TLS_PORT --max_send_message_size=8388608 --use_tls &
trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT
# Create loopback aliases for iOS performance tests
if [ $SCHEME == PerfTests ] || [ $SCHEME == PerfTestsPosix ]; then
for ((i=2;i<11;i++))
do
sudo ifconfig lo0 alias 127.0.0.$i up
done
fi
function finish {
if [ $SCHEME == PerfTests ] || [ $SCHEME == PerfTestsPosix ]; then
for ((i=2;i<11;i++))
do
sudo ifconfig lo0 -alias 127.0.0.$i
done
fi
kill -9 `jobs -p`
echo "EXIT TIME: $(date)"
}
trap finish EXIT
set -o pipefail
@ -59,6 +77,7 @@ elif [ $PLATFORM == tvos ]; then
DESTINATION='platform=tvOS Simulator,name=Apple TV'
fi
xcodebuild \
-workspace Tests.xcworkspace \
-scheme $SCHEME \
@ -70,3 +89,4 @@ xcodebuild \
| egrep -v "$XCODEBUILD_FILTER" \
| egrep -v '^$' \
| egrep -v "(GPBDictionary|GPBArray)" -

@ -98,6 +98,21 @@ php_grpc_zend_object create_wrapped_grpc_channel(zend_class_entry *class_type
PHP_GRPC_FREE_CLASS_OBJECT(wrapped_grpc_channel, channel_ce_handlers);
}
static bool php_grpc_not_channel_arg_key(const char* key) {
static const char* ignoredKeys[] = {
"credentials",
"force_new",
"grpc_target_persist_bound",
};
for (int i = 0; i < sizeof(ignoredKeys) / sizeof(ignoredKeys[0]); i++) {
if (strcmp(key, ignoredKeys[i]) == 0) {
return true;
}
}
return false;
}
int php_grpc_read_args_array(zval *args_array,
grpc_channel_args *args TSRMLS_DC) {
HashTable *array_hash;
@ -108,8 +123,8 @@ int php_grpc_read_args_array(zval *args_array,
"array_hash is NULL", 1 TSRMLS_CC);
return FAILURE;
}
args->num_args = zend_hash_num_elements(array_hash);
args->args = ecalloc(args->num_args, sizeof(grpc_arg));
args->args = ecalloc(zend_hash_num_elements(array_hash), sizeof(grpc_arg));
args_index = 0;
char *key = NULL;
@ -122,6 +137,11 @@ int php_grpc_read_args_array(zval *args_array,
"args keys must be strings", 1 TSRMLS_CC);
return FAILURE;
}
if (php_grpc_not_channel_arg_key(key)) {
continue;
}
args->args[args_index].key = key;
switch (Z_TYPE_P(data)) {
case IS_LONG:
@ -139,6 +159,7 @@ int php_grpc_read_args_array(zval *args_array,
}
args_index++;
PHP_GRPC_HASH_FOREACH_END()
args->num_args = args_index;
return SUCCESS;
}
@ -322,7 +343,6 @@ PHP_METHOD(Channel, __construct) {
(void **)&creds_obj) == SUCCESS) {
if (Z_TYPE_P(creds_obj) == IS_NULL) {
creds = NULL;
php_grpc_zend_hash_del(array_hash, "credentials", sizeof("credentials"));
} else if (PHP_GRPC_GET_CLASS_ENTRY(creds_obj) !=
grpc_ce_channel_credentials) {
zend_throw_exception(spl_ce_InvalidArgumentException,
@ -333,7 +353,6 @@ PHP_METHOD(Channel, __construct) {
Z_ADDREF(*creds_obj);
creds = PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_channel_credentials,
creds_obj);
php_grpc_zend_hash_del(array_hash, "credentials", sizeof("credentials"));
}
}
if (php_grpc_zend_hash_find(array_hash, "force_new", sizeof("force_new"),
@ -341,7 +360,6 @@ PHP_METHOD(Channel, __construct) {
if (PHP_GRPC_BVAL_IS_TRUE(force_new_obj)) {
force_new = true;
}
php_grpc_zend_hash_del(array_hash, "force_new", sizeof("force_new"));
}
if (php_grpc_zend_hash_find(array_hash, "grpc_target_persist_bound",
@ -353,8 +371,6 @@ PHP_METHOD(Channel, __construct) {
1 TSRMLS_CC);
}
target_upper_bound = (int)Z_LVAL_P(force_new_obj);
php_grpc_zend_hash_del(array_hash, "grpc_target_persist_bound",
sizeof("grpc_target_persist_bound"));
}
// parse the rest of the channel args array
@ -366,18 +382,31 @@ PHP_METHOD(Channel, __construct) {
// Construct a hashkey for the persistent channel
// Currently, the hashkey contains 3 parts:
// 1. hostname
// 2. hash value of the channel args array (excluding "credentials"
// and "force_new")
// 2. hash value of the channel args (args_array excluding "credentials",
// "force_new" and "grpc_target_persist_bound")
// 3. (optional) hash value of the ChannelCredentials object
php_serialize_data_t var_hash;
smart_str buf = {0};
PHP_VAR_SERIALIZE_INIT(var_hash);
PHP_GRPC_VAR_SERIALIZE(&buf, args_array, &var_hash);
PHP_VAR_SERIALIZE_DESTROY(var_hash);
char sha1str[41];
generate_sha1_str(sha1str, PHP_GRPC_SERIALIZED_BUF_STR(buf),
PHP_GRPC_SERIALIZED_BUF_LEN(buf));
char sha1str[41] = { 0 };
unsigned char digest[20] = { 0 };
PHP_SHA1_CTX context;
PHP_SHA1Init(&context);
for (int i = 0; i < args.num_args; i++) {
PHP_GRPC_SHA1Update(&context, args.args[i].key, strlen(args.args[i].key) + 1);
switch (args.args[i].type) {
case GRPC_ARG_INTEGER:
PHP_GRPC_SHA1Update(&context, &args.args[i].value.integer, 4);
break;
case GRPC_ARG_STRING:
PHP_GRPC_SHA1Update(&context, args.args[i].value.string, strlen(args.args[i].value.string) + 1);
break;
default:
zend_throw_exception(spl_ce_InvalidArgumentException,
"args values must be int or string", 1 TSRMLS_CC);
return;
}
};
PHP_SHA1Final(digest, &context);
make_sha1_digest(sha1str, digest);
php_grpc_int key_len = target_length + strlen(sha1str);
if (creds != NULL && creds->hashstr != NULL) {
@ -405,7 +434,6 @@ PHP_METHOD(Channel, __construct) {
}
gpr_mu_init(&channel->wrapper->mu);
smart_str_free(&buf);
if (force_new || (creds != NULL && creds->has_call_creds)) {
// If the ChannelCredentials object was composed with a CallCredentials
// object, there is no way we can tell them apart. Do NOT persist

@ -47,7 +47,7 @@ function waitUntilNotIdle($channel) {
}
// Set up
$channel = new Grpc\Channel('localhost:0', ['credentials' => Grpc\ChannelCredentials::createInsecure()]);
$channel = new Grpc\Channel('localhost:50101', ['credentials' => Grpc\ChannelCredentials::createInsecure()]);
// Test InsecureCredentials
assert('Grpc\Channel' == get_class($channel));
@ -56,28 +56,16 @@ assert('Grpc\Channel' == get_class($channel));
$state = $channel->getConnectivityState();
assert(0 == $state);
// Test GetConnectivityStateWithInt
$state = $channel->getConnectivityState(123);
assert(0 == $state);
// Test GetConnectivityStateWithString
$state = $channel->getConnectivityState('hello');
assert(0 == $state);
// Test GetConnectivityStateWithBool
$state = $channel->getConnectivityState(true);
assert(0 == $state);
$channel->close();
// Test GetTarget
$channel = new Grpc\Channel('localhost:8888', ['credentials' => Grpc\ChannelCredentials::createInsecure()]);
$channel = new Grpc\Channel('localhost:50102', ['credentials' => Grpc\ChannelCredentials::createInsecure()]);
$target = $channel->getTarget();
assert(is_string($target) == true);
$channel->close();
// Test WatchConnectivityState
$channel = new Grpc\Channel('localhost:0', ['credentials' => Grpc\ChannelCredentials::createInsecure()]);
$channel = new Grpc\Channel('localhost:50103', ['credentials' => Grpc\ChannelCredentials::createInsecure()]);
$now = Grpc\Timeval::now();
$deadline = $now->add(new Grpc\Timeval(100*1000));

@ -149,14 +149,16 @@
include(cmake/msvc_static_runtime.cmake)
add_definitions(-D_WIN32_WINNT=0x600 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS)
# needed to compile protobuf
add_definitions(/wd4065 /wd4506)
set(_gRPC_C_CXX_FLAGS "<%text>${_gRPC_C_CXX_FLAGS}</%text> /wd4065 /wd4506")
# TODO(jtattermusch): revisit warnings that were silenced as part of upgrade to protobuf3.6.0
add_definitions(/wd4200 /wd4291 /wd4244)
set(_gRPC_C_CXX_FLAGS "<%text>${_gRPC_C_CXX_FLAGS}</%text> /wd4200 /wd4291 /wd4244")
# TODO(jtattermusch): revisit C4267 occurrences throughout the code
add_definitions(/wd4267)
set(_gRPC_C_CXX_FLAGS "<%text>${_gRPC_C_CXX_FLAGS}</%text> /wd4267")
# TODO(jtattermusch): needed to build boringssl with VS2017, revisit later
add_definitions(/wd4987 /wd4774 /wd4819 /wd4996 /wd4619)
set(_gRPC_C_CXX_FLAGS "<%text>${_gRPC_C_CXX_FLAGS}</%text> /wd4987 /wd4774 /wd4819 /wd4996 /wd4619")
endif()
set(CMAKE_C_FLAGS "<%text>${CMAKE_C_FLAGS} ${_gRPC_C_CXX_FLAGS}</%text>")
set(CMAKE_CXX_FLAGS "<%text>${CMAKE_CXX_FLAGS} ${_gRPC_C_CXX_FLAGS}</%text>")
if (gRPC_USE_PROTO_LITE)
set(_gRPC_PROTOBUF_LIBRARY_NAME "libprotobuf-lite")

@ -12,7 +12,7 @@
<email>grpc-packages@google.com</email>
<active>yes</active>
</lead>
<date>2018-01-19</date>
<date>2019-09-24</date>
<time>16:06:07</time>
<version>
<release>${settings.php_version.php()}</release>
@ -24,7 +24,7 @@
</stability>
<license>Apache 2.0</license>
<notes>
- TBD
- gRPC Core ${settings.php_version.php_composer()} update
</notes>
<contents>
<dir baseinstalldir="/" name="/">

@ -39,4 +39,6 @@
ln -s $(pwd)/.dotnet/dotnet /usr/local/bin/dotnet
fi
dotnet build --configuration Debug Grpc.DotNet.sln
# Cloning from a local path sets RepositoryUrl to a path and breaks Source Link.
# Override RepositoryUrl to a URL to fix Source Link. The value doesn't matter.
dotnet build --configuration Debug Grpc.DotNet.sln -p:RepositoryUrl=https://github.com/grpc/grpc-dotnet.git

@ -16,43 +16,38 @@
*
*/
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/impl/codegen/log.h>
#include <string.h>
#include <grpc/support/log.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/surface/channel.h"
#include "test/core/util/test_config.h"
static void test_create(void) {
grpc_core::ExecCtx exec_ctx;
grpc_arg arg_int;
grpc_arg arg_string;
grpc_arg to_add[2];
grpc_channel_args* ch_args;
arg_int.key = const_cast<char*>("int_arg");
arg_int.type = GRPC_ARG_INTEGER;
arg_int.value.integer = 123;
arg_string.key = const_cast<char*>("str key");
arg_string.type = GRPC_ARG_STRING;
arg_string.value.string = const_cast<char*>("str value");
to_add[0] = arg_int;
to_add[1] = arg_string;
to_add[0] =
grpc_channel_arg_integer_create(const_cast<char*>("int_arg"), 123);
to_add[1] = grpc_channel_arg_string_create(const_cast<char*>("str key"),
const_cast<char*>("str value"));
ch_args = grpc_channel_args_copy_and_add(nullptr, to_add, 2);
GPR_ASSERT(ch_args->num_args == 2);
GPR_ASSERT(strcmp(ch_args->args[0].key, arg_int.key) == 0);
GPR_ASSERT(ch_args->args[0].type == arg_int.type);
GPR_ASSERT(ch_args->args[0].value.integer == arg_int.value.integer);
GPR_ASSERT(strcmp(ch_args->args[0].key, to_add[0].key) == 0);
GPR_ASSERT(ch_args->args[0].type == to_add[0].type);
GPR_ASSERT(ch_args->args[0].value.integer == to_add[0].value.integer);
GPR_ASSERT(strcmp(ch_args->args[1].key, arg_string.key) == 0);
GPR_ASSERT(ch_args->args[1].type == arg_string.type);
GPR_ASSERT(strcmp(ch_args->args[1].value.string, arg_string.value.string) ==
GPR_ASSERT(strcmp(ch_args->args[1].key, to_add[1].key) == 0);
GPR_ASSERT(ch_args->args[1].type == to_add[1].type);
GPR_ASSERT(strcmp(ch_args->args[1].value.string, to_add[1].value.string) ==
0);
grpc_channel_args_destroy(ch_args);
@ -84,23 +79,15 @@ static const grpc_arg_pointer_vtable fake_pointer_arg_vtable = {
static void test_channel_create_with_args(void) {
grpc_arg client_a[3];
// adds integer arg
client_a[0].type = GRPC_ARG_INTEGER;
client_a[0].key = const_cast<char*>("arg_int");
client_a[0].value.integer = 0;
// adds const str arg
client_a[1].type = GRPC_ARG_STRING;
client_a[1].key = const_cast<char*>("arg_str");
client_a[1].value.string = const_cast<char*>("arg_str_val");
client_a[0] =
grpc_channel_arg_integer_create(const_cast<char*>("arg_int"), 0);
client_a[1] = grpc_channel_arg_string_create(
const_cast<char*>("arg_str"), const_cast<char*>("arg_str_val"));
// allocated and adds custom pointer arg
fake_class* fc = static_cast<fake_class*>(gpr_malloc(sizeof(fake_class)));
fc->foo = 42;
client_a[2].type = GRPC_ARG_POINTER;
client_a[2].key = const_cast<char*>("arg_pointer");
client_a[2].value.pointer.vtable = &fake_pointer_arg_vtable;
client_a[2].value.pointer.p = fc;
client_a[2] = grpc_channel_arg_pointer_create(
const_cast<char*>("arg_pointer"), fc, &fake_pointer_arg_vtable);
// creates channel
grpc_channel_args client_args = {GPR_ARRAY_SIZE(client_a), client_a};
@ -111,6 +98,78 @@ static void test_channel_create_with_args(void) {
grpc_channel_destroy(c);
}
grpc_channel_args* mutate_channel_args(const char* target,
grpc_channel_args* old_args,
grpc_channel_stack_type type) {
GPR_ASSERT(old_args != nullptr);
GPR_ASSERT(grpc_channel_args_find(old_args, "arg_int")->value.integer == 0);
GPR_ASSERT(strcmp(grpc_channel_args_find(old_args, "arg_str")->value.string,
"arg_str_val") == 0);
GPR_ASSERT(
grpc_channel_args_find(old_args, "arg_pointer")->value.pointer.vtable ==
&fake_pointer_arg_vtable);
if (strcmp(target, "no_op_mutator") == 0) {
return old_args;
}
GPR_ASSERT(strcmp(target, "minimal_stack_mutator") == 0);
const char* args_to_remove[] = {"arg_int", "arg_str", "arg_pointer"};
grpc_arg no_deadline_filter_arg = grpc_channel_arg_integer_create(
const_cast<char*>(GRPC_ARG_MINIMAL_STACK), 1);
grpc_channel_args* new_args = nullptr;
new_args = grpc_channel_args_copy_and_add_and_remove(
old_args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove),
&no_deadline_filter_arg, 1);
grpc_channel_args_destroy(old_args);
return new_args;
}
// Minimal stack should not have client_idle filter
static bool channel_has_client_idle_filter(grpc_channel* c) {
grpc_channel_stack* stack = grpc_channel_get_channel_stack(c);
for (size_t i = 0; i < stack->count; i++) {
if (strcmp(grpc_channel_stack_element(stack, i)->filter->name,
"client_idle") == 0) {
return true;
}
}
return false;
}
static void test_channel_create_with_global_mutator(void) {
grpc_channel_args_set_client_channel_creation_mutator(mutate_channel_args);
// We also add some custom args to make sure the ownership is correct.
grpc_arg client_a[3];
client_a[0] =
grpc_channel_arg_integer_create(const_cast<char*>("arg_int"), 0);
client_a[1] = grpc_channel_arg_string_create(
const_cast<char*>("arg_str"), const_cast<char*>("arg_str_val"));
// allocated and adds custom pointer arg
fake_class* fc = static_cast<fake_class*>(gpr_malloc(sizeof(fake_class)));
fc->foo = 42;
client_a[2] = grpc_channel_arg_pointer_create(
const_cast<char*>("arg_pointer"), fc, &fake_pointer_arg_vtable);
// creates channels
grpc_channel_args client_args = {GPR_ARRAY_SIZE(client_a), client_a};
grpc_channel* c =
grpc_insecure_channel_create("no_op_mutator", &client_args, nullptr);
GPR_ASSERT(channel_has_client_idle_filter(c));
grpc_channel_destroy(c);
c = grpc_insecure_channel_create("minimal_stack_mutator", &client_args,
nullptr);
GPR_ASSERT(channel_has_client_idle_filter(c) == false);
grpc_channel_destroy(c);
gpr_free(fc);
auto mutator = grpc_channel_args_get_client_channel_creation_mutator();
GPR_ASSERT(mutator == &mutate_channel_args);
}
static void test_server_create_with_args(void) {
grpc_arg server_a[3];
@ -146,6 +205,8 @@ int main(int argc, char** argv) {
test_create();
test_channel_create_with_args();
test_server_create_with_args();
// This has to be the last test.
test_channel_create_with_global_mutator();
grpc_shutdown();
return 0;
}

@ -533,8 +533,8 @@ TEST_F(ChannelzRegistryBasedTest, ManyServersTest) {
ValidateGetServers(10);
}
INSTANTIATE_TEST_CASE_P(ChannelzChannelTestSweep, ChannelzChannelTest,
::testing::Values(0, 8, 64, 1024, 1024 * 1024));
INSTANTIATE_TEST_SUITE_P(ChannelzChannelTestSweep, ChannelzChannelTest,
::testing::Values(0, 8, 64, 1024, 1024 * 1024));
} // namespace testing
} // namespace channelz

@ -921,10 +921,7 @@ TEST_F(ClientChannelParserTest, InvalidHealthCheckMultipleEntries) {
"error)(.*)(referenced_errors)(.*)(Global "
"Params)(.*)(referenced_errors)(.*)(field:healthCheckConfig "
"error:Duplicate entry)"));
std::smatch match;
std::string s(grpc_error_string(error));
EXPECT_TRUE(std::regex_search(s, match, e));
GRPC_ERROR_UNREF(error);
VerifyRegexMatch(error, e);
}
class MessageSizeParserTest : public ::testing::Test {
@ -1014,6 +1011,11 @@ TEST_F(MessageSizeParserTest, InvalidMaxResponseMessageBytes) {
} // namespace grpc_core
int main(int argc, char** argv) {
// Regexes don't work in gcc4.8 and below, so just skip testing in those cases
#if defined(__GNUC__) && \
((__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__) <= 8))
return 0;
#endif
grpc::testing::TestEnvironment env(argc, argv);
grpc_init();
::testing::InitGoogleTest(&argc, argv);

@ -135,8 +135,8 @@ TEST_P(HistogramTest, IncHistogram) {
}
}
INSTANTIATE_TEST_CASE_P(HistogramTestCases, HistogramTest,
::testing::Range<int>(0, GRPC_STATS_HISTOGRAM_COUNT));
INSTANTIATE_TEST_SUITE_P(HistogramTestCases, HistogramTest,
::testing::Range<int>(0, GRPC_STATS_HISTOGRAM_COUNT));
} // namespace testing
} // namespace grpc

@ -57,9 +57,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_server* server = grpc_server_create(nullptr, nullptr);
grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr);
grpc_server_register_completion_queue(server, cq, nullptr);
// TODO(ctiller): add registered methods (one for POST, one for PUT)
// void *registered_method =
// grpc_server_register_method(server, "/reg", NULL, 0);
// TODO(ctiller): add more registered methods (one for POST, one for PUT)
grpc_server_register_method(server, "/reg", nullptr, {}, 0);
grpc_server_start(server);
grpc_transport* transport =
grpc_create_chttp2_transport(nullptr, mock_endpoint, false);

@ -346,7 +346,8 @@ TEST_P(H2SslCertTest, SimpleRequestBody) {
simple_request_body(fixture_, GetParam().result);
}
INSTANTIATE_TEST_CASE_P(H2SslCert, H2SslCertTest, ::testing::ValuesIn(configs));
INSTANTIATE_TEST_SUITE_P(H2SslCert, H2SslCertTest,
::testing::ValuesIn(configs));
} // namespace testing
} // namespace grpc

@ -131,9 +131,9 @@ TEST_P(BdpEstimatorRandomTest, GetEstimateRandomValues) {
}
}
INSTANTIATE_TEST_CASE_P(TooManyNames, BdpEstimatorRandomTest,
::testing::Values(3, 4, 6, 9, 13, 19, 28, 42, 63, 94,
141, 211, 316, 474, 711));
INSTANTIATE_TEST_SUITE_P(TooManyNames, BdpEstimatorRandomTest,
::testing::Values(3, 4, 6, 9, 13, 19, 28, 42, 63, 94,
141, 211, 316, 474, 711));
} // namespace testing
} // namespace grpc_core

@ -75,7 +75,7 @@ TEST_P(SimpleConvergenceTest, Converges) {
}
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
X, SimpleConvergenceTest,
::testing::Values(SimpleConvergenceTestArgs{0.2, 0, 0, 1, 100, 0},
SimpleConvergenceTestArgs{0.2, 0.1, 0, 1, 100, 0},

@ -140,7 +140,7 @@ ExampleGenerator::End() const {
return new ExampleIterator(*this, examples_.end());
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
CorpusExamples, FuzzerCorpusTest,
::testing::internal::ParamGenerator<std::string>(new ExampleGenerator));

@ -75,8 +75,8 @@ class TimeJumpTest : public ::testing::TestWithParam<std::string> {
std::vector<std::string> CreateTestScenarios() {
return {"-1M", "+1M", "-1H", "+1H", "-1d", "+1d", "-1y", "+1y"};
}
INSTANTIATE_TEST_CASE_P(TimeJump, TimeJumpTest,
::testing::ValuesIn(CreateTestScenarios()));
INSTANTIATE_TEST_SUITE_P(TimeJump, TimeJumpTest,
::testing::ValuesIn(CreateTestScenarios()));
TEST_P(TimeJumpTest, TimerRunning) {
grpc_core::ExecCtx exec_ctx;

@ -1875,11 +1875,12 @@ std::vector<TestScenario> CreateTestScenarios(bool test_secure,
return scenarios;
}
INSTANTIATE_TEST_CASE_P(AsyncEnd2end, AsyncEnd2endTest,
::testing::ValuesIn(CreateTestScenarios(true, true)));
INSTANTIATE_TEST_CASE_P(AsyncEnd2endServerTryCancel,
AsyncEnd2endServerTryCancelTest,
::testing::ValuesIn(CreateTestScenarios(false, false)));
INSTANTIATE_TEST_SUITE_P(AsyncEnd2end, AsyncEnd2endTest,
::testing::ValuesIn(CreateTestScenarios(true, true)));
INSTANTIATE_TEST_SUITE_P(AsyncEnd2endServerTryCancel,
AsyncEnd2endServerTryCancelTest,
::testing::ValuesIn(CreateTestScenarios(false,
false)));
} // namespace
} // namespace testing

@ -324,8 +324,8 @@ std::vector<TestScenario> CreateTestScenarios() {
return scenarios;
}
INSTANTIATE_TEST_CASE_P(CFStreamTest, CFStreamTest,
::testing::ValuesIn(CreateTestScenarios()));
INSTANTIATE_TEST_SUITE_P(CFStreamTest, CFStreamTest,
::testing::ValuesIn(CreateTestScenarios()));
// gRPC should automatically detech network flaps (without enabling keepalives)
// when CFStream is enabled

@ -1375,8 +1375,8 @@ std::vector<TestScenario> CreateTestScenarios(bool test_insecure) {
return scenarios;
}
INSTANTIATE_TEST_CASE_P(ClientCallbackEnd2endTest, ClientCallbackEnd2endTest,
::testing::ValuesIn(CreateTestScenarios(true)));
INSTANTIATE_TEST_SUITE_P(ClientCallbackEnd2endTest, ClientCallbackEnd2endTest,
::testing::ValuesIn(CreateTestScenarios(true)));
} // namespace
} // namespace testing

@ -399,26 +399,31 @@ class ClientLbEnd2endTest : public ::testing::Test {
ResetCounters();
}
bool WaitForChannelNotReady(Channel* channel, int timeout_seconds = 5) {
bool WaitForChannelState(
Channel* channel, std::function<bool(grpc_connectivity_state)> predicate,
bool try_to_connect = false, int timeout_seconds = 5) {
const gpr_timespec deadline =
grpc_timeout_seconds_to_deadline(timeout_seconds);
grpc_connectivity_state state;
while ((state = channel->GetState(false /* try_to_connect */)) ==
GRPC_CHANNEL_READY) {
while (true) {
grpc_connectivity_state state = channel->GetState(try_to_connect);
if (predicate(state)) break;
if (!channel->WaitForStateChange(state, deadline)) return false;
}
return true;
}
bool WaitForChannelNotReady(Channel* channel, int timeout_seconds = 5) {
auto predicate = [](grpc_connectivity_state state) {
return state != GRPC_CHANNEL_READY;
};
return WaitForChannelState(channel, predicate, false, timeout_seconds);
}
bool WaitForChannelReady(Channel* channel, int timeout_seconds = 5) {
const gpr_timespec deadline =
grpc_timeout_seconds_to_deadline(timeout_seconds);
grpc_connectivity_state state;
while ((state = channel->GetState(true /* try_to_connect */)) !=
GRPC_CHANNEL_READY) {
if (!channel->WaitForStateChange(state, deadline)) return false;
}
return true;
auto predicate = [](grpc_connectivity_state state) {
return state == GRPC_CHANNEL_READY;
};
return WaitForChannelState(channel, predicate, true, timeout_seconds);
}
bool SeenAllServers() {
@ -1176,7 +1181,6 @@ TEST_F(ClientLbEnd2endTest, RoundRobinUpdateInError) {
auto channel = BuildChannel("round_robin", response_generator);
auto stub = BuildStub(channel);
std::vector<int> ports;
// Start with a single server.
ports.emplace_back(servers_[0]->port_);
response_generator.SetNextResolution(ports);
@ -1187,7 +1191,6 @@ TEST_F(ClientLbEnd2endTest, RoundRobinUpdateInError) {
EXPECT_EQ(0, servers_[1]->service_.request_count());
EXPECT_EQ(0, servers_[2]->service_.request_count());
servers_[0]->service_.ResetCounters();
// Shutdown one of the servers to be sent in the update.
servers_[1]->Shutdown();
ports.emplace_back(servers_[1]->port_);
@ -1195,7 +1198,6 @@ TEST_F(ClientLbEnd2endTest, RoundRobinUpdateInError) {
response_generator.SetNextResolution(ports);
WaitForServer(stub, 0, DEBUG_LOCATION);
WaitForServer(stub, 2, DEBUG_LOCATION);
// Send three RPCs, one per server.
for (size_t i = 0; i < kNumServers; ++i) SendRpc(stub);
// The server in shutdown shouldn't receive any.
@ -1279,6 +1281,63 @@ TEST_F(ClientLbEnd2endTest, RoundRobinReresolve) {
ASSERT_GT(gpr_time_cmp(deadline, now), 0);
}
TEST_F(ClientLbEnd2endTest, RoundRobinTransientFailure) {
// Start servers and create channel. Channel should go to READY state.
const int kNumServers = 3;
StartServers(kNumServers);
auto response_generator = BuildResolverResponseGenerator();
auto channel = BuildChannel("round_robin", response_generator);
auto stub = BuildStub(channel);
response_generator.SetNextResolution(GetServersPorts());
EXPECT_TRUE(WaitForChannelReady(channel.get()));
// Now kill the servers. The channel should transition to TRANSIENT_FAILURE.
// TODO(roth): This test should ideally check that even when the
// subchannels are in state CONNECTING for an extended period of time,
// we will still report TRANSIENT_FAILURE. Unfortunately, we don't
// currently have a good way to get a subchannel to report CONNECTING
// for a long period of time, since the servers in this test framework
// are on the loopback interface, which will immediately return a
// "Connection refused" error, so the subchannels will only be in
// CONNECTING state very briefly. When we have time, see if we can
// find a way to fix this.
for (size_t i = 0; i < servers_.size(); ++i) {
servers_[i]->Shutdown();
}
auto predicate = [](grpc_connectivity_state state) {
return state == GRPC_CHANNEL_TRANSIENT_FAILURE;
};
EXPECT_TRUE(WaitForChannelState(channel.get(), predicate));
}
TEST_F(ClientLbEnd2endTest, RoundRobinTransientFailureAtStartup) {
// Create channel and return servers that don't exist. Channel should
// quickly transition into TRANSIENT_FAILURE.
// TODO(roth): This test should ideally check that even when the
// subchannels are in state CONNECTING for an extended period of time,
// we will still report TRANSIENT_FAILURE. Unfortunately, we don't
// currently have a good way to get a subchannel to report CONNECTING
// for a long period of time, since the servers in this test framework
// are on the loopback interface, which will immediately return a
// "Connection refused" error, so the subchannels will only be in
// CONNECTING state very briefly. When we have time, see if we can
// find a way to fix this.
auto response_generator = BuildResolverResponseGenerator();
auto channel = BuildChannel("round_robin", response_generator);
auto stub = BuildStub(channel);
response_generator.SetNextResolution({
grpc_pick_unused_port_or_die(),
grpc_pick_unused_port_or_die(),
grpc_pick_unused_port_or_die(),
});
for (size_t i = 0; i < servers_.size(); ++i) {
servers_[i]->Shutdown();
}
auto predicate = [](grpc_connectivity_state state) {
return state == GRPC_CHANNEL_TRANSIENT_FAILURE;
};
EXPECT_TRUE(WaitForChannelState(channel.get(), predicate, true));
}
TEST_F(ClientLbEnd2endTest, RoundRobinSingleReconnect) {
const int kNumServers = 3;
StartServers(kNumServers);

@ -2251,23 +2251,23 @@ std::vector<TestScenario> CreateTestScenarios(bool use_proxy,
return scenarios;
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
End2end, End2endTest,
::testing::ValuesIn(CreateTestScenarios(false, true, true, true, true)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
End2endServerTryCancel, End2endServerTryCancelTest,
::testing::ValuesIn(CreateTestScenarios(false, true, true, true, true)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
ProxyEnd2end, ProxyEnd2endTest,
::testing::ValuesIn(CreateTestScenarios(true, true, true, true, true)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SecureEnd2end, SecureEnd2endTest,
::testing::ValuesIn(CreateTestScenarios(false, false, true, false, true)));
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
ResourceQuotaEnd2end, ResourceQuotaEnd2endTest,
::testing::ValuesIn(CreateTestScenarios(false, true, true, true, true)));

@ -344,8 +344,8 @@ std::vector<TestScenario> CreateTestScenarios() {
return scenarios;
}
INSTANTIATE_TEST_CASE_P(FlakyNetworkTest, FlakyNetworkTest,
::testing::ValuesIn(CreateTestScenarios()));
INSTANTIATE_TEST_SUITE_P(FlakyNetworkTest, FlakyNetworkTest,
::testing::ValuesIn(CreateTestScenarios()));
// Network interface connected to server flaps
TEST_P(FlakyNetworkTest, NetworkTransition) {

@ -962,8 +962,8 @@ TEST_F(HybridEnd2endTest, GenericMethodWithoutGenericService) {
EXPECT_EQ(nullptr, server_.get());
}
INSTANTIATE_TEST_CASE_P(HybridEnd2endTest, HybridEnd2endTest,
::testing::Bool());
INSTANTIATE_TEST_SUITE_P(HybridEnd2endTest, HybridEnd2endTest,
::testing::Bool());
} // namespace
} // namespace testing

@ -400,12 +400,12 @@ std::vector<TestScenario> CreateTestScenarios(bool test_insecure) {
return scenarios;
}
INSTANTIATE_TEST_CASE_P(NullAllocatorTest, NullAllocatorTest,
::testing::ValuesIn(CreateTestScenarios(true)));
INSTANTIATE_TEST_CASE_P(SimpleAllocatorTest, SimpleAllocatorTest,
::testing::ValuesIn(CreateTestScenarios(true)));
INSTANTIATE_TEST_CASE_P(ArenaAllocatorTest, ArenaAllocatorTest,
::testing::ValuesIn(CreateTestScenarios(true)));
INSTANTIATE_TEST_SUITE_P(NullAllocatorTest, NullAllocatorTest,
::testing::ValuesIn(CreateTestScenarios(true)));
INSTANTIATE_TEST_SUITE_P(SimpleAllocatorTest, SimpleAllocatorTest,
::testing::ValuesIn(CreateTestScenarios(true)));
INSTANTIATE_TEST_SUITE_P(ArenaAllocatorTest, ArenaAllocatorTest,
::testing::ValuesIn(CreateTestScenarios(true)));
} // namespace
} // namespace testing

@ -359,8 +359,8 @@ TEST_P(PortSharingEnd2endTest, TwoHandoffPorts) {
}
}
INSTANTIATE_TEST_CASE_P(PortSharingEnd2end, PortSharingEnd2endTest,
::testing::ValuesIn(CreateTestScenarios()));
INSTANTIATE_TEST_SUITE_P(PortSharingEnd2end, PortSharingEnd2endTest,
::testing::ValuesIn(CreateTestScenarios()));
} // namespace
} // namespace testing

@ -257,8 +257,8 @@ TEST_P(ServerBuilderPluginTest, PluginWithServiceTest) {
EXPECT_TRUE(s.ok());
}
INSTANTIATE_TEST_CASE_P(ServerBuilderPluginTest, ServerBuilderPluginTest,
::testing::Values(false, true));
INSTANTIATE_TEST_SUITE_P(ServerBuilderPluginTest, ServerBuilderPluginTest,
::testing::Values(false, true));
} // namespace testing
} // namespace grpc

@ -136,8 +136,8 @@ std::vector<string> GetAllCredentialsTypeList() {
return credentials_types;
}
INSTANTIATE_TEST_CASE_P(End2EndShutdown, ShutdownTest,
::testing::ValuesIn(GetAllCredentialsTypeList()));
INSTANTIATE_TEST_SUITE_P(End2EndShutdown, ShutdownTest,
::testing::ValuesIn(GetAllCredentialsTypeList()));
// TODO(ctiller): leaked objects in this test
TEST_P(ShutdownTest, ShutdownTest) {

@ -25,16 +25,34 @@ ssl_lib='../../third_party/boringssl/build/ssl/libssl.a'
crypto_lib='../../third_party/boringssl/build/crypto/libcrypto.a'
# Generate boringssl archives
( cd ../../third_party/boringssl ; mkdir -p build ; cd build ; cmake .. ; make )
( cd ../../third_party/boringssl ; mkdir -p build ; cd build ; cmake .. ; make -j ssl crypto )
# Generate shadow_boringssl.h
outputs="$(nm -C $ssl_lib)"$'\n'"$(nm -C $crypto_lib)"
symbols=$(echo "$outputs" |
grep '^[0-9a-f]* [A-Z] ' | # Only public symbols
grep -v ' bssl::' | # Filter BoringSSL symbols since they are already namespaced
sed 's/(.*//g' | # Remove parenthesis from C++ symbols
grep '^[0-9a-f]* [A-Z] _' | # Filter symbols that is not prefixed with '_'
sed 's/[0-9a-f]* [A-Z] _\(.*\)/\1/g') # Extract the symbol names
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*)
outputs="$(nm $ssl_lib)"$'\n'"$(nm $crypto_lib)"
symbols=$(echo "$outputs" |
grep '^[0-9a-f]* [A-Z] ' | # Only public symbols
grep -v '^[0-9a-f]* [A-Z] _' | # Remove all symbols which look like for C++
sed 's/[0-9a-f]* [A-Z] \(.*\)/\1/g' | # Extract the symbol names
sort) # Sort symbol names
;;
Darwin*)
outputs="$(nm -C $ssl_lib)"$'\n'"$(nm -C $crypto_lib)"
symbols=$(echo "$outputs" |
grep '^[0-9a-f]* [A-Z] ' | # Only public symbols
grep -v ' bssl::' | # Filter BoringSSL symbols since they are already namespaced
sed 's/(.*//g' | # Remove parenthesis from C++ symbols
grep '^[0-9a-f]* [A-Z] _' | # Filter symbols that is not prefixed with '_'
sed 's/[0-9a-f]* [A-Z] _\(.*\)/\1/g' | # Extract the symbol names
sort) # Sort symbol names
;;
*)
echo "Supports only Linux and Darwin but this system is $unameOut"
exit 1
;;
esac
commit=$(git submodule | grep "boringssl " | awk '{print $1}' | head -n 1)

@ -0,0 +1,38 @@
# Copyright 2019 The 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.
# Docker file for building gRPC manylinux Python artifacts.
FROM quay.io/pypa/manylinux2010_x86_64
# Update the package manager
RUN yum update -y
RUN yum install -y curl-devel expat-devel gettext-devel linux-headers openssl-devel zlib-devel gcc
###################################
# Install Python build requirements
RUN /opt/python/cp27-cp27m/bin/pip install cython
RUN /opt/python/cp27-cp27mu/bin/pip install cython
RUN /opt/python/cp34-cp34m/bin/pip install cython
RUN /opt/python/cp35-cp35m/bin/pip install cython
RUN /opt/python/cp36-cp36m/bin/pip install cython
RUN /opt/python/cp37-cp37m/bin/pip install cython
####################################################
# Install auditwheel with fix for namespace packages
RUN git clone https://github.com/pypa/auditwheel /usr/local/src/auditwheel
RUN cd /usr/local/src/auditwheel && git checkout 2.1
RUN /opt/python/cp36-cp36m/bin/pip install /usr/local/src/auditwheel
RUN rm /usr/local/bin/auditwheel
RUN cd /usr/local/bin && ln -s /opt/python/cp36-cp36m/bin/auditwheel

@ -37,4 +37,6 @@ then
ln -s $(pwd)/.dotnet/dotnet /usr/local/bin/dotnet
fi
dotnet build --configuration Debug Grpc.DotNet.sln
# Cloning from a local path sets RepositoryUrl to a path and breaks Source Link.
# Override RepositoryUrl to a URL to fix Source Link. The value doesn't matter.
dotnet build --configuration Debug Grpc.DotNet.sln -p:RepositoryUrl=https://github.com/grpc/grpc-dotnet.git

@ -28,4 +28,4 @@ tools/run_tests/run_performance_tests.py \
--category smoketest \
-u kbuilder \
--bq_result_table performance_test.performance_experiment_singlevm \
--xml_report reports/singlemachine/sponge_log.xml
--xml_report run_performance_tests/singlemachine/sponge_log.xml

@ -27,7 +27,7 @@ tools/run_tests/run_performance_tests.py \
--remote_worker_host grpc-kokoro-performance-server-8core grpc-kokoro-performance-client-8core grpc-kokoro-performance-client2-8core \
-u kbuilder \
--bq_result_table performance_test.performance_experiment \
--xml_report reports/8core/sponge_log.xml \
--xml_report run_performance_tests/8core/sponge_log.xml \
|| EXIT_CODE=1
# prevent pushing leftover build files to remote hosts in the next step.
@ -41,7 +41,7 @@ tools/run_tests/run_performance_tests.py \
--remote_worker_host grpc-kokoro-performance-server-32core grpc-kokoro-performance-client-32core grpc-kokoro-performance-client2-32core \
-u kbuilder \
--bq_result_table performance_test.performance_experiment_32core \
--xml_report reports/32core/sponge_log.xml \
--xml_report run_performance_tests/32core/sponge_log.xml \
|| EXIT_CODE=1
# prevent pushing leftover build files to remote hosts in the next step.
@ -53,7 +53,7 @@ tools/run_tests/run_performance_tests.py \
--category scalable \
--remote_worker_host grpc-kokoro-performance-windows1 grpc-kokoro-performance-windows2 \
--bq_result_table performance_test.performance_experiment_windows \
--xml_report reports/windows/sponge_log.xml \
--xml_report run_performance_tests/windows/sponge_log.xml \
|| EXIT_CODE=1
exit $EXIT_CODE

@ -27,7 +27,7 @@ tools/run_tests/run_performance_tests.py \
--remote_worker_host grpc-kokoro-performance-server-8core grpc-kokoro-performance-client-8core grpc-kokoro-performance-client2-8core \
-u kbuilder \
--bq_result_table performance_released.performance_experiment \
--xml_report reports/8core/sponge_log.xml \
--xml_report run_performance_tests/8core/sponge_log.xml \
|| EXIT_CODE=1
# prevent pushing leftover build files to remote hosts in the next step.
@ -41,7 +41,7 @@ tools/run_tests/run_performance_tests.py \
--remote_worker_host grpc-kokoro-performance-server-32core grpc-kokoro-performance-client-32core grpc-kokoro-performance-client2-32core \
-u kbuilder \
--bq_result_table performance_released.performance_experiment_32core \
--xml_report reports/32core/sponge_log.xml \
--xml_report run_performance_tests/32core/sponge_log.xml \
|| EXIT_CODE=1
# prevent pushing leftover build files to remote hosts in the next step.
@ -53,7 +53,7 @@ tools/run_tests/run_performance_tests.py \
--category scalable \
--remote_worker_host grpc-kokoro-performance-windows1 grpc-kokoro-performance-windows2 \
--bq_result_table performance_released.performance_experiment_windows \
--xml_report reports/windows/sponge_log.xml \
--xml_report run_performance_tests/windows/sponge_log.xml \
|| EXIT_CODE=1
exit $EXIT_CODE

@ -110,6 +110,8 @@ class PythonArtifact:
self.arch = arch
self.labels = ['artifact', 'python', platform, arch, py_version]
self.py_version = py_version
if 'manylinux' in platform:
self.labels.append('linux')
def pre_build_jobspecs(self):
return []
@ -135,7 +137,7 @@ class PythonArtifact:
timeout_seconds=60 * 60 * 5,
docker_base_image='quay.io/grpc/raspbian_{}'.format(self.arch),
extra_docker_args=extra_args)
elif self.platform == 'linux':
elif 'manylinux' in self.platform:
if self.arch == 'x86':
environ['SETARCH_CMD'] = 'linux32'
# Inside the manylinux container, the python installations are located in
@ -150,10 +152,11 @@ class PythonArtifact:
environ['CFLAGS'] = '-DGPR_MANYLINUX1=1'
environ['GRPC_BUILD_GRPCIO_TOOLS_DEPENDENTS'] = 'TRUE'
environ['GRPC_BUILD_MANYLINUX_WHEEL'] = 'TRUE'
return create_docker_jobspec(
self.name,
'tools/dockerfile/grpc_artifact_python_manylinux_%s' %
self.arch,
'tools/dockerfile/grpc_artifact_python_%s_%s' % (self.platform,
self.arch),
'tools/run_tests/artifacts/build_artifact_python.sh',
environ=environ,
timeout_seconds=60 * 60,
@ -360,12 +363,14 @@ def targets():
CSharpExtArtifact('linux', 'android', arch_abi='armeabi-v7a'),
CSharpExtArtifact('linux', 'android', arch_abi='x86'),
CSharpExtArtifact('macos', 'ios'),
PythonArtifact('linux', 'x86', 'cp27-cp27m'),
PythonArtifact('linux', 'x86', 'cp27-cp27mu'),
PythonArtifact('linux', 'x86', 'cp34-cp34m'),
PythonArtifact('linux', 'x86', 'cp35-cp35m'),
PythonArtifact('linux', 'x86', 'cp36-cp36m'),
PythonArtifact('linux', 'x86', 'cp37-cp37m'),
# TODO(https://github.com/grpc/grpc/issues/20283)
# Add manylinux2010_x86 targets once this issue is resolved.
PythonArtifact('manylinux1', 'x86', 'cp27-cp27m'),
PythonArtifact('manylinux1', 'x86', 'cp27-cp27mu'),
PythonArtifact('manylinux1', 'x86', 'cp34-cp34m'),
PythonArtifact('manylinux1', 'x86', 'cp35-cp35m'),
PythonArtifact('manylinux1', 'x86', 'cp36-cp36m'),
PythonArtifact('manylinux1', 'x86', 'cp37-cp37m'),
PythonArtifact('linux_extra', 'armv7', '2.7'),
PythonArtifact('linux_extra', 'armv7', '3.4'),
PythonArtifact('linux_extra', 'armv7', '3.5'),
@ -374,12 +379,18 @@ def targets():
PythonArtifact('linux_extra', 'armv6', '3.4'),
PythonArtifact('linux_extra', 'armv6', '3.5'),
PythonArtifact('linux_extra', 'armv6', '3.6'),
PythonArtifact('linux', 'x64', 'cp27-cp27m'),
PythonArtifact('linux', 'x64', 'cp27-cp27mu'),
PythonArtifact('linux', 'x64', 'cp34-cp34m'),
PythonArtifact('linux', 'x64', 'cp35-cp35m'),
PythonArtifact('linux', 'x64', 'cp36-cp36m'),
PythonArtifact('linux', 'x64', 'cp37-cp37m'),
PythonArtifact('manylinux1', 'x64', 'cp27-cp27m'),
PythonArtifact('manylinux1', 'x64', 'cp27-cp27mu'),
PythonArtifact('manylinux1', 'x64', 'cp34-cp34m'),
PythonArtifact('manylinux1', 'x64', 'cp35-cp35m'),
PythonArtifact('manylinux1', 'x64', 'cp36-cp36m'),
PythonArtifact('manylinux1', 'x64', 'cp37-cp37m'),
PythonArtifact('manylinux2010', 'x64', 'cp27-cp27m'),
PythonArtifact('manylinux2010', 'x64', 'cp27-cp27mu'),
PythonArtifact('manylinux2010', 'x64', 'cp34-cp34m'),
PythonArtifact('manylinux2010', 'x64', 'cp35-cp35m'),
PythonArtifact('manylinux2010', 'x64', 'cp36-cp36m'),
PythonArtifact('manylinux2010', 'x64', 'cp37-cp37m'),
PythonArtifact('macos', 'x64', 'python2.7'),
PythonArtifact('macos', 'x64', 'python3.4'),
PythonArtifact('macos', 'x64', 'python3.5'),

@ -79,12 +79,12 @@ ${SETARCH_CMD} "${PYTHON}" tools/distrib/python/grpcio_tools/setup.py bdist_whee
if [ "$GRPC_BUILD_MANYLINUX_WHEEL" != "" ]
then
for wheel in dist/*.whl; do
"${AUDITWHEEL}" show "$wheel" | tee /dev/stderr | grep \"manylinux1
"${AUDITWHEEL}" show "$wheel" | tee /dev/stderr | grep -E -w 'manylinux(1|2010)_(x86_64|i686)'
"${AUDITWHEEL}" repair "$wheel" -w "$ARTIFACT_DIR"
rm "$wheel"
done
for wheel in tools/distrib/python/grpcio_tools/dist/*.whl; do
"${AUDITWHEEL}" show "$wheel" | tee /dev/stderr | grep \"manylinux1
"${AUDITWHEEL}" show "$wheel" | tee /dev/stderr | grep -E -w 'manylinux(1|2010)_(x86_64|i686)'
"${AUDITWHEEL}" repair "$wheel" -w "$ARTIFACT_DIR"
rm "$wheel"
done

@ -182346,6 +182346,29 @@
],
"uses_polling": false
},
{
"args": [
"test/core/end2end/fuzzers/server_fuzzer_corpus/hope.bin"
],
"ci_platforms": [
"linux"
],
"cpu_cost": 0.1,
"exclude_configs": [
"tsan"
],
"exclude_iomgrs": [
"uv"
],
"flaky": false,
"language": "c",
"name": "server_fuzzer_one_entry",
"platforms": [
"mac",
"linux"
],
"uses_polling": false
},
{
"args": [
"test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-0292270056246b7a4ccd2e7d0356665cef307ef2"

@ -135,7 +135,7 @@ def create_scenario_jobspec(scenario_json,
return jobset.JobSpec(
cmdline=[cmd],
shortname='qps_json_driver.%s' % scenario_json['name'],
shortname='%s' % scenario_json['name'],
timeout_seconds=_SCENARIO_TIMEOUT,
shell=True,
verbose_success=True)
@ -153,7 +153,7 @@ def create_quit_jobspec(workers, remote_host=None):
return jobset.JobSpec(
cmdline=[cmd],
shortname='qps_json_driver.quit',
shortname='shutdown_workers',
timeout_seconds=_QUIT_WORKER_TIMEOUT,
shell=True,
verbose_success=True)
@ -670,6 +670,8 @@ def main():
worker.start()
jobs = [scenario.jobspec]
if scenario.workers:
# TODO(jtattermusch): ideally the "quit" job won't show up
# in the report
jobs.append(
create_quit_jobspec(
scenario.workers,
@ -707,7 +709,10 @@ def main():
'%s/index.html' % args.flame_graph_reports, profile_output_files)
report_utils.render_junit_xml_report(
merged_resultset, args.xml_report, suite_name='benchmarks')
merged_resultset,
args.xml_report,
suite_name='benchmarks',
multi_target=True)
if total_scenario_failures > 0 or qps_workers_killed > 0:
print('%s scenarios failed and %s qps worker jobs killed' %

@ -1187,6 +1187,24 @@ class ObjCLanguage(object):
environ={
'SCHEME': 'CronetTests'
}))
out.append(
self.config.job_spec(
['src/objective-c/tests/run_one_test.sh'],
timeout_seconds=30 * 60,
shortname='ios-perf-test',
cpu_cost=1e6,
environ={
'SCHEME': 'PerfTests'
}))
out.append(
self.config.job_spec(
['src/objective-c/tests/run_one_test.sh'],
timeout_seconds=30 * 60,
shortname='ios-perf-test-posix',
cpu_cost=1e6,
environ={
'SCHEME': 'PerfTestsPosix'
}))
out.append(
self.config.job_spec(
['test/cpp/ios/build_and_run_tests.sh'],

@ -66,10 +66,8 @@ def _matrix_job_logfilename(shortname_for_multi_target):
# for the corresponding 'sponge_log.xml' report.
# the shortname_for_multi_target component must be set to match the sponge_log.xml location
# because the top-level render_junit_xml_report is called with multi_target=True
s = '%s/%s/%s' % (_MATRIX_REPORT_NAME, shortname_for_multi_target,
'sponge_log.log')
print(s)
return s
return '%s/%s/%s' % (_MATRIX_REPORT_NAME, shortname_for_multi_target,
'sponge_log.log')
def _docker_jobspec(name,
@ -184,7 +182,7 @@ def _create_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS):
# sanity tests
test_jobs += _generate_jobs(
languages=['sanity'],
configs=['dbg', 'opt'],
configs=['dbg'],
platforms=['linux'],
labels=['basictests'],
extra_args=extra_args + ['--report_multi_target'],

Loading…
Cancel
Save