Config migration

pull/18931/head
Esun Kim 6 years ago
parent 0492065015
commit 87905ae5ea
  1. 16
      BUILD
  2. 2
      BUILD.gn
  3. 2
      CMakeLists.txt
  4. 2
      Makefile
  5. 9
      build.yaml
  6. 2
      config.m4
  7. 1
      config.w32
  8. 1
      gRPC-C++.podspec
  9. 3
      gRPC-Core.podspec
  10. 2
      grpc.gemspec
  11. 2
      grpc.gyp
  12. 2
      package.xml
  13. 6
      src/android/test/interop/app/src/main/cpp/grpc-interop.cc
  14. 11
      src/core/ext/filters/client_channel/backup_poller.cc
  15. 1
      src/core/ext/filters/client_channel/http_connect_handshaker.cc
  16. 14
      src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
  17. 28
      src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc
  18. 29
      src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h
  19. 8
      src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
  20. 7
      src/core/ext/transport/chttp2/transport/chttp2_plugin.cc
  21. 20
      src/core/lib/debug/trace.cc
  22. 8
      src/core/lib/debug/trace.h
  23. 6
      src/core/lib/gpr/env.h
  24. 2
      src/core/lib/gpr/env_linux.cc
  25. 5
      src/core/lib/gpr/env_windows.cc
  26. 22
      src/core/lib/gpr/log.cc
  27. 41
      src/core/lib/gprpp/fork.cc
  28. 26
      src/core/lib/iomgr/ev_posix.cc
  29. 3
      src/core/lib/iomgr/ev_posix.h
  30. 1
      src/core/lib/iomgr/fork_posix.cc
  31. 3
      src/core/lib/iomgr/iomgr.cc
  32. 14
      src/core/lib/profiling/basic_timers.cc
  33. 12
      src/core/lib/security/security_connector/load_system_roots_linux.cc
  34. 1
      src/core/lib/security/security_connector/security_connector.cc
  35. 44
      src/core/lib/security/security_connector/ssl_utils.cc
  36. 6
      src/core/lib/security/security_connector/ssl_utils.h
  37. 2
      src/core/lib/surface/init.cc
  38. 3
      src/objective-c/GRPCClient/private/GRPCSecureChannelFactory.m
  39. 4
      src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.mm
  40. 1
      src/python/grpcio/grpc_core_dependencies.py
  41. 1
      test/core/bad_connection/close_fd_test.cc
  42. 4
      test/core/bad_ssl/bad_ssl_test.cc
  43. 8
      test/core/client_channel/resolvers/dns_resolver_test.cc
  44. 4
      test/core/end2end/fixtures/h2_full+trace.cc
  45. 5
      test/core/end2end/fixtures/h2_sockpair+trace.cc
  46. 3
      test/core/end2end/fixtures/h2_spiffe.cc
  47. 4
      test/core/end2end/fixtures/h2_ssl.cc
  48. 4
      test/core/end2end/fixtures/h2_ssl_cred_reload.cc
  49. 4
      test/core/end2end/fixtures/h2_ssl_proxy.cc
  50. 4
      test/core/end2end/h2_ssl_cert_test.cc
  51. 4
      test/core/end2end/h2_ssl_session_reuse_test.cc
  52. 14
      test/core/end2end/tests/keepalive_timeout.cc
  53. 13
      test/core/gpr/log_test.cc
  54. 3
      test/core/http/httpscli_test.cc
  55. 18
      test/core/iomgr/resolve_address_posix_test.cc
  56. 13
      test/core/iomgr/resolve_address_test.cc
  57. 2
      test/core/security/credentials_test.cc
  58. 10
      test/core/security/security_connector_test.cc
  59. 1
      test/core/util/test_config.cc
  60. 12
      test/cpp/end2end/async_end2end_test.cc
  61. 12
      test/cpp/end2end/end2end_test.cc
  62. 14
      test/cpp/naming/address_sorting_test.cc
  63. 4
      test/cpp/naming/cancel_ares_query_test.cc
  64. 1
      test/cpp/naming/resolver_component_test.cc
  65. 2
      tools/doxygen/Doxyfile.core.internal
  66. 24
      tools/run_tests/generated/sources_and_headers.json
  67. 2
      tools/run_tests/run_microbenchmark.py
  68. 4
      tools/run_tests/sanity/core_banned_functions.py

16
BUILD

@ -1560,6 +1560,20 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "grpc_resolver_dns_selection",
srcs = [
"src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc",
],
hdrs = [
"src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h",
],
language = "c++",
deps = [
"grpc_base",
],
)
grpc_cc_library(
name = "grpc_resolver_dns_native",
srcs = [
@ -1569,6 +1583,7 @@ grpc_cc_library(
deps = [
"grpc_base",
"grpc_client_channel",
"grpc_resolver_dns_selection",
],
)
@ -1600,6 +1615,7 @@ grpc_cc_library(
deps = [
"grpc_base",
"grpc_client_channel",
"grpc_resolver_dns_selection",
],
)

@ -326,6 +326,8 @@ config("grpc_config") {
"src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv_windows.h",
"src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc",
"src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc",
"src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc",
"src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h",
"src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc",
"src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc",
"src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h",

@ -1301,6 +1301,7 @@ add_library(grpc
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv_windows.cc
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc
src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc
src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
src/core/ext/filters/census/grpc_context.cc
@ -2697,6 +2698,7 @@ add_library(grpc_unsecure
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv_windows.cc
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc
src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc
src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc

@ -3769,6 +3769,7 @@ LIBGRPC_SRC = \
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv_windows.cc \
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc \
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc \
src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc \
src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc \
src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc \
src/core/ext/filters/census/grpc_context.cc \
@ -5113,6 +5114,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv_windows.cc \
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc \
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc \
src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc \
src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc \
src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc \
src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc \

@ -797,6 +797,7 @@ filegroups:
uses:
- grpc_base
- grpc_client_channel
- grpc_resolver_dns_selection
- name: grpc_resolver_dns_native
src:
- src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
@ -804,6 +805,14 @@ filegroups:
uses:
- grpc_base
- grpc_client_channel
- grpc_resolver_dns_selection
- name: grpc_resolver_dns_selection
headers:
- src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h
src:
- src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc
uses:
- grpc_base
- name: grpc_resolver_fake
headers:
- src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h

@ -412,6 +412,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv_windows.cc \
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc \
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc \
src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc \
src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc \
src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc \
src/core/ext/filters/census/grpc_context.cc \
@ -695,6 +696,7 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/lb_policy/pick_first)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/lb_policy/round_robin)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/lb_policy/xds)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/dns)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/dns/c_ares)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/dns/native)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/fake)

@ -387,6 +387,7 @@ if (PHP_GRPC != "no") {
"src\\core\\ext\\filters\\client_channel\\resolver\\dns\\c_ares\\grpc_ares_wrapper_libuv_windows.cc " +
"src\\core\\ext\\filters\\client_channel\\resolver\\dns\\c_ares\\grpc_ares_wrapper_posix.cc " +
"src\\core\\ext\\filters\\client_channel\\resolver\\dns\\c_ares\\grpc_ares_wrapper_windows.cc " +
"src\\core\\ext\\filters\\client_channel\\resolver\\dns\\dns_resolver_selection.cc " +
"src\\core\\ext\\filters\\client_channel\\resolver\\dns\\native\\dns_resolver.cc " +
"src\\core\\ext\\filters\\client_channel\\resolver\\sockaddr\\sockaddr_resolver.cc " +
"src\\core\\ext\\filters\\census\\grpc_context.cc " +

@ -561,6 +561,7 @@ Pod::Spec.new do |s|
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h',
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h',
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv_windows.h',
'src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h',
'src/core/ext/filters/max_age/max_age_filter.h',
'src/core/ext/filters/message_size/message_size_filter.h',
'src/core/ext/filters/http/client_authority_filter.h',

@ -539,6 +539,7 @@ Pod::Spec.new do |s|
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h',
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h',
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv_windows.h',
'src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h',
'src/core/ext/filters/max_age/max_age_filter.h',
'src/core/ext/filters/message_size/message_size_filter.h',
'src/core/ext/filters/http/client_authority_filter.h',
@ -869,6 +870,7 @@ Pod::Spec.new do |s|
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv_windows.cc',
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc',
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc',
'src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc',
'src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc',
'src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc',
'src/core/ext/filters/census/grpc_context.cc',
@ -1190,6 +1192,7 @@ Pod::Spec.new do |s|
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h',
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h',
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv_windows.h',
'src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h',
'src/core/ext/filters/max_age/max_age_filter.h',
'src/core/ext/filters/message_size/message_size_filter.h',
'src/core/ext/filters/http/client_authority_filter.h',

@ -473,6 +473,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv_windows.h )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h )
s.files += %w( src/core/ext/filters/max_age/max_age_filter.h )
s.files += %w( src/core/ext/filters/message_size/message_size_filter.h )
s.files += %w( src/core/ext/filters/http/client_authority_filter.h )
@ -806,6 +807,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv_windows.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc )
s.files += %w( src/core/ext/filters/census/grpc_context.cc )

@ -594,6 +594,7 @@
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv_windows.cc',
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc',
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc',
'src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc',
'src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc',
'src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc',
'src/core/ext/filters/census/grpc_context.cc',
@ -1354,6 +1355,7 @@
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv_windows.cc',
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc',
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc',
'src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc',
'src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc',
'src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc',
'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc',

@ -478,6 +478,7 @@
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv_windows.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/max_age/max_age_filter.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/message_size/message_size_filter.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/http/client_authority_filter.h" role="src" />
@ -811,6 +812,7 @@
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv_windows.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/census/grpc_context.cc" role="src" />

@ -18,8 +18,8 @@
#include <grpcpp/grpcpp.h>
#include <jni.h>
#include <src/core/lib/gpr/env.h>
#include "src/core/lib/security/security_connector/ssl_utils.h"
#include "test/cpp/interop/interop_client.h"
extern "C" JNIEXPORT void JNICALL
@ -28,7 +28,7 @@ Java_io_grpc_interop_cpp_InteropActivity_configureSslRoots(JNIEnv* env,
jstring path_raw) {
const char* path = env->GetStringUTFChars(path_raw, (jboolean*)0);
gpr_setenv("GRPC_DEFAULT_SSL_ROOTS_FILE_PATH", path);
GPR_GLOBAL_CONFIG_SET(grpc_default_ssl_roots_file_path, path);
}
std::shared_ptr<grpc::testing::InteropClient> GetClient(const char* host,
@ -45,7 +45,7 @@ std::shared_ptr<grpc::testing::InteropClient> GetClient(const char* host,
credentials = grpc::InsecureChannelCredentials();
}
grpc::testing::ChannelCreationFunc channel_creation_func =
grpc::testing::ChannelCreationFunc channel_creation_func =
std::bind(grpc::CreateChannel, host_port, credentials);
return std::shared_ptr<grpc::testing::InteropClient>(
new grpc::testing::InteropClient(channel_creation_func, true, false));

@ -56,9 +56,14 @@ static backup_poller* g_poller = nullptr; // guarded by g_poller_mu
// treated as const.
static int g_poll_interval_ms = DEFAULT_POLL_INTERVAL_MS;
GPR_GLOBAL_CONFIG_DEFINE_INT32(grpc_client_channel_backup_poll_interval_ms,
DEFAULT_POLL_INTERVAL_MS,
"Client channel backup poll interval (ms)");
GPR_GLOBAL_CONFIG_DEFINE_INT32(
grpc_client_channel_backup_poll_interval_ms, DEFAULT_POLL_INTERVAL_MS,
"Declares the interval in ms between two backup polls on client channels. "
"These polls are run in the timer thread so that gRPC can process "
"connection failures while there is no active polling thread. "
"They help reconnect disconnected client channels (mostly due to "
"idleness), so that the next RPC on this channel won't fail. Set to 0 to "
"turn off the backup polls.");
static void init_globals() {
gpr_mu_init(&g_poller_mu);

@ -31,7 +31,6 @@
#include "src/core/ext/filters/client_channel/resolver_registry.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/handshaker_registry.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/http/format_request.h"

@ -32,12 +32,12 @@
#include "src/core/ext/filters/client_channel/http_connect_handshaker.h"
#include "src/core/ext/filters/client_channel/lb_policy_registry.h"
#include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h"
#include "src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h"
#include "src/core/ext/filters/client_channel/resolver_registry.h"
#include "src/core/ext/filters/client_channel/server_address.h"
#include "src/core/ext/filters/client_channel/service_config.h"
#include "src/core/lib/backoff/backoff.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/manual_constructor.h"
@ -447,8 +447,9 @@ static bool should_use_ares(const char* resolver_env) {
#endif /* GRPC_UV */
void grpc_resolver_dns_ares_init() {
char* resolver_env = gpr_getenv("GRPC_DNS_RESOLVER");
if (should_use_ares(resolver_env)) {
grpc_core::UniquePtr<char> resolver =
GPR_GLOBAL_CONFIG_GET(grpc_dns_resolver);
if (should_use_ares(resolver.get())) {
gpr_log(GPR_DEBUG, "Using ares dns resolver");
address_sorting_init();
grpc_error* error = grpc_ares_init();
@ -464,16 +465,15 @@ void grpc_resolver_dns_ares_init() {
grpc_core::UniquePtr<grpc_core::ResolverFactory>(
grpc_core::New<grpc_core::AresDnsResolverFactory>()));
}
gpr_free(resolver_env);
}
void grpc_resolver_dns_ares_shutdown() {
char* resolver_env = gpr_getenv("GRPC_DNS_RESOLVER");
if (should_use_ares(resolver_env)) {
grpc_core::UniquePtr<char> resolver =
GPR_GLOBAL_CONFIG_GET(grpc_dns_resolver);
if (should_use_ares(resolver.get())) {
address_sorting_shutdown();
grpc_ares_cleanup();
}
gpr_free(resolver_env);
}
#else /* GRPC_ARES == 1 */

@ -0,0 +1,28 @@
//
// 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.
//
// This is similar to the sockaddr resolver, except that it supports a
// bunch of query args that are useful for dependency injection in tests.
#include <grpc/support/port_platform.h>
#include "src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h"
GPR_GLOBAL_CONFIG_DEFINE_STRING(
grpc_dns_resolver, "",
"Declares which DNS resolver to use. The default is ares if gRPC is built "
"with c-ares support. Otherwise, the value of this environment variable is "
"ignored.")

@ -0,0 +1,29 @@
/*
*
* 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_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_DNS_DNS_RESOLVER_SELECTION_H
#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_DNS_DNS_RESOLVER_SELECTION_H
#include <grpc/support/port_platform.h>
#include "src/core/lib/gprpp/global_config.h"
GPR_GLOBAL_CONFIG_DECLARE_STRING(grpc_dns_resolver);
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_DNS_DNS_RESOLVER_SELECTION_H \
*/

@ -26,11 +26,11 @@
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
#include "src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h"
#include "src/core/ext/filters/client_channel/resolver_registry.h"
#include "src/core/ext/filters/client_channel/server_address.h"
#include "src/core/lib/backoff/backoff.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/manual_constructor.h"
@ -274,8 +274,9 @@ class NativeDnsResolverFactory : public ResolverFactory {
} // namespace grpc_core
void grpc_resolver_dns_native_init() {
char* resolver_env = gpr_getenv("GRPC_DNS_RESOLVER");
if (resolver_env != nullptr && gpr_stricmp(resolver_env, "native") == 0) {
grpc_core::UniquePtr<char> resolver =
GPR_GLOBAL_CONFIG_GET(grpc_dns_resolver);
if (gpr_stricmp(resolver.get(), "native") == 0) {
gpr_log(GPR_DEBUG, "Using native dns resolver");
grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
grpc_core::UniquePtr<grpc_core::ResolverFactory>(
@ -291,7 +292,6 @@ void grpc_resolver_dns_native_init() {
grpc_core::New<grpc_core::NativeDnsResolverFactory>()));
}
}
gpr_free(resolver_env);
}
void grpc_resolver_dns_native_shutdown() {}

@ -23,8 +23,11 @@
#include "src/core/lib/gprpp/global_config.h"
#include "src/core/lib/transport/metadata.h"
GPR_GLOBAL_CONFIG_DEFINE_BOOL(grpc_experimental_disable_flow_control, false,
"Disable flow control");
GPR_GLOBAL_CONFIG_DEFINE_BOOL(
grpc_experimental_disable_flow_control, false,
"If set, flow control will be effectively disabled. Max out all values and "
"assume the remote peer does the same. Thus we can ignore any flow control "
"bookkeeping, error checking, and decision making");
void grpc_chttp2_plugin_init(void) {
g_flow_control_enabled =

@ -26,7 +26,11 @@
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/lib/gpr/env.h"
GPR_GLOBAL_CONFIG_DEFINE_STRING(
grpc_trace, "",
"A comma separated list of tracers that provide additional insight into "
"how gRPC C core is processing requests via debug logs.");
int grpc_tracer_set_enabled(const char* name, int enabled);
@ -133,12 +137,14 @@ static void parse(const char* s) {
gpr_free(strings);
}
void grpc_tracer_init(const char* env_var) {
char* e = gpr_getenv(env_var);
if (e != nullptr) {
parse(e);
gpr_free(e);
}
void grpc_tracer_init(const char* env_var_name) {
(void)env_var_name; // suppress unused variable error
grpc_tracer_init();
}
void grpc_tracer_init() {
grpc_core::UniquePtr<char> value = GPR_GLOBAL_CONFIG_GET(grpc_trace);
parse(value.get());
}
void grpc_tracer_shutdown(void) {}

@ -24,7 +24,15 @@
#include <grpc/support/atm.h>
#include <stdbool.h>
#include "src/core/lib/gprpp/global_config.h"
GPR_GLOBAL_CONFIG_DECLARE_STRING(grpc_trace);
// TODO(veblush): Remove this deprecated function once codes depending on this
// function are updated in the internal repo.
void grpc_tracer_init(const char* env_var_name);
void grpc_tracer_init();
void grpc_tracer_shutdown(void);
#if defined(__has_feature)

@ -34,12 +34,6 @@ char* gpr_getenv(const char* name);
/* Sets the environment with the specified name to the specified value. */
void gpr_setenv(const char* name, const char* value);
/* This is a version of gpr_getenv that does not produce any output if it has to
use an insecure version of the function. It is ONLY to be used to solve the
problem in which we need to check an env variable to configure the verbosity
level of logging. So DO NOT USE THIS. */
const char* gpr_getenv_silent(const char* name, char** dst);
/* Deletes the variable name from the environment. */
void gpr_unsetenv(const char* name);

@ -38,7 +38,7 @@
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
const char* gpr_getenv_silent(const char* name, char** dst) {
static const char* gpr_getenv_silent(const char* name, char** dst) {
const char* insecure_func_used = nullptr;
char* result = nullptr;
#if defined(GPR_BACKWARDS_COMPATIBILITY_MODE)

@ -30,11 +30,6 @@
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/string_windows.h"
const char* gpr_getenv_silent(const char* name, char** dst) {
*dst = gpr_getenv(name);
return NULL;
}
char* gpr_getenv(const char* name) {
char* result = NULL;
DWORD size;

@ -22,12 +22,15 @@
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/global_config.h"
#include <stdio.h>
#include <string.h>
GPR_GLOBAL_CONFIG_DEFINE_STRING(grpc_verbosity, "ERROR",
"Default gRPC logging verbosity")
void gpr_default_log(gpr_log_func_args* args);
static gpr_atm g_log_func = (gpr_atm)gpr_default_log;
static gpr_atm g_min_severity_to_print = GPR_LOG_VERBOSITY_UNSET;
@ -72,29 +75,22 @@ void gpr_set_log_verbosity(gpr_log_severity min_severity_to_print) {
}
void gpr_log_verbosity_init() {
char* verbosity = nullptr;
const char* insecure_getenv = gpr_getenv_silent("GRPC_VERBOSITY", &verbosity);
grpc_core::UniquePtr<char> verbosity = GPR_GLOBAL_CONFIG_GET(grpc_verbosity);
gpr_atm min_severity_to_print = GPR_LOG_SEVERITY_ERROR;
if (verbosity != nullptr) {
if (gpr_stricmp(verbosity, "DEBUG") == 0) {
if (strlen(verbosity.get()) > 0) {
if (gpr_stricmp(verbosity.get(), "DEBUG") == 0) {
min_severity_to_print = static_cast<gpr_atm>(GPR_LOG_SEVERITY_DEBUG);
} else if (gpr_stricmp(verbosity, "INFO") == 0) {
} else if (gpr_stricmp(verbosity.get(), "INFO") == 0) {
min_severity_to_print = static_cast<gpr_atm>(GPR_LOG_SEVERITY_INFO);
} else if (gpr_stricmp(verbosity, "ERROR") == 0) {
} else if (gpr_stricmp(verbosity.get(), "ERROR") == 0) {
min_severity_to_print = static_cast<gpr_atm>(GPR_LOG_SEVERITY_ERROR);
}
gpr_free(verbosity);
}
if ((gpr_atm_no_barrier_load(&g_min_severity_to_print)) ==
GPR_LOG_VERBOSITY_UNSET) {
gpr_atm_no_barrier_store(&g_min_severity_to_print, min_severity_to_print);
}
if (insecure_getenv != nullptr) {
gpr_log(GPR_DEBUG, "Warning: insecure environment read function '%s' used",
insecure_getenv);
}
}
void gpr_set_log_function(gpr_log_func f) {

@ -26,8 +26,8 @@
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/global_config.h"
#include "src/core/lib/gprpp/memory.h"
/*
@ -35,6 +35,16 @@
* AROUND VERY SPECIFIC USE CASES.
*/
#ifdef GRPC_ENABLE_FORK_SUPPORT
#define GRPC_ENABLE_FORK_SUPPORT_DEFAULT true
#else
#define GRPC_ENABLE_FORK_SUPPORT_DEFAULT false
#endif // GRPC_ENABLE_FORK_SUPPORT
GPR_GLOBAL_CONFIG_DEFINE_BOOL(grpc_enable_fork_support,
GRPC_ENABLE_FORK_SUPPORT_DEFAULT,
"Enable folk support");
namespace grpc_core {
namespace internal {
// The exec_ctx_count has 2 modes, blocked and unblocked.
@ -158,34 +168,7 @@ class ThreadState {
void Fork::GlobalInit() {
if (!override_enabled_) {
#ifdef GRPC_ENABLE_FORK_SUPPORT
support_enabled_ = true;
#endif
bool env_var_set = false;
char* env = gpr_getenv("GRPC_ENABLE_FORK_SUPPORT");
if (env != nullptr) {
static const char* truthy[] = {"yes", "Yes", "YES", "true",
"True", "TRUE", "1"};
static const char* falsey[] = {"no", "No", "NO", "false",
"False", "FALSE", "0"};
for (size_t i = 0; i < GPR_ARRAY_SIZE(truthy); i++) {
if (0 == strcmp(env, truthy[i])) {
support_enabled_ = true;
env_var_set = true;
break;
}
}
if (!env_var_set) {
for (size_t i = 0; i < GPR_ARRAY_SIZE(falsey); i++) {
if (0 == strcmp(env, falsey[i])) {
support_enabled_ = false;
env_var_set = true;
break;
}
}
}
gpr_free(env);
}
support_enabled_ = GPR_GLOBAL_CONFIG_GET(grpc_enable_fork_support);
}
if (support_enabled_) {
exec_ctx_state_ = grpc_core::New<internal::ExecCtxState>();

@ -31,13 +31,19 @@
#include <grpc/support/string_util.h>
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/global_config.h"
#include "src/core/lib/iomgr/ev_epoll1_linux.h"
#include "src/core/lib/iomgr/ev_epollex_linux.h"
#include "src/core/lib/iomgr/ev_poll_posix.h"
#include "src/core/lib/iomgr/internal_errqueue.h"
GPR_GLOBAL_CONFIG_DEFINE_STRING(
grpc_poll_strategy, "all",
"Declares which polling engines to try when starting gRPC. "
"This is a comma-separated list of engines, which are tried in priority "
"order first -> last.")
grpc_core::TraceFlag grpc_polling_trace(false,
"polling"); /* Disabled by default */
@ -46,16 +52,15 @@ grpc_core::TraceFlag grpc_fd_trace(false, "fd_trace");
grpc_core::DebugOnlyTraceFlag grpc_trace_fd_refcount(false, "fd_refcount");
grpc_core::DebugOnlyTraceFlag grpc_polling_api_trace(false, "polling_api");
#ifndef NDEBUG
// Polling API trace only enabled in debug builds
#ifndef NDEBUG
#define GRPC_POLLING_API_TRACE(format, ...) \
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_api_trace)) { \
gpr_log(GPR_INFO, "(polling-api) " format, __VA_ARGS__); \
}
#else
#define GRPC_POLLING_API_TRACE(...)
#endif
#endif // NDEBUG
/** Default poll() function - a pointer so that it can be overridden by some
* tests */
@ -66,7 +71,7 @@ int aix_poll(struct pollfd fds[], nfds_t nfds, int timeout) {
return poll(fds, nfds, timeout);
}
grpc_poll_function_type grpc_poll_function = aix_poll;
#endif
#endif // GPR_AIX
grpc_wakeup_fd grpc_global_wakeup_fd;
@ -205,14 +210,11 @@ void grpc_register_event_engine_factory(const char* name,
const char* grpc_get_poll_strategy_name() { return g_poll_strategy_name; }
void grpc_event_engine_init(void) {
char* s = gpr_getenv("GRPC_POLL_STRATEGY");
if (s == nullptr) {
s = gpr_strdup("all");
}
grpc_core::UniquePtr<char> value = GPR_GLOBAL_CONFIG_GET(grpc_poll_strategy);
char** strings = nullptr;
size_t nstrings = 0;
split(s, &strings, &nstrings);
split(value.get(), &strings, &nstrings);
for (size_t i = 0; g_event_engine == nullptr && i < nstrings; i++) {
try_engine(strings[i]);
@ -224,10 +226,10 @@ void grpc_event_engine_init(void) {
gpr_free(strings);
if (g_event_engine == nullptr) {
gpr_log(GPR_ERROR, "No event engine could be initialized from %s", s);
gpr_log(GPR_ERROR, "No event engine could be initialized from %s",
value.get());
abort();
}
gpr_free(s);
}
void grpc_event_engine_shutdown(void) {

@ -24,11 +24,14 @@
#include <poll.h>
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/global_config.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/pollset.h"
#include "src/core/lib/iomgr/pollset_set.h"
#include "src/core/lib/iomgr/wakeup_fd_posix.h"
GPR_GLOBAL_CONFIG_DECLARE_STRING(grpc_poll_strategy);
extern grpc_core::TraceFlag grpc_fd_trace; /* Disabled by default */
extern grpc_core::TraceFlag grpc_polling_trace; /* Disabled by default */

@ -28,7 +28,6 @@
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gprpp/fork.h"
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/ev_posix.h"

@ -42,7 +42,8 @@
#include "src/core/lib/iomgr/timer_manager.h"
GPR_GLOBAL_CONFIG_DEFINE_BOOL(grpc_abort_on_leaks, false,
"Abort when leak is found");
"A debugging aid to cause a call to abort() when "
"gRPC objects are leaked past grpc_shutdown()");
static gpr_mu g_mu;
static gpr_cv g_rcv;

@ -31,7 +31,8 @@
#include <stdio.h>
#include <string.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gprpp/global_config.h"
#include "src/core/lib/profiling/timers.h"
typedef enum { BEGIN = '{', END = '}', MARK = '.' } marker_type;
@ -74,11 +75,16 @@ static __thread int g_thread_id;
static int g_next_thread_id;
static int g_writing_enabled = 1;
GPR_GLOBAL_CONFIG_DEFINE_STRING(grpc_latency_trace, "latency_trace.txt",
"Output file name for latency trace")
static const char* output_filename() {
if (output_filename_or_null == NULL) {
output_filename_or_null = gpr_getenv("LATENCY_TRACE");
if (output_filename_or_null == NULL ||
strlen(output_filename_or_null) == 0) {
grpc_core::UniquePtr<char> value =
GPR_GLOBAL_CONFIG_GET(grpc_latency_trace);
if (strlen(value.get()) > 0) {
output_filename_or_null = value.release();
} else {
output_filename_or_null = "latency_trace.txt";
}
}

@ -38,12 +38,15 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/global_config.h"
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/iomgr/load_file.h"
GPR_GLOBAL_CONFIG_DEFINE_STRING(grpc_system_ssl_roots_dir, "",
"Custom directory to SSL Roots");
namespace grpc_core {
namespace {
@ -139,10 +142,9 @@ grpc_slice CreateRootCertsBundle(const char* certs_directory) {
grpc_slice LoadSystemRootCerts() {
grpc_slice result = grpc_empty_slice();
// Prioritize user-specified custom directory if flag is set.
char* custom_dir = gpr_getenv("GRPC_SYSTEM_SSL_ROOTS_DIR");
if (custom_dir != nullptr) {
result = CreateRootCertsBundle(custom_dir);
gpr_free(custom_dir);
UniquePtr<char> custom_dir = GPR_GLOBAL_CONFIG_GET(grpc_system_ssl_roots_dir);
if (strlen(custom_dir.get()) > 0) {
result = CreateRootCertsBundle(custom_dir.get());
}
// If the custom directory is empty/invalid/not specified, fallback to
// distribution-specific directory.

@ -28,7 +28,6 @@
#include "src/core/ext/transport/chttp2/alpn/alpn.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/handshaker.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/load_file.h"

@ -27,7 +27,6 @@
#include "src/core/ext/transport/chttp2/alpn/alpn.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/global_config.h"
@ -46,7 +45,13 @@ static const char* installed_roots_path =
INSTALL_PREFIX "/share/grpc/roots.pem";
#endif
/** Environment variable used as a flag to enable/disable loading system root
/** Config variable that points to the default SSL roots file. This file
must be a PEM encoded file with all the roots such as the one that can be
downloaded from https://pki.google.com/roots.pem. */
GPR_GLOBAL_CONFIG_DEFINE_STRING(grpc_default_ssl_roots_file_path, "",
"Path to the default SSL roots file.");
/** Config variable used as a flag to enable/disable loading system root
certificates from the OS trust store. */
GPR_GLOBAL_CONFIG_DEFINE_BOOL(grpc_not_use_system_ssl_roots, false,
"Disable loading system root certificates.");
@ -65,20 +70,22 @@ void grpc_set_ssl_roots_override_callback(grpc_ssl_roots_override_callback cb) {
/* -- Cipher suites. -- */
/* Defines the cipher suites that we accept by default. All these cipher suites
are compliant with HTTP2. */
#define GRPC_SSL_CIPHER_SUITES \
"ECDHE-ECDSA-AES128-GCM-SHA256:" \
"ECDHE-ECDSA-AES256-GCM-SHA384:" \
"ECDHE-RSA-AES128-GCM-SHA256:" \
"ECDHE-RSA-AES256-GCM-SHA384"
static gpr_once cipher_suites_once = GPR_ONCE_INIT;
static const char* cipher_suites = nullptr;
// All cipher suites for default are compliant with HTTP2.
GPR_GLOBAL_CONFIG_DEFINE_STRING(
grpc_ssl_cipher_suites,
"ECDHE-ECDSA-AES128-GCM-SHA256:"
"ECDHE-ECDSA-AES256-GCM-SHA384:"
"ECDHE-RSA-AES128-GCM-SHA256:"
"ECDHE-RSA-AES256-GCM-SHA384",
"A colon separated list of cipher suites to use with OpenSSL")
static void init_cipher_suites(void) {
char* overridden = gpr_getenv("GRPC_SSL_CIPHER_SUITES");
cipher_suites = overridden != nullptr ? overridden : GRPC_SSL_CIPHER_SUITES;
grpc_core::UniquePtr<char> value =
GPR_GLOBAL_CONFIG_GET(grpc_ssl_cipher_suites);
cipher_suites = value.release();
}
/* --- Util --- */
@ -430,13 +437,12 @@ grpc_slice DefaultSslRootStore::ComputePemRootCerts() {
grpc_slice result = grpc_empty_slice();
const bool not_use_system_roots =
GPR_GLOBAL_CONFIG_GET(grpc_not_use_system_ssl_roots);
// First try to load the roots from the environment.
char* default_root_certs_path =
gpr_getenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR);
if (default_root_certs_path != nullptr) {
GRPC_LOG_IF_ERROR("load_file",
grpc_load_file(default_root_certs_path, 1, &result));
gpr_free(default_root_certs_path);
// First try to load the roots from the configuration.
UniquePtr<char> default_root_certs_path =
GPR_GLOBAL_CONFIG_GET(grpc_default_ssl_roots_file_path);
if (strlen(default_root_certs_path.get()) > 0) {
GRPC_LOG_IF_ERROR(
"load_file", grpc_load_file(default_root_certs_path.get(), 1, &result));
}
// Try overridden roots if needed.
grpc_ssl_roots_override_result ovrd_res = GRPC_SSL_ROOTS_OVERRIDE_FAIL;

@ -26,6 +26,7 @@
#include <grpc/grpc_security.h>
#include <grpc/slice_buffer.h>
#include "src/core/lib/gprpp/global_config.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/security/security_connector/security_connector.h"
@ -33,7 +34,10 @@
#include "src/core/tsi/transport_security.h"
#include "src/core/tsi/transport_security_interface.h"
/* --- Util. --- */
GPR_GLOBAL_CONFIG_DECLARE_STRING(grpc_default_ssl_roots_file_path);
GPR_GLOBAL_CONFIG_DECLARE_BOOL(grpc_not_use_system_ssl_roots);
/* --- Util --- */
/* --- URL schemes. --- */
#define GRPC_SSL_URL_SCHEME "https"

@ -154,7 +154,7 @@ void grpc_init(void) {
* at the appropriate time */
grpc_register_security_filters();
register_builtin_channel_init();
grpc_tracer_init("GRPC_TRACE");
grpc_tracer_init();
/* no more changes to channel init pipelines */
grpc_channel_init_finalize();
grpc_iomgr_start();

@ -61,8 +61,7 @@
NSBundle *resourceBundle = [NSBundle
bundleWithURL:[[bundle resourceURL] URLByAppendingPathComponent:resourceBundlePath]];
NSString *path = [resourceBundle pathForResource:rootsPEM ofType:@"pem"];
setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR,
[path cStringUsingEncoding:NSUTF8StringEncoding], 1);
setenv("GRPC_DEFAULT_SSL_ROOTS_FILE_PATH", [path cStringUsingEncoding:NSUTF8StringEncoding], 1);
});
NSData *rootsASCII = nil;

@ -37,11 +37,11 @@
#include <grpc/support/log.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/tmpfile.h"
#include "src/core/lib/security/credentials/credentials.h"
#include "src/core/lib/security/security_connector/ssl_utils.h"
#include "test/core/end2end/data/ssl_test_data.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
@ -172,7 +172,7 @@ static char *roots_filename;
GPR_ASSERT(roots_file != NULL);
GPR_ASSERT(fwrite(test_root_cert, 1, roots_size, roots_file) == roots_size);
fclose(roots_file);
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, roots_filename);
GPR_GLOBAL_CONFIG_SET(grpc_default_ssl_roots_file_path, roots_filename);
grpc_init();

@ -386,6 +386,7 @@ CORE_SOURCE_FILES = [
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv_windows.cc',
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc',
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc',
'src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc',
'src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc',
'src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc',
'src/core/ext/filters/census/grpc_context.cc',

@ -39,7 +39,6 @@
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/iomgr/endpoint_pair.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/completion_queue.h"

@ -25,9 +25,9 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/security/security_connector/ssl_utils.h"
#include "test/core/end2end/cq_verifier.h"
#include "test/core/util/port.h"
#include "test/core/util/subprocess.h"
@ -133,7 +133,7 @@ int main(int argc, char** argv) {
strcpy(root, ".");
}
if (argc == 2) {
gpr_setenv("GRPC_DEFAULT_SSL_ROOTS_FILE_PATH", argv[1]);
GPR_GLOBAL_CONFIG_SET(grpc_default_ssl_roots_file_path, argv[1]);
}
/* figure out our test name */
tmp = lunder - 1;

@ -21,8 +21,8 @@
#include <grpc/support/log.h>
#include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h"
#include "src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h"
#include "src/core/ext/filters/client_channel/resolver_registry.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/combiner.h"
#include "test/core/util/test_config.h"
@ -78,13 +78,13 @@ int main(int argc, char** argv) {
test_succeeds(dns, "dns:10.2.1.1:1234");
test_succeeds(dns, "dns:www.google.com");
test_succeeds(dns, "dns:///www.google.com");
char* resolver_env = gpr_getenv("GRPC_DNS_RESOLVER");
if (resolver_env != nullptr && gpr_stricmp(resolver_env, "native") == 0) {
grpc_core::UniquePtr<char> resolver =
GPR_GLOBAL_CONFIG_GET(grpc_dns_resolver);
if (gpr_stricmp(resolver.get(), "native") == 0) {
test_fails(dns, "dns://8.8.8.8/8.8.8.8:8888");
} else {
test_succeeds(dns, "dns://8.8.8.8/8.8.8.8:8888");
}
gpr_free(resolver_env);
{
grpc_core::ExecCtx exec_ctx;
GRPC_COMBINER_UNREF(g_combiner, "test");

@ -33,7 +33,7 @@
#include "src/core/ext/filters/http/server/http_server_filter.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/server.h"
@ -105,7 +105,7 @@ int main(int argc, char** argv) {
/* force tracing on, with a value to force many
code paths in trace.c to be taken */
gpr_setenv("GRPC_TRACE", "doesnt-exist,http,all");
GPR_GLOBAL_CONFIG_SET(grpc_trace, "doesnt-exist,http,all");
#ifdef GRPC_POSIX_SOCKET
g_fixture_slowdown_factor = isatty(STDOUT_FILENO) ? 10 : 1;

@ -35,7 +35,7 @@
#include "src/core/ext/filters/http/server/http_server_filter.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/iomgr/endpoint_pair.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/surface/channel.h"
@ -133,7 +133,8 @@ int main(int argc, char** argv) {
/* force tracing on, with a value to force many
code paths in trace.c to be taken */
gpr_setenv("GRPC_TRACE", "doesnt-exist,http,all");
GPR_GLOBAL_CONFIG_SET(grpc_trace, "doesnt-exist,http,all");
#ifdef GRPC_POSIX_SOCKET
g_fixture_slowdown_factor = isatty(STDOUT_FILENO) ? 10 : 1;
#else

@ -35,6 +35,7 @@
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/security/credentials/credentials.h"
#include "src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h"
#include "src/core/lib/security/security_connector/ssl_utils.h"
#include "test/core/end2end/data/ssl_test_data.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
@ -277,7 +278,7 @@ int main(int argc, char** argv) {
GPR_ASSERT(roots_file != nullptr);
GPR_ASSERT(fwrite(test_root_cert, 1, roots_size, roots_file) == roots_size);
fclose(roots_file);
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, roots_filename);
GPR_GLOBAL_CONFIG_SET(grpc_default_ssl_roots_file_path, roots_filename);
grpc_init();
for (size_t ind = 0; ind < sizeof(configs) / sizeof(*configs); ind++) {
grpc_end2end_tests(argc, argv, configs[ind]);

@ -25,11 +25,11 @@
#include <grpc/support/log.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/tmpfile.h"
#include "src/core/lib/security/credentials/credentials.h"
#include "src/core/lib/security/security_connector/ssl_utils.h"
#include "test/core/end2end/data/ssl_test_data.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
@ -167,7 +167,7 @@ int main(int argc, char** argv) {
GPR_ASSERT(roots_file != nullptr);
GPR_ASSERT(fwrite(test_root_cert, 1, roots_size, roots_file) == roots_size);
fclose(roots_file);
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, roots_filename);
GPR_GLOBAL_CONFIG_SET(grpc_default_ssl_roots_file_path, roots_filename);
grpc_init();

@ -25,11 +25,11 @@
#include <grpc/support/log.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/tmpfile.h"
#include "src/core/lib/security/credentials/credentials.h"
#include "src/core/lib/security/security_connector/ssl_utils.h"
#include "test/core/end2end/data/ssl_test_data.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
@ -190,7 +190,7 @@ int main(int argc, char** argv) {
GPR_ASSERT(roots_file != nullptr);
GPR_ASSERT(fwrite(test_root_cert, 1, roots_size, roots_file) == roots_size);
fclose(roots_file);
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, roots_filename);
GPR_GLOBAL_CONFIG_SET(grpc_default_ssl_roots_file_path, roots_filename);
grpc_init();

@ -25,11 +25,11 @@
#include <grpc/support/log.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/tmpfile.h"
#include "src/core/lib/security/credentials/credentials.h"
#include "src/core/lib/security/security_connector/ssl_utils.h"
#include "test/core/end2end/data/ssl_test_data.h"
#include "test/core/end2end/fixtures/proxy.h"
#include "test/core/util/port.h"
@ -208,7 +208,7 @@ int main(int argc, char** argv) {
GPR_ASSERT(roots_file != nullptr);
GPR_ASSERT(fwrite(test_root_cert, 1, roots_size, roots_file) == roots_size);
fclose(roots_file);
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, roots_filename);
GPR_GLOBAL_CONFIG_SET(grpc_default_ssl_roots_file_path, roots_filename);
grpc_init();

@ -25,11 +25,11 @@
#include <grpc/support/log.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/tmpfile.h"
#include "src/core/lib/security/credentials/credentials.h"
#include "src/core/lib/security/security_connector/ssl_utils.h"
#include "test/core/end2end/cq_verifier.h"
#include "test/core/end2end/data/ssl_test_data.h"
#include "test/core/util/port.h"
@ -366,7 +366,7 @@ int main(int argc, char** argv) {
GPR_ASSERT(roots_file != nullptr);
GPR_ASSERT(fwrite(test_root_cert, 1, roots_size, roots_file) == roots_size);
fclose(roots_file);
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, roots_filename);
GPR_GLOBAL_CONFIG_SET(grpc_default_ssl_roots_file_path, roots_filename);
grpc_init();
::testing::InitGoogleTest(&argc, argv);

@ -25,11 +25,11 @@
#include <grpc/support/log.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/tmpfile.h"
#include "src/core/lib/security/credentials/credentials.h"
#include "src/core/lib/security/security_connector/ssl_utils.h"
#include "test/core/end2end/cq_verifier.h"
#include "test/core/end2end/data/ssl_test_data.h"
#include "test/core/util/port.h"
@ -265,7 +265,7 @@ int main(int argc, char** argv) {
GPR_ASSERT(roots_file != nullptr);
GPR_ASSERT(fwrite(test_root_cert, 1, roots_size, roots_file) == roots_size);
fclose(roots_file);
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, roots_filename);
GPR_GLOBAL_CONFIG_SET(grpc_default_ssl_roots_file_path, roots_filename);
grpc_init();
::testing::InitGoogleTest(&argc, argv);

@ -28,11 +28,15 @@
#include "src/core/ext/transport/chttp2/transport/frame_ping.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "test/core/end2end/cq_verifier.h"
#ifdef GRPC_POSIX_SOCKET
#include "src/core/lib/iomgr/ev_posix.h"
#endif // GRPC_POSIX_SOCKET
static void* tag(intptr_t t) { return (void*)t; }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
@ -225,13 +229,13 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) {
* 200ms. In the success case, each ping ack should reset the keepalive timer so
* that the keepalive ping is never sent. */
static void test_read_delays_keepalive(grpc_end2end_test_config config) {
char* poller = gpr_getenv("GRPC_POLL_STRATEGY");
#ifdef GRPC_POSIX_SOCKET
grpc_core::UniquePtr<char> poller = GPR_GLOBAL_CONFIG_GET(grpc_poll_strategy);
/* It is hard to get the timing right for the polling engine poll. */
if (poller != nullptr && (0 == strcmp(poller, "poll"))) {
gpr_free(poller);
if ((0 == strcmp(poller.get(), "poll"))) {
return;
}
gpr_free(poller);
#endif // GRPC_POSIX_SOCKET
const int kPingIntervalMS = 100;
grpc_arg keepalive_arg_elems[3];
keepalive_arg_elems[0].type = GRPC_ARG_INTEGER;

@ -21,9 +21,14 @@
#include <stdbool.h>
#include <string.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gprpp/global_config.h"
#include "test/core/util/test_config.h"
// Config declaration is supposed to be located at log.h but
// log.h doesn't include global_config headers because it has to
// be a strict C so declaration statement gets to be here.
GPR_GLOBAL_CONFIG_DECLARE_STRING(grpc_verbosity);
static bool log_func_reached = false;
static void test_callback(gpr_log_func_args* args) {
@ -67,7 +72,7 @@ int main(int argc, char** argv) {
/* gpr_log_verbosity_init() will be effective only once, and only before
* gpr_set_log_verbosity() is called */
gpr_setenv("GRPC_VERBOSITY", "ERROR");
GPR_GLOBAL_CONFIG_SET(grpc_verbosity, "ERROR");
gpr_log_verbosity_init();
test_log_function_reached(GPR_ERROR);
@ -75,7 +80,7 @@ int main(int argc, char** argv) {
test_log_function_unreached(GPR_DEBUG);
/* gpr_log_verbosity_init() should not be effective */
gpr_setenv("GRPC_VERBOSITY", "DEBUG");
GPR_GLOBAL_CONFIG_SET(grpc_verbosity, "DEBUG");
gpr_log_verbosity_init();
test_log_function_reached(GPR_ERROR);
test_log_function_unreached(GPR_INFO);
@ -97,7 +102,7 @@ int main(int argc, char** argv) {
test_log_function_unreached(GPR_DEBUG);
/* gpr_log_verbosity_init() should not be effective */
gpr_setenv("GRPC_VERBOSITY", "DEBUG");
GPR_GLOBAL_CONFIG_SET(grpc_verbosity, "DEBUG");
gpr_log_verbosity_init();
test_log_function_reached(GPR_ERROR);
test_log_function_unreached(GPR_INFO);

@ -29,6 +29,7 @@
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/security/security_connector/ssl_utils.h"
#include "test/core/util/port.h"
#include "test/core/util/subprocess.h"
#include "test/core/util/test_config.h"
@ -184,7 +185,7 @@ int main(int argc, char** argv) {
/* Set the environment variable for the SSL certificate file */
char* pem_file;
gpr_asprintf(&pem_file, "%s/src/core/tsi/test_creds/ca.pem", root);
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, pem_file);
GPR_GLOBAL_CONFIG_SET(grpc_default_ssl_roots_file_path, pem_file);
gpr_free(pem_file);
/* start the server */

@ -29,6 +29,7 @@
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
#include "src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
@ -224,15 +225,16 @@ int main(int argc, char** argv) {
// --resolver will always be the first one, so only parse the first argument
// (other arguments may be unknown to cl)
gpr_cmdline_parse(cl, argc > 2 ? 2 : argc, argv);
const char* cur_resolver = gpr_getenv("GRPC_DNS_RESOLVER");
if (cur_resolver != nullptr && strlen(cur_resolver) != 0) {
grpc_core::UniquePtr<char> resolver =
GPR_GLOBAL_CONFIG_GET(grpc_dns_resolver);
if (strlen(resolver.get()) != 0) {
gpr_log(GPR_INFO, "Warning: overriding resolver setting of %s",
cur_resolver);
resolver.get());
}
if (gpr_stricmp(resolver_type, "native") == 0) {
gpr_setenv("GRPC_DNS_RESOLVER", "native");
GPR_GLOBAL_CONFIG_SET(grpc_dns_resolver, "native");
} else if (gpr_stricmp(resolver_type, "ares") == 0) {
gpr_setenv("GRPC_DNS_RESOLVER", "ares");
GPR_GLOBAL_CONFIG_SET(grpc_dns_resolver, "ares");
} else {
gpr_log(GPR_ERROR, "--resolver_type was not set to ares or native");
abort();
@ -246,12 +248,12 @@ int main(int argc, char** argv) {
// c-ares resolver doesn't support UDS (ability for native DNS resolver
// to handle this is only expected to be used by servers, which
// unconditionally use the native DNS resolver).
char* resolver_env = gpr_getenv("GRPC_DNS_RESOLVER");
if (resolver_env == nullptr || gpr_stricmp(resolver_env, "native") == 0) {
grpc_core::UniquePtr<char> resolver =
GPR_GLOBAL_CONFIG_GET(grpc_dns_resolver);
if (gpr_stricmp(resolver.get(), "native") == 0) {
test_unix_socket();
test_unix_socket_path_name_too_long();
}
gpr_free(resolver_env);
}
gpr_cmdline_destroy(cl);

@ -27,7 +27,7 @@
#include <string.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/iomgr/iomgr.h"
@ -347,16 +347,17 @@ int main(int argc, char** argv) {
// --resolver will always be the first one, so only parse the first argument
// (other arguments may be unknown to cl)
gpr_cmdline_parse(cl, argc > 2 ? 2 : argc, argv);
const char* cur_resolver = gpr_getenv("GRPC_DNS_RESOLVER");
if (cur_resolver != nullptr && strlen(cur_resolver) != 0) {
grpc_core::UniquePtr<char> resolver =
GPR_GLOBAL_CONFIG_GET(grpc_dns_resolver);
if (strlen(resolver.get()) != 0) {
gpr_log(GPR_INFO, "Warning: overriding resolver setting of %s",
cur_resolver);
resolver.get());
}
if (gpr_stricmp(resolver_type, "native") == 0) {
gpr_setenv("GRPC_DNS_RESOLVER", "native");
GPR_GLOBAL_CONFIG_SET(grpc_dns_resolver, "native");
} else if (gpr_stricmp(resolver_type, "ares") == 0) {
#ifndef GRPC_UV
gpr_setenv("GRPC_DNS_RESOLVER", "ares");
GPR_GLOBAL_CONFIG_SET(grpc_dns_resolver, "ares");
#endif
} else {
gpr_log(GPR_ERROR, "--resolver_type was not set to ares or native");

@ -1161,7 +1161,7 @@ static void test_get_well_known_google_credentials_file_path(void) {
GPR_ASSERT(path != nullptr);
gpr_free(path);
#if defined(GPR_POSIX_ENV) || defined(GPR_LINUX_ENV)
unsetenv("HOME");
gpr_unsetenv("HOME");
path = grpc_get_well_known_google_credentials_file_path();
GPR_ASSERT(path == nullptr);
gpr_setenv("HOME", home);

@ -24,7 +24,6 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/tmpfile.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
@ -394,7 +393,7 @@ static void test_default_ssl_roots(void) {
/* First let's get the root through the override: set the env to an invalid
value. */
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, "");
GPR_GLOBAL_CONFIG_SET(grpc_default_ssl_roots_file_path, "");
grpc_set_ssl_roots_override_callback(override_roots_success);
grpc_slice roots =
grpc_core::TestDefaultSslRootStore::ComputePemRootCertsForTesting();
@ -405,7 +404,8 @@ static void test_default_ssl_roots(void) {
/* Now let's set the env var: We should get the contents pointed value
instead. */
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, roots_env_var_file_path);
GPR_GLOBAL_CONFIG_SET(grpc_default_ssl_roots_file_path,
roots_env_var_file_path);
roots = grpc_core::TestDefaultSslRootStore::ComputePemRootCertsForTesting();
roots_contents = grpc_slice_to_c_string(roots);
grpc_slice_unref(roots);
@ -414,7 +414,7 @@ static void test_default_ssl_roots(void) {
/* Now reset the env var. We should fall back to the value overridden using
the api. */
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, "");
GPR_GLOBAL_CONFIG_SET(grpc_default_ssl_roots_file_path, "");
roots = grpc_core::TestDefaultSslRootStore::ComputePemRootCertsForTesting();
roots_contents = grpc_slice_to_c_string(roots);
grpc_slice_unref(roots);
@ -423,7 +423,7 @@ static void test_default_ssl_roots(void) {
/* Now setup a permanent failure for the overridden roots and we should get
an empty slice. */
gpr_setenv("GRPC_NOT_USE_SYSTEM_SSL_ROOTS", "true");
GPR_GLOBAL_CONFIG_SET(grpc_not_use_system_ssl_roots, true);
grpc_set_ssl_roots_override_callback(override_roots_permanent_failure);
roots = grpc_core::TestDefaultSslRootStore::ComputePemRootCertsForTesting();
GPR_ASSERT(GRPC_SLICE_IS_EMPTY(roots));

@ -28,7 +28,6 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/surface/init.h"

@ -33,7 +33,6 @@
#include <grpcpp/server_context.h>
#include "src/core/ext/filters/client_channel/backup_poller.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/tls.h"
#include "src/core/lib/iomgr/port.h"
#include "src/proto/grpc/health/v1/health.grpc.pb.h"
@ -44,6 +43,10 @@
#include "test/cpp/util/string_ref_helper.h"
#include "test/cpp/util/test_credentials_provider.h"
#ifdef GRPC_POSIX_SOCKET
#include "src/core/lib/iomgr/ev_posix.h"
#endif // GRPC_POSIX_SOCKET
#include <gtest/gtest.h>
using grpc::testing::EchoRequest;
@ -359,13 +362,14 @@ TEST_P(AsyncEnd2endTest, ReconnectChannel) {
return;
}
int poller_slowdown_factor = 1;
#ifdef GRPC_POSIX_SOCKET
// It needs 2 pollset_works to reconnect the channel with polling engine
// "poll"
char* s = gpr_getenv("GRPC_POLL_STRATEGY");
if (s != nullptr && 0 == strcmp(s, "poll")) {
grpc_core::UniquePtr<char> poller = GPR_GLOBAL_CONFIG_GET(grpc_poll_strategy);
if (0 == strcmp(poller.get(), "poll")) {
poller_slowdown_factor = 2;
}
gpr_free(s);
#endif // GRPC_POSIX_SOCKET
ResetStub();
SendRpc(1);
server_->Shutdown();

@ -35,7 +35,6 @@
#include <grpcpp/server_context.h>
#include "src/core/ext/filters/client_channel/backup_poller.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/security/credentials/credentials.h"
#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
@ -47,6 +46,10 @@
#include "test/cpp/util/string_ref_helper.h"
#include "test/cpp/util/test_credentials_provider.h"
#ifdef GRPC_POSIX_SOCKET
#include "src/core/lib/iomgr/ev_posix.h"
#endif // GRPC_POSIX_SOCKET
#include <gtest/gtest.h>
using grpc::testing::EchoRequest;
@ -809,11 +812,12 @@ TEST_P(End2endTest, ReconnectChannel) {
int poller_slowdown_factor = 1;
// It needs 2 pollset_works to reconnect the channel with polling engine
// "poll"
char* s = gpr_getenv("GRPC_POLL_STRATEGY");
if (s != nullptr && 0 == strcmp(s, "poll")) {
#ifdef GRPC_POSIX_SOCKET
grpc_core::UniquePtr<char> poller = GPR_GLOBAL_CONFIG_GET(grpc_poll_strategy);
if (0 == strcmp(poller.get(), "poll")) {
poller_slowdown_factor = 2;
}
gpr_free(s);
#endif // GRPC_POSIX_SOCKET
ResetStub();
SendRpc(stub_.get(), 1, false);
RestartServer(std::shared_ptr<AuthMetadataProcessor>());

@ -36,10 +36,10 @@
#include "src/core/ext/filters/client_channel/client_channel.h"
#include "src/core/ext/filters/client_channel/resolver.h"
#include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h"
#include "src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h"
#include "src/core/ext/filters/client_channel/resolver_registry.h"
#include "src/core/ext/filters/client_channel/server_address.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/combiner.h"
@ -829,13 +829,13 @@ TEST_F(AddressSortingTest, TestSorterKnowsIpv6LoopbackIsAvailable) {
} // namespace
int main(int argc, char** argv) {
char* resolver = gpr_getenv("GRPC_DNS_RESOLVER");
if (resolver == nullptr || strlen(resolver) == 0) {
gpr_setenv("GRPC_DNS_RESOLVER", "ares");
} else if (strcmp("ares", resolver)) {
gpr_log(GPR_INFO, "GRPC_DNS_RESOLVER != ares: %s.", resolver);
grpc_core::UniquePtr<char> resolver =
GPR_GLOBAL_CONFIG_GET(grpc_dns_resolver);
if (strlen(resolver.get()) == 0) {
GPR_GLOBAL_CONFIG_SET(grpc_dns_resolver, "ares");
} else if (strcmp("ares", resolver.get())) {
gpr_log(GPR_INFO, "GRPC_DNS_RESOLVER != ares: %s.", resolver.get());
}
gpr_free(resolver);
grpc::testing::TestEnvironment env(argc, argv);
::testing::InitGoogleTest(&argc, argv);
auto result = RUN_ALL_TESTS();

@ -29,10 +29,10 @@
#include <grpc/support/time.h>
#include "include/grpc/support/string_util.h"
#include "src/core/ext/filters/client_channel/resolver.h"
#include "src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h"
#include "src/core/ext/filters/client_channel/resolver_registry.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/orphanable.h"
@ -374,7 +374,7 @@ TEST(
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
::testing::InitGoogleTest(&argc, argv);
gpr_setenv("GRPC_DNS_RESOLVER", "ares");
GPR_GLOBAL_CONFIG_SET(grpc_dns_resolver, "ares");
// Sanity check the time that it takes to run the test
// including the teardown time (the teardown
// part of the test involves cancelling the DNS query,

@ -46,7 +46,6 @@
#include "src/core/ext/filters/client_channel/resolver_registry.h"
#include "src/core/ext/filters/client_channel/server_address.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/orphanable.h"

@ -953,6 +953,8 @@ src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv_
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv_windows.h \
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc \
src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc \
src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc \
src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h \
src/core/ext/filters/client_channel/resolver/dns/native/README.md \
src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc \
src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc \

@ -9155,7 +9155,8 @@
"deps": [
"gpr",
"grpc_base",
"grpc_client_channel"
"grpc_client_channel",
"grpc_resolver_dns_selection"
],
"headers": [
"src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h",
@ -9188,7 +9189,8 @@
"deps": [
"gpr",
"grpc_base",
"grpc_client_channel"
"grpc_client_channel",
"grpc_resolver_dns_selection"
],
"headers": [],
"is_filegroup": true,
@ -9200,6 +9202,24 @@
"third_party": false,
"type": "filegroup"
},
{
"deps": [
"gpr",
"grpc_base"
],
"headers": [
"src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h"
],
"is_filegroup": true,
"language": "c",
"name": "grpc_resolver_dns_selection",
"src": [
"src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc",
"src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h"
],
"third_party": false,
"type": "filegroup"
},
{
"deps": [
"gpr",

@ -96,7 +96,7 @@ def collect_latency(bm_name, args):
'--benchmark_filter=^%s$' % line,
'--benchmark_min_time=0.05'
],
environ={'LATENCY_TRACE': '%s.trace' % fnize(line)},
environ={'GRPC_LATENCY_TRACE': '%s.trace' % fnize(line)},
shortname='profile-%s' % fnize(line)))
profile_analysis.append(
jobset.JobSpec(

@ -45,10 +45,6 @@ BANNED_EXCEPT = {
'grpc_closure_sched(': ['src/core/lib/iomgr/closure.cc'],
'grpc_closure_run(': ['src/core/lib/iomgr/closure.cc'],
'grpc_closure_list_sched(': ['src/core/lib/iomgr/closure.cc'],
'gpr_getenv_silent(': [
'src/core/lib/gpr/log.cc', 'src/core/lib/gpr/env_linux.cc',
'src/core/lib/gpr/env_posix.cc', 'src/core/lib/gpr/env_windows.cc'
],
}
errors = 0

Loading…
Cancel
Save