Merge branch 'cares_env' into cares_buildin

reviewable/pr7771/r5
Yuchen Zeng 8 years ago
commit cc8b841832
  1. 1
      build.yaml
  2. 7
      src/core/ext/resolver/dns/c_ares/dns_resolver_ares.c
  3. 8
      src/core/ext/resolver/dns/native/dns_resolver.c
  4. 4
      src/core/plugin_registry/grpc_plugin_registry.c
  5. 4
      src/core/plugin_registry/grpc_unsecure_plugin_registry.c
  6. 3
      tools/run_tests/run_tests.py
  7. 32
      tools/run_tests/run_tests_matrix.py

@ -476,6 +476,7 @@ filegroups:
- name: grpc_resolver_dns_native
src:
- src/core/ext/resolver/dns/native/dns_resolver.c
plugin: grpc_resolver_dns_native
uses:
- grpc_base
- grpc_client_channel

@ -47,6 +47,7 @@
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/support/backoff.h"
#include "src/core/lib/support/env.h"
#include "src/core/lib/support/string.h"
#define BACKOFF_MULTIPLIER 1.6
@ -339,7 +340,11 @@ static grpc_resolver_factory *dns_ares_resolver_factory_create() {
}
void grpc_resolver_dns_ares_init(void) {
grpc_register_resolver_type(dns_ares_resolver_factory_create());
char *resolver = gpr_getenv("GRPC_DNS_RESOLVER");
if (resolver == NULL || gpr_stricmp(resolver, "ares") == 0) {
grpc_register_resolver_type(dns_ares_resolver_factory_create());
}
gpr_free(resolver);
}
void grpc_resolver_dns_ares_shutdown(void) {}

@ -44,6 +44,7 @@
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/support/backoff.h"
#include "src/core/lib/support/env.h"
#include "src/core/lib/support/string.h"
#define BACKOFF_MULTIPLIER 1.6
@ -304,7 +305,12 @@ static grpc_resolver_factory *dns_resolver_factory_create() {
}
void grpc_resolver_dns_native_init(void) {
grpc_register_resolver_type(dns_resolver_factory_create());
char *resolver = gpr_getenv("GRPC_DNS_RESOLVER");
if (resolver != NULL && gpr_stricmp(resolver, "native") == 0) {
gpr_log(GPR_DEBUG, "Using native dns resolver");
grpc_register_resolver_type(dns_resolver_factory_create());
}
gpr_free(resolver);
}
void grpc_resolver_dns_native_shutdown(void) {}

@ -45,6 +45,8 @@ extern void grpc_lb_policy_round_robin_init(void);
extern void grpc_lb_policy_round_robin_shutdown(void);
extern void grpc_resolver_dns_ares_init(void);
extern void grpc_resolver_dns_ares_shutdown(void);
extern void grpc_resolver_dns_native_init(void);
extern void grpc_resolver_dns_native_shutdown(void);
extern void grpc_resolver_sockaddr_init(void);
extern void grpc_resolver_sockaddr_shutdown(void);
extern void grpc_load_reporting_plugin_init(void);
@ -65,6 +67,8 @@ void grpc_register_built_in_plugins(void) {
grpc_lb_policy_round_robin_shutdown);
grpc_register_plugin(grpc_resolver_dns_ares_init,
grpc_resolver_dns_ares_shutdown);
grpc_register_plugin(grpc_resolver_dns_native_init,
grpc_resolver_dns_native_shutdown);
grpc_register_plugin(grpc_resolver_sockaddr_init,
grpc_resolver_sockaddr_shutdown);
grpc_register_plugin(grpc_load_reporting_plugin_init,

@ -39,6 +39,8 @@ extern void grpc_client_channel_init(void);
extern void grpc_client_channel_shutdown(void);
extern void grpc_resolver_dns_ares_init(void);
extern void grpc_resolver_dns_ares_shutdown(void);
extern void grpc_resolver_dns_native_init(void);
extern void grpc_resolver_dns_native_shutdown(void);
extern void grpc_resolver_sockaddr_init(void);
extern void grpc_resolver_sockaddr_shutdown(void);
extern void grpc_load_reporting_plugin_init(void);
@ -59,6 +61,8 @@ void grpc_register_built_in_plugins(void) {
grpc_client_channel_shutdown);
grpc_register_plugin(grpc_resolver_dns_ares_init,
grpc_resolver_dns_ares_shutdown);
grpc_register_plugin(grpc_resolver_dns_native_init,
grpc_resolver_dns_native_shutdown);
grpc_register_plugin(grpc_resolver_sockaddr_init,
grpc_resolver_sockaddr_shutdown);
grpc_register_plugin(grpc_load_reporting_plugin_init,

@ -230,6 +230,9 @@ class CLanguage(object):
_ROOT + '/src/core/lib/tsi/test_creds/ca.pem',
'GRPC_POLL_STRATEGY': polling_strategy,
'GRPC_VERBOSITY': 'DEBUG'}
resolver = os.environ.get('GRPC_DNS_RESOLVER', None);
if resolver:
env['GRPC_DNS_RESOLVER'] = resolver
shortname_ext = '' if polling_strategy=='all' else ' GRPC_POLL_STRATEGY=%s' % polling_strategy
if self.config.build_config in target['exclude_configs']:
continue

@ -49,7 +49,8 @@ _RUNTESTS_TIMEOUT = 4*60*60
_DEFAULT_INNER_JOBS = 2
def _docker_jobspec(name, runtests_args=[], inner_jobs=_DEFAULT_INNER_JOBS):
def _docker_jobspec(name, runtests_args=[], runtests_envs={},
inner_jobs=_DEFAULT_INNER_JOBS):
"""Run a single instance of run_tests.py in a docker container"""
test_job = jobset.JobSpec(
cmdline=['python', 'tools/run_tests/run_tests.py',
@ -58,16 +59,19 @@ def _docker_jobspec(name, runtests_args=[], inner_jobs=_DEFAULT_INNER_JOBS):
'-j', str(inner_jobs),
'-x', 'report_%s.xml' % name,
'--report_suite_name', '%s' % name] + runtests_args,
environ=runtests_envs,
shortname='run_tests_%s' % name,
timeout_seconds=_RUNTESTS_TIMEOUT)
return test_job
def _workspace_jobspec(name, runtests_args=[], workspace_name=None, inner_jobs=_DEFAULT_INNER_JOBS):
def _workspace_jobspec(name, runtests_args=[], workspace_name=None,
runtests_envs={}, inner_jobs=_DEFAULT_INNER_JOBS):
"""Run a single instance of run_tests.py in a separate workspace"""
if not workspace_name:
workspace_name = 'workspace_%s' % name
env = {'WORKSPACE_NAME': workspace_name}
env.update(runtests_envs)
test_job = jobset.JobSpec(
cmdline=['tools/run_tests/run_tests_in_workspace.sh',
'-t',
@ -82,7 +86,7 @@ def _workspace_jobspec(name, runtests_args=[], workspace_name=None, inner_jobs=_
def _generate_jobs(languages, configs, platforms,
arch=None, compiler=None,
labels=[], extra_args=[],
labels=[], extra_args=[], extra_envs={},
inner_jobs=_DEFAULT_INNER_JOBS):
result = []
for language in languages:
@ -95,12 +99,16 @@ def _generate_jobs(languages, configs, platforms,
name += '_%s_%s' % (arch, compiler)
runtests_args += ['--arch', arch,
'--compiler', compiler]
for extra_env in extra_envs:
name += '_%s_%s' % (extra_env, extra_envs[extra_env])
runtests_args += extra_args
if platform == 'linux':
job = _docker_jobspec(name=name, runtests_args=runtests_args, inner_jobs=inner_jobs)
job = _docker_jobspec(name=name, runtests_args=runtests_args,
runtests_envs=extra_envs, inner_jobs=inner_jobs)
else:
job = _workspace_jobspec(name=name, runtests_args=runtests_args, inner_jobs=inner_jobs)
job = _workspace_jobspec(name=name, runtests_args=runtests_args,
runtests_envs=extra_envs, inner_jobs=inner_jobs)
job.labels = [platform, config, language] + labels
result.append(job)
@ -212,6 +220,20 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS)
extra_args=extra_args,
inner_jobs=inner_jobs)
# C and C++ with the native DNS resolver on Linux
test_jobs += _generate_jobs(languages=['c', 'c++'],
configs=['dbg'], platforms=['linux'],
labels=['portability'],
extra_args=extra_args,
extra_envs={'GRPC_DNS_RESOLVER': 'native'})
# C with the native DNS resolver on Windonws
test_jobs += _generate_jobs(languages=['c'],
configs=['dbg'], platforms=['windows'],
labels=['portability'],
extra_args=extra_args,
extra_envs={'GRPC_DNS_RESOLVER': 'native'})
test_jobs += _generate_jobs(languages=['python'],
configs=['dbg'],
platforms=['linux'],

Loading…
Cancel
Save