Progress on poll() based poller

pull/5647/head
Craig Tiller 9 years ago
parent ac04b7f537
commit b38197e0cc
  1. 4
      src/core/iomgr/ev_poll_and_epoll_posix.c
  2. 5
      src/core/iomgr/ev_poll_posix.c
  3. 4
      src/core/iomgr/iomgr_posix.c
  4. 24
      test/core/end2end/gen_build_yaml.py
  5. 3
      test/core/util/port_posix.c
  6. 104
      tools/run_tests/run_tests.py
  7. 36637
      tools/run_tests/tests.json

@ -788,7 +788,6 @@ static void pollset_kick(grpc_pollset *p,
static void pollset_global_init(void) {
gpr_tls_init(&g_current_thread_poller);
gpr_tls_init(&g_current_thread_worker);
grpc_wakeup_fd_global_init();
grpc_wakeup_fd_init(&grpc_global_wakeup_fd);
}
@ -796,7 +795,6 @@ static void pollset_global_shutdown(void) {
grpc_wakeup_fd_destroy(&grpc_global_wakeup_fd);
gpr_tls_destroy(&g_current_thread_poller);
gpr_tls_destroy(&g_current_thread_worker);
grpc_wakeup_fd_global_destroy();
}
static void kick_poller(void) { grpc_wakeup_fd_wakeup(&grpc_global_wakeup_fd); }
@ -1881,8 +1879,8 @@ static void pollset_set_del_fd(grpc_exec_ctx *exec_ctx,
*/
static void shutdown_engine(void) {
fd_global_shutdown();
pollset_global_shutdown();
fd_global_shutdown();
}
static const grpc_event_engine_vtable vtable = {

@ -290,6 +290,7 @@ static void unref_by(grpc_fd *fd, int n) {
old = gpr_atm_full_fetch_add(&fd->refst, -n);
if (old == n) {
gpr_mu_destroy(&fd->mu);
grpc_iomgr_unregister_object(&fd->iomgr_object);
gpr_free(fd);
} else {
GPR_ASSERT(old > n);
@ -692,7 +693,6 @@ static void pollset_kick(grpc_pollset *p,
static void pollset_global_init(void) {
gpr_tls_init(&g_current_thread_poller);
gpr_tls_init(&g_current_thread_worker);
grpc_wakeup_fd_global_init();
grpc_wakeup_fd_init(&grpc_global_wakeup_fd);
}
@ -700,7 +700,6 @@ static void pollset_global_shutdown(void) {
grpc_wakeup_fd_destroy(&grpc_global_wakeup_fd);
gpr_tls_destroy(&g_current_thread_poller);
gpr_tls_destroy(&g_current_thread_worker);
grpc_wakeup_fd_global_destroy();
}
static void kick_poller(void) { grpc_wakeup_fd_wakeup(&grpc_global_wakeup_fd); }
@ -719,7 +718,9 @@ static void pollset_init(grpc_pollset *pollset, gpr_mu **mu) {
pollset->local_wakeup_cache = NULL;
pollset->kicked_without_pollers = 0;
pollset->fd_count = 0;
pollset->fd_capacity = 0;
pollset->del_count = 0;
pollset->del_capacity = 0;
pollset->fds = NULL;
pollset->dels = NULL;
}

@ -39,14 +39,16 @@
#include "src/core/iomgr/ev_posix.h"
#include "src/core/iomgr/iomgr_posix.h"
#include "src/core/iomgr/tcp_posix.h"
#include "src/core/iomgr/wakeup_fd_posix.h"
void grpc_iomgr_platform_init(void) {
grpc_wakeup_fd_global_init();
grpc_event_engine_init();
grpc_register_tracer("tcp", &grpc_tcp_trace);
}
void grpc_iomgr_platform_flush(void) {}
void grpc_iomgr_platform_shutdown(void) { grpc_event_engine_shutdown(); }
void grpc_iomgr_platform_shutdown(void) { grpc_event_engine_shutdown(); grpc_wakeup_fd_global_destroy(); }
#endif /* GRPC_POSIX_SOCKET */

@ -47,15 +47,6 @@ default_secure_fixture_options = default_unsecure_fixture_options._replace(secur
uds_fixture_options = default_unsecure_fixture_options._replace(dns_resolver=False, platforms=['linux', 'mac', 'posix'])
# map a platform to available polling strategies
POLLING_STRATEGY = {
'windows': ['all'],
'linux': ['poll', 'legacy'],
'mac': ['poll'],
'posix': ['poll'],
}
# maps fixture name to whether it requires the security library
END2END_FIXTURES = {
'h2_compress': default_unsecure_fixture_options,
@ -250,22 +241,17 @@ def main():
{
'name': '%s_test' % f,
'args': [t],
'env': {
'GRPC_POLL_STRATEGY': poll_strategy
},
'exclude_configs': [],
'platforms': [platform],
'ci_platforms': [platform],
'platforms': END2END_FIXTURES[f].platforms,
'ci_platforms': (END2END_FIXTURES[f].platforms
if END2END_FIXTURES[f].ci_mac else without(
END2END_FIXTURES[f].platforms, 'mac')),
'flaky': False,
'language': 'c',
'cpu_cost': END2END_TESTS[t].cpu_cost,
}
for f in sorted(END2END_FIXTURES.keys())
for t in sorted(END2END_TESTS.keys())
for platform in sorted(END2END_FIXTURES[f].platforms)
for poll_strategy in POLLING_STRATEGY[platform]
if compatible(f, t)
and (END2END_FIXTURES[f].ci_mac or platform != 'mac')
for t in sorted(END2END_TESTS.keys()) if compatible(f, t)
] + [
{
'name': '%s_nosec_test' % f,

@ -77,7 +77,6 @@ typedef struct freereq {
static void destroy_pollset_and_shutdown(grpc_exec_ctx *exec_ctx, void *p,
bool success) {
grpc_pollset_destroy(p);
grpc_shutdown();
}
static void freed_port_from_server(grpc_exec_ctx *exec_ctx, void *arg,
@ -130,6 +129,8 @@ static void free_port_using_server(char *server, int port) {
grpc_exec_ctx_finish(&exec_ctx);
gpr_free(pr.pollset);
gpr_free(path);
grpc_shutdown();
}
static void free_chosen_ports() {

@ -149,58 +149,60 @@ class CLanguage(object):
def test_specs(self):
out = []
binaries = get_c_tests(self.args.travis, self.test_lang)
for target in binaries:
if self.config.build_config in target['exclude_configs']:
continue
if self.platform == 'windows':
binary = 'vsprojects/%s%s/%s.exe' % (
'x64/' if self.args.arch == 'x64' else '',
_MSBUILD_CONFIG[self.config.build_config],
target['name'])
else:
binary = 'bins/%s/%s' % (self.config.build_config, target['name'])
env = {}
shortname_ext = ''
if 'env' in target:
tenv = target['env']
env.update(tenv)
shortname_ext += ' '
shortname_ext += ' '.join('%s=%s' % (key, tenv[key]) for key in sorted(tenv.keys()))
env['GRPC_DEFAULT_SSL_ROOTS_FILE_PATH'] = (
_ROOT + '/src/core/tsi/test_creds/ca.pem')
if os.path.isfile(binary):
if 'gtest' in target and target['gtest']:
# here we parse the output of --gtest_list_tests to build up a
# complete list of the tests contained in a binary
# for each test, we then add a job to run, filtering for just that
# test
with open(os.devnull, 'w') as fnull:
tests = subprocess.check_output([binary, '--gtest_list_tests'],
stderr=fnull)
base = None
for line in tests.split('\n'):
i = line.find('#')
if i >= 0: line = line[:i]
if not line: continue
if line[0] != ' ':
base = line.strip()
else:
assert base is not None
assert line[1] == ' '
test = base + line.strip()
cmdline = [binary] + ['--gtest_filter=%s' % test]
out.append(self.config.job_spec(cmdline, [binary],
shortname='%s:%s %s' % (binary, test, shortname_ext),
cpu_cost=target['cpu_cost'],
environ=env))
POLLING_STRATEGIES = {
'windows': ['all'],
'mac': ['all'],
'posix': ['all'],
'linux': ['poll', 'legacy']
}
for polling_strategy in POLLING_STRATEGIES[self.platform]:
env={'GRPC_DEFAULT_SSL_ROOTS_FILE_PATH':
_ROOT + '/src/core/tsi/test_creds/ca.pem',
'GRPC_POLLING_STRATEGY': polling_strategy}
shortname_ext = '' if polling_strategy=='all' else ' polling=%s' % polling_strategy
for target in binaries:
if self.config.build_config in target['exclude_configs']:
continue
if self.platform == 'windows':
binary = 'vsprojects/%s%s/%s.exe' % (
'x64/' if self.args.arch == 'x64' else '',
_MSBUILD_CONFIG[self.config.build_config],
target['name'])
else:
cmdline = [binary] + target['args']
out.append(self.config.job_spec(cmdline, [binary],
shortname=' '.join(cmdline) + shortname_ext,
cpu_cost=target['cpu_cost'],
environ=env))
elif self.args.regex == '.*' or self.platform == 'windows':
print '\nWARNING: binary not found, skipping', binary
binary = 'bins/%s/%s' % (self.config.build_config, target['name'])
if os.path.isfile(binary):
if 'gtest' in target and target['gtest']:
# here we parse the output of --gtest_list_tests to build up a
# complete list of the tests contained in a binary
# for each test, we then add a job to run, filtering for just that
# test
with open(os.devnull, 'w') as fnull:
tests = subprocess.check_output([binary, '--gtest_list_tests'],
stderr=fnull)
base = None
for line in tests.split('\n'):
i = line.find('#')
if i >= 0: line = line[:i]
if not line: continue
if line[0] != ' ':
base = line.strip()
else:
assert base is not None
assert line[1] == ' '
test = base + line.strip()
cmdline = [binary] + ['--gtest_filter=%s' % test]
out.append(self.config.job_spec(cmdline, [binary],
shortname='%s:%s' % (binary, test, shortname_ext),
cpu_cost=target['cpu_cost'],
environ=env))
else:
cmdline = [binary] + target['args']
out.append(self.config.job_spec(cmdline, [binary],
shortname=' '.join(cmdline) + shortname_ext,
cpu_cost=target['cpu_cost'],
environ=env))
elif self.args.regex == '.*' or self.platform == 'windows':
print '\nWARNING: binary not found, skipping', binary
return sorted(out)
def make_targets(self):

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save