Merge github.com:grpc/grpc into big_data

pull/4384/head
Craig Tiller 9 years ago
commit 0c829f59cd
  1. 1009
      Makefile
  2. 10
      build.yaml
  3. 7
      include/grpc++/impl/rpc_service_method.h
  4. 13
      src/core/iomgr/tcp_windows.c
  5. 9
      src/core/security/credentials.h
  6. 2
      src/core/security/credentials_posix.c
  7. 2
      src/core/security/credentials_win32.c
  8. 15
      src/core/security/google_default_credentials.c
  9. 4
      src/core/security/json_token.c
  10. 29
      src/core/support/string.c
  11. 10
      src/core/support/string.h
  12. 7
      src/core/transport/chttp2/timeout_encoding.c
  13. 3
      src/core/transport/connectivity_state.c
  14. 2
      src/core/transport/connectivity_state.h
  15. 10
      src/cpp/proto/proto_utils.cc
  16. 12
      templates/Makefile.template
  17. 59
      test/core/security/credentials_test.c
  18. 50
      test/core/support/string_test.c
  19. 57
      test/core/transport/connectivity_state_test.c
  20. 3
      tools/run_tests/jobset.py
  21. 75
      tools/run_tests/run_tests.py
  22. 14
      tools/run_tests/sources_and_headers.json
  23. 18
      tools/run_tests/tests.json
  24. 10
      vsprojects/build_vs2010.bat
  25. 0
      vsprojects/build_vs2013.bat
  26. 10
      vsprojects/build_vs2015.bat
  27. 27
      vsprojects/buildtests_c.sln
  28. 184
      vsprojects/vcxproj/test/transport_connectivity_state_test/transport_connectivity_state_test.vcxproj
  29. 21
      vsprojects/vcxproj/test/transport_connectivity_state_test/transport_connectivity_state_test.vcxproj.filters

1009
Makefile

File diff suppressed because one or more lines are too long

@ -1611,6 +1611,16 @@ targets:
- grpc
- gpr_test_util
- gpr
- name: transport_connectivity_state_test
build: test
language: c
src:
- test/core/transport/connectivity_state_test.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
- name: transport_metadata_test
build: test
language: c

@ -34,6 +34,7 @@
#ifndef GRPCXX_IMPL_RPC_SERVICE_METHOD_H
#define GRPCXX_IMPL_RPC_SERVICE_METHOD_H
#include <climits>
#include <functional>
#include <map>
#include <memory>
@ -251,7 +252,11 @@ class RpcService {
void AddMethod(RpcServiceMethod* method) { methods_.emplace_back(method); }
RpcServiceMethod* GetMethod(int i) { return methods_[i].get(); }
int GetMethodCount() const { return methods_.size(); }
int GetMethodCount() const {
// On win x64, int is only 32bit
GPR_ASSERT(methods_.size() <= INT_MAX);
return (int)methods_.size();
}
private:
std::vector<std::unique_ptr<RpcServiceMethod>> methods_;

@ -197,7 +197,7 @@ static void win_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
tcp->read_slice = gpr_slice_malloc(8192);
buffer.len = GPR_SLICE_LENGTH(tcp->read_slice);
buffer.len = (ULONG)GPR_SLICE_LENGTH(tcp->read_slice); // we know slice size fits in 32bit.
buffer.buf = (char *)GPR_SLICE_START_PTR(tcp->read_slice);
TCP_REF(tcp, "read");
@ -273,6 +273,7 @@ static void win_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
WSABUF local_buffers[16];
WSABUF *allocated = NULL;
WSABUF *buffers = local_buffers;
size_t len;
if (tcp->shutting_down) {
grpc_exec_ctx_enqueue(exec_ctx, cb, 0);
@ -281,19 +282,21 @@ static void win_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
tcp->write_cb = cb;
tcp->write_slices = slices;
GPR_ASSERT(tcp->write_slices->count <= UINT_MAX);
if (tcp->write_slices->count > GPR_ARRAY_SIZE(local_buffers)) {
buffers = (WSABUF *)gpr_malloc(sizeof(WSABUF) * tcp->write_slices->count);
allocated = buffers;
}
for (i = 0; i < tcp->write_slices->count; i++) {
buffers[i].len = GPR_SLICE_LENGTH(tcp->write_slices->slices[i]);
len = GPR_SLICE_LENGTH(tcp->write_slices->slices[i]);
GPR_ASSERT(len <= ULONG_MAX);
buffers[i].len = (ULONG) len;
buffers[i].buf = (char *)GPR_SLICE_START_PTR(tcp->write_slices->slices[i]);
}
/* First, let's try a synchronous, non-blocking write. */
status = WSASend(socket->socket, buffers, tcp->write_slices->count,
status = WSASend(socket->socket, buffers, (DWORD)tcp->write_slices->count,
&bytes_sent, 0, NULL, NULL);
info->wsa_error = status == 0 ? 0 : WSAGetLastError();
@ -322,7 +325,7 @@ static void win_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
/* If we got a WSAEWOULDBLOCK earlier, then we need to re-do the same
operation, this time asynchronously. */
memset(&socket->write_info.overlapped, 0, sizeof(OVERLAPPED));
status = WSASend(socket->socket, buffers, tcp->write_slices->count,
status = WSASend(socket->socket, buffers, (DWORD)tcp->write_slices->count,
&bytes_sent, 0, &socket->write_info.overlapped, NULL);
if (allocated) gpr_free(allocated);

@ -93,6 +93,14 @@ typedef enum {
/* It is the caller's responsibility to gpr_free the result if not NULL. */
char *grpc_get_well_known_google_credentials_file_path(void);
/* Implementation function for the different platforms. */
char *grpc_get_well_known_google_credentials_file_path_impl(void);
/* Override for testing only. Not thread-safe */
typedef char *(*grpc_well_known_credentials_path_getter)(void);
void grpc_override_well_known_credentials_path_getter(
grpc_well_known_credentials_path_getter getter);
/* --- grpc_channel_credentials. --- */
typedef struct {
@ -201,6 +209,7 @@ grpc_credentials_status
grpc_oauth2_token_fetcher_credentials_parse_server_response(
const struct grpc_httpcli_response *response,
grpc_credentials_md_store **token_md, gpr_timespec *token_lifetime);
void grpc_flush_cached_google_default_credentials(void);
/* Metadata-only credentials with the specified key and value where

@ -44,7 +44,7 @@
#include "src/core/support/env.h"
#include "src/core/support/string.h"
char *grpc_get_well_known_google_credentials_file_path(void) {
char *grpc_get_well_known_google_credentials_file_path_impl(void) {
char *result = NULL;
char *home = gpr_getenv("HOME");
if (home == NULL) {

@ -44,7 +44,7 @@
#include "src/core/support/env.h"
#include "src/core/support/string.h"
char *grpc_get_well_known_google_credentials_file_path(void) {
char *grpc_get_well_known_google_credentials_file_path_impl(void) {
char *result = NULL;
char *appdata_path = gpr_getenv("APPDATA");
if (appdata_path == NULL) {

@ -241,5 +241,20 @@ void grpc_flush_cached_google_default_credentials(void) {
grpc_channel_credentials_unref(default_credentials);
default_credentials = NULL;
}
compute_engine_detection_done = 0;
gpr_mu_unlock(&g_mu);
}
/* -- Well known credentials path. -- */
static grpc_well_known_credentials_path_getter creds_path_getter = NULL;
char *grpc_get_well_known_google_credentials_file_path(void) {
if (creds_path_getter != NULL) return creds_path_getter();
return grpc_get_well_known_google_credentials_file_path_impl();
}
void grpc_override_well_known_credentials_path_getter(
grpc_well_known_credentials_path_getter getter) {
creds_path_getter = getter;
}

@ -215,8 +215,8 @@ static char *encoded_jwt_claim(const grpc_auth_json_key *json_key,
gpr_log(GPR_INFO, "Cropping token lifetime to maximum allowed value.");
expiration = gpr_time_add(now, grpc_max_auth_token_lifetime);
}
gpr_ltoa(now.tv_sec, now_str);
gpr_ltoa(expiration.tv_sec, expiration_str);
gpr_int64toa(now.tv_sec, now_str);
gpr_int64toa(expiration.tv_sec, expiration_str);
child =
create_child(NULL, json, "iss", json_key->client_email, GRPC_JSON_STRING);

@ -153,8 +153,8 @@ void gpr_reverse_bytes(char *str, int len) {
}
int gpr_ltoa(long value, char *string) {
long sign;
int i = 0;
int neg = value < 0;
if (value == 0) {
string[0] = '0';
@ -162,12 +162,33 @@ int gpr_ltoa(long value, char *string) {
return 1;
}
if (neg) value = -value;
sign = value < 0 ? -1 : 1;
while (value) {
string[i++] = (char)('0' + value % 10);
string[i++] = (char)('0' + sign * (value % 10));
value /= 10;
}
if (neg) string[i++] = '-';
if (sign < 0) string[i++] = '-';
gpr_reverse_bytes(string, i);
string[i] = 0;
return i;
}
int gpr_int64toa(gpr_int64 value, char *string) {
gpr_int64 sign;
int i = 0;
if (value == 0) {
string[0] = '0';
string[1] = 0;
return 1;
}
sign = value < 0 ? -1 : 1;
while (value) {
string[i++] = (char)('0' + sign * (value % 10));
value /= 10;
}
if (sign < 0) string[i++] = '-';
gpr_reverse_bytes(string, i);
string[i] = 0;
return i;

@ -70,6 +70,16 @@ int gpr_parse_bytes_to_uint32(const char *data, size_t length,
output must be at least GPR_LTOA_MIN_BUFSIZE bytes long. */
int gpr_ltoa(long value, char *output);
/* Minimum buffer size for calling int64toa */
#define GPR_INT64TOA_MIN_BUFSIZE (3 * sizeof(gpr_int64))
/* Convert an int64 to a string in base 10; returns the length of the
output string (or 0 on failure).
output must be at least GPR_INT64TOA_MIN_BUFSIZE bytes long.
NOTE: This function ensures sufficient bit width even on Win x64,
where long is 32bit is size.*/
int gpr_int64toa(gpr_int64 value, char *output);
/* Reverse a run of bytes */
void gpr_reverse_bytes(char *str, int len);

@ -36,6 +36,7 @@
#include <stdio.h>
#include <string.h>
#include <grpc/support/port_platform.h>
#include "src/core/support/string.h"
static int round_up(int x, int divisor) {
@ -57,13 +58,13 @@ static int round_up_to_three_sig_figs(int x) {
/* encode our minimum viable timeout value */
static void enc_tiny(char *buffer) { memcpy(buffer, "1n", 3); }
static void enc_ext(char *buffer, long value, char ext) {
int n = gpr_ltoa(value, buffer);
static void enc_ext(char *buffer, gpr_int64 value, char ext) {
int n = gpr_int64toa(value, buffer);
buffer[n] = ext;
buffer[n + 1] = 0;
}
static void enc_seconds(char *buffer, long sec) {
static void enc_seconds(char *buffer, gpr_int64 sec) {
if (sec % 3600 == 0) {
enc_ext(buffer, sec / 3600, 'H');
} else if (sec % 60 == 0) {

@ -54,8 +54,7 @@ const char *grpc_connectivity_state_name(grpc_connectivity_state state) {
case GRPC_CHANNEL_FATAL_FAILURE:
return "FATAL_FAILURE";
}
abort();
return "UNKNOWN";
GPR_UNREACHABLE_CODE(return "UNKNOWN");
}
void grpc_connectivity_state_init(grpc_connectivity_state_tracker *tracker,

@ -57,6 +57,8 @@ typedef struct {
extern int grpc_connectivity_state_trace;
const char *grpc_connectivity_state_name(grpc_connectivity_state state);
void grpc_connectivity_state_init(grpc_connectivity_state_tracker *tracker,
grpc_connectivity_state init_state,
const char *name);

@ -33,6 +33,8 @@
#include <grpc++/impl/proto_utils.h>
#include <climits>
#include <grpc/grpc.h>
#include <grpc/byte_buffer.h>
#include <grpc/byte_buffer_reader.h>
@ -70,7 +72,9 @@ class GrpcBufferWriter GRPC_FINAL
slice_ = gpr_slice_malloc(block_size_);
}
*data = GPR_SLICE_START_PTR(slice_);
byte_count_ += * size = GPR_SLICE_LENGTH(slice_);
// On win x64, int is only 32bit
GPR_ASSERT(GPR_SLICE_LENGTH(slice_) <= INT_MAX);
byte_count_ += * size = (int)GPR_SLICE_LENGTH(slice_);
gpr_slice_buffer_add(slice_buffer_, slice_);
return true;
}
@ -124,7 +128,9 @@ class GrpcBufferReader GRPC_FINAL
}
gpr_slice_unref(slice_);
*data = GPR_SLICE_START_PTR(slice_);
byte_count_ += * size = GPR_SLICE_LENGTH(slice_);
// On win x64, int is only 32bit
GPR_ASSERT(GPR_SLICE_LENGTH(slice_) <= INT_MAX);
byte_count_ += * size = (int)GPR_SLICE_LENGTH(slice_);
return true;
}

@ -1003,27 +1003,27 @@
buildtests: buildtests_c buildtests_cxx buildtests_zookeeper
buildtests_c: privatelibs_c\
buildtests_c: privatelibs_c <%text>\</%text>
% for tgt in targets:
% if tgt.build == 'test' and not tgt.language == 'c++' and not tgt.get('external_deps', None):
$(BINDIR)/$(CONFIG)/${tgt.name}\
$(BINDIR)/$(CONFIG)/${tgt.name} <%text>\</%text>
% endif
% endfor
buildtests_cxx: buildtests_zookeeper privatelibs_cxx\
buildtests_cxx: buildtests_zookeeper privatelibs_cxx <%text>\</%text>
% for tgt in targets:
% if tgt.build == 'test' and tgt.language == 'c++' and not tgt.get('external_deps', None):
$(BINDIR)/$(CONFIG)/${tgt.name}\
$(BINDIR)/$(CONFIG)/${tgt.name} <%text>\</%text>
% endif
% endfor
ifeq ($(HAS_ZOOKEEPER),true)
buildtests_zookeeper: privatelibs_zookeeper\
buildtests_zookeeper: privatelibs_zookeeper <%text>\</%text>
% for tgt in targets:
% if tgt.build == 'test' and tgt.language == 'c++' and 'zookeeper' in tgt.get('external_deps', []):
$(BINDIR)/$(CONFIG)/${tgt.name}\
$(BINDIR)/$(CONFIG)/${tgt.name} <%text>\</%text>
% endif
% endfor

@ -878,7 +878,7 @@ static void test_google_default_creds_auth_key(void) {
gpr_setenv(GRPC_GOOGLE_CREDENTIALS_ENV_VAR, ""); /* Reset. */
}
static void test_google_default_creds_access_token(void) {
static void test_google_default_creds_refresh_token(void) {
grpc_google_refresh_token_credentials *refresh;
grpc_composite_channel_credentials *creds;
grpc_flush_cached_google_default_credentials();
@ -894,6 +894,60 @@ static void test_google_default_creds_access_token(void) {
gpr_setenv(GRPC_GOOGLE_CREDENTIALS_ENV_VAR, ""); /* Reset. */
}
static int default_creds_gce_detection_httpcli_get_success_override(
grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
gpr_timespec deadline, grpc_httpcli_response_cb on_response,
void *user_data) {
grpc_httpcli_response response = http_response(200, "");
grpc_httpcli_header header;
header.key = "Metadata-Flavor";
header.value = "Google";
response.hdr_count = 1;
response.hdrs = &header;
GPR_ASSERT(strcmp(request->path, "/") == 0);
GPR_ASSERT(strcmp(request->host, "metadata.google.internal") == 0);
on_response(exec_ctx, user_data, &response);
return 1;
}
static char *null_well_known_creds_path_getter(void) {
return NULL;
}
static void test_google_default_creds_gce(void) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_composite_channel_credentials *creds;
grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL,
NULL};
grpc_flush_cached_google_default_credentials();
gpr_setenv(GRPC_GOOGLE_CREDENTIALS_ENV_VAR, ""); /* Reset. */
grpc_override_well_known_credentials_path_getter(
null_well_known_creds_path_getter);
/* Simulate a successful detection of GCE. */
grpc_httpcli_set_override(
default_creds_gce_detection_httpcli_get_success_override,
httpcli_post_should_not_be_called);
creds = (grpc_composite_channel_credentials *)
grpc_google_default_credentials_create();
/* Verify that the default creds actually embeds a GCE creds. */
GPR_ASSERT(creds != NULL);
GPR_ASSERT(creds->call_creds != NULL);
grpc_httpcli_set_override(compute_engine_httpcli_get_success_override,
httpcli_post_should_not_be_called);
grpc_call_credentials_get_request_metadata(
&exec_ctx, creds->call_creds, NULL, auth_md_ctx,
on_oauth2_creds_get_metadata_success, (void *)test_user_data);
grpc_exec_ctx_flush(&exec_ctx);
grpc_exec_ctx_finish(&exec_ctx);
/* Cleanup. */
grpc_channel_credentials_release(&creds->base);
grpc_httpcli_set_override(NULL, NULL);
grpc_override_well_known_credentials_path_getter(NULL);
}
typedef enum {
PLUGIN_INITIAL_STATE,
PLUGIN_GET_METADATA_CALLED_STATE,
@ -1067,7 +1121,8 @@ int main(int argc, char **argv) {
test_jwt_creds_success();
test_jwt_creds_signing_failure();
test_google_default_creds_auth_key();
test_google_default_creds_access_token();
test_google_default_creds_refresh_token();
test_google_default_creds_gce();
test_metadata_plugin_success();
test_metadata_plugin_failure();
test_get_well_known_google_credentials_file_path();

@ -33,6 +33,7 @@
#include "src/core/support/string.h"
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
@ -286,6 +287,53 @@ static void test_strsplit(void) {
gpr_free(parts);
}
static void test_ltoa() {
char *str;
char buf[GPR_LTOA_MIN_BUFSIZE];
LOG_TEST_NAME("test_ltoa");
/* zero */
GPR_ASSERT(1 == gpr_ltoa(0, buf));
GPR_ASSERT(0 == strcmp("0", buf));
/* positive number */
GPR_ASSERT(3 == gpr_ltoa(123, buf));
GPR_ASSERT(0 == strcmp("123", buf));
/* negative number */
GPR_ASSERT(6 == gpr_ltoa(-12345, buf));
GPR_ASSERT(0 == strcmp("-12345", buf));
/* large negative - we don't know the size of long in advance */
GPR_ASSERT(gpr_asprintf(&str, "%lld", (long long)LONG_MIN));
GPR_ASSERT(strlen(str) == (size_t)gpr_ltoa(LONG_MIN, buf));
GPR_ASSERT(0 == strcmp(str, buf));
gpr_free(str);
}
static void test_int64toa() {
char buf[GPR_INT64TOA_MIN_BUFSIZE];
LOG_TEST_NAME("test_int64toa");
/* zero */
GPR_ASSERT(1 == gpr_int64toa(0, buf));
GPR_ASSERT(0 == strcmp("0", buf));
/* positive */
GPR_ASSERT(3 == gpr_int64toa(123, buf));
GPR_ASSERT(0 == strcmp("123", buf));
/* large positive */
GPR_ASSERT(19 == gpr_int64toa(9223372036854775807LL, buf));
GPR_ASSERT(0 == strcmp("9223372036854775807", buf));
/* large negative */
GPR_ASSERT(20 == gpr_int64toa(-9223372036854775807LL - 1, buf));
GPR_ASSERT(0 == strcmp("-9223372036854775808", buf));
}
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
test_strdup();
@ -296,5 +344,7 @@ int main(int argc, char **argv) {
test_strjoin();
test_strjoin_sep();
test_strsplit();
test_ltoa();
test_int64toa();
return 0;
}

@ -0,0 +1,57 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "src/core/transport/connectivity_state.h"
#include <string.h>
#include <grpc/support/log.h>
#include "test/core/util/test_config.h"
#define LOG_TEST(x) gpr_log(GPR_INFO, "%s", x)
static void test_connectivity_state_name(void) {
GPR_ASSERT(0 == strcmp(grpc_connectivity_state_name(GRPC_CHANNEL_IDLE), "IDLE"));
GPR_ASSERT(0 == strcmp(grpc_connectivity_state_name(GRPC_CHANNEL_CONNECTING), "CONNECTING"));
GPR_ASSERT(0 == strcmp(grpc_connectivity_state_name(GRPC_CHANNEL_READY), "READY"));
GPR_ASSERT(0 == strcmp(grpc_connectivity_state_name(GRPC_CHANNEL_TRANSIENT_FAILURE), "TRANSIENT_FAILURE"));
GPR_ASSERT(0 == strcmp(grpc_connectivity_state_name(GRPC_CHANNEL_FATAL_FAILURE), "FATAL_FAILURE"));
}
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_connectivity_state_trace = 1;
test_connectivity_state_name();
return 0;
}

@ -178,6 +178,9 @@ class JobSpec(object):
def __cmp__(self, other):
return self.identity() == other.identity()
def __repr__(self):
return 'JobSpec(shortname=%s, cmdline=%s)' % (self.shortname, self.cmdline)
class JobResult(object):

@ -508,6 +508,43 @@ _WINDOWS_CONFIG = {
}
def _windows_arch_option(arch):
"""Returns msbuild cmdline option for selected architecture."""
if arch == 'default' or arch == 'windows_x86':
return '/p:Platform=Win32'
elif arch == 'windows_x64':
return '/p:Platform=x64'
else:
print 'Architecture %s not supported on current platform.' % arch
sys.exit(1)
def _windows_build_bat(compiler):
"""Returns name of build.bat for selected compiler."""
if compiler == 'default' or compiler == 'vs2013':
return 'vsprojects\\build_vs2013.bat'
elif compiler == 'vs2015':
return 'vsprojects\\build_vs2015.bat'
elif compiler == 'vs2010':
return 'vsprojects\\build_vs2010.bat'
else:
print 'Compiler %s not supported.' % compiler
sys.exit(1)
def _windows_toolset_option(compiler):
"""Returns msbuild PlatformToolset for selected compiler."""
if compiler == 'default' or compiler == 'vs2013':
return '/p:PlatformToolset=v120'
elif compiler == 'vs2015':
return '/p:PlatformToolset=v140'
elif compiler == 'vs2010':
return '/p:PlatformToolset=v100'
else:
print 'Compiler %s not supported.' % compiler
sys.exit(1)
def runs_per_test_type(arg_str):
"""Auxilary function to parse the "runs_per_test" flag.
@ -572,6 +609,19 @@ argp.add_argument('--allow_flakes',
action='store_const',
const=True,
help='Allow flaky tests to show as passing (re-runs failed tests up to five times)')
argp.add_argument('--arch',
choices=['default', 'windows_x86', 'windows_x64'],
default='default',
help='Selects architecture to target. For some platforms "default" is the only supported choice.')
argp.add_argument('--compiler',
choices=['default', 'vs2010', 'vs2013', 'vs2015'],
default='default',
help='Selects compiler to use. For some platforms "default" is the only supported choice.')
argp.add_argument('--build_only',
default=False,
action='store_const',
const=True,
help='Perform all the build steps but dont run any tests.')
argp.add_argument('-a', '--antagonists', default=0, type=int)
argp.add_argument('-x', '--xml_report', default=None, type=str,
help='Generates a JUnit-compatible XML report')
@ -633,6 +683,14 @@ if len(build_configs) > 1:
print language, 'does not support multiple build configurations'
sys.exit(1)
if platform_string() != 'windows':
if args.arch != 'default':
print 'Architecture %s not supported on current platform.' % args.arch
sys.exit(1)
if args.compiler != 'default':
print 'Compiler %s not supported on current platform.' % args.compiler
sys.exit(1)
if platform_string() == 'windows':
def make_jobspec(cfg, targets, makefile='Makefile'):
extra_args = []
@ -643,9 +701,11 @@ if platform_string() == 'windows':
# disable PDB generation: it's broken, and we don't need it during CI
extra_args.extend(['/p:Jenkins=true'])
return [
jobset.JobSpec(['vsprojects\\build.bat',
jobset.JobSpec([_windows_build_bat(args.compiler),
'vsprojects\\%s.sln' % target,
'/p:Configuration=%s' % _WINDOWS_CONFIG[cfg]] +
'/p:Configuration=%s' % _WINDOWS_CONFIG[cfg],
_windows_toolset_option(args.compiler),
_windows_arch_option(args.arch)] +
extra_args,
shell=True, timeout_seconds=90*60)
for target in targets]
@ -840,7 +900,7 @@ def _calculate_num_runs_failures(list_of_results):
def _build_and_run(
check_cancelled, newline_on_success, cache, xml_report=None):
check_cancelled, newline_on_success, cache, xml_report=None, build_only=False):
"""Do one pass of building & running tests."""
# build latest sequentially
num_failures, _ = jobset.run(
@ -848,6 +908,9 @@ def _build_and_run(
newline_on_success=newline_on_success, travis=args.travis)
if num_failures:
return 1
if build_only:
return 0
# start antagonists
antagonists = [subprocess.Popen(['tools/run_tests/antagonist.py'])
@ -925,7 +988,8 @@ if forever:
previous_success = success
success = _build_and_run(check_cancelled=have_files_changed,
newline_on_success=False,
cache=test_cache) == 0
cache=test_cache,
build_only=args.build_only) == 0
if not previous_success and success:
jobset.message('SUCCESS',
'All tests are now passing properly',
@ -937,7 +1001,8 @@ else:
result = _build_and_run(check_cancelled=lambda: False,
newline_on_success=args.newline_on_success,
cache=test_cache,
xml_report=args.xml_report)
xml_report=args.xml_report,
build_only=args.build_only)
if result == 0:
jobset.message('SUCCESS', 'All tests passed', do_newline=True)
else:

@ -1075,6 +1075,20 @@
"test/core/profiling/timers_test.c"
]
},
{
"deps": [
"gpr",
"gpr_test_util",
"grpc",
"grpc_test_util"
],
"headers": [],
"language": "c",
"name": "transport_connectivity_state_test",
"src": [
"test/core/transport/connectivity_state_test.c"
]
},
{
"deps": [
"gpr",

@ -1241,6 +1241,24 @@
"windows"
]
},
{
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"exclude_configs": [],
"flaky": false,
"language": "c",
"name": "transport_connectivity_state_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
]
},
{
"ci_platforms": [
"linux",

@ -0,0 +1,10 @@
@rem Convenience wrapper that runs specified gRPC target using msbuild
@rem Usage: build.bat TARGET_NAME
setlocal
@rem Set VS variables (uses Visual Studio 2010)
@call "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" x86
msbuild %*
exit /b %ERRORLEVEL%
endlocal

@ -0,0 +1,10 @@
@rem Convenience wrapper that runs specified gRPC target using msbuild
@rem Usage: build.bat TARGET_NAME
setlocal
@rem Set VS variables (uses Visual Studio 2015)
@call "%VS140COMNTOOLS%\..\..\vc\vcvarsall.bat" x86
msbuild %*
exit /b %ERRORLEVEL%
endlocal

@ -1847,6 +1847,17 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "timers_test", "vcxproj\test
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "transport_connectivity_state_test", "vcxproj\test\transport_connectivity_state_test\transport_connectivity_state_test.vcxproj", "{659121F6-1639-AC6B-053E-9D17A8B94D56}"
ProjectSection(myProperties) = preProject
lib = "False"
EndProjectSection
ProjectSection(ProjectDependencies) = postProject
{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}
{29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9}
{EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037}
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "transport_metadata_test", "vcxproj\test\transport_metadata_test\transport_metadata_test.vcxproj", "{89A119C5-0F62-33B8-5D08-1FAA29DA7DEB}"
ProjectSection(myProperties) = preProject
lib = "False"
@ -12846,6 +12857,22 @@ Global
{FFE98236-3F4D-2CBA-29FB-D0A7467D2FA5}.Release-DLL|Win32.Build.0 = Release|Win32
{FFE98236-3F4D-2CBA-29FB-D0A7467D2FA5}.Release-DLL|x64.ActiveCfg = Release|x64
{FFE98236-3F4D-2CBA-29FB-D0A7467D2FA5}.Release-DLL|x64.Build.0 = Release|x64
{659121F6-1639-AC6B-053E-9D17A8B94D56}.Debug|Win32.ActiveCfg = Debug|Win32
{659121F6-1639-AC6B-053E-9D17A8B94D56}.Debug|x64.ActiveCfg = Debug|x64
{659121F6-1639-AC6B-053E-9D17A8B94D56}.Release|Win32.ActiveCfg = Release|Win32
{659121F6-1639-AC6B-053E-9D17A8B94D56}.Release|x64.ActiveCfg = Release|x64
{659121F6-1639-AC6B-053E-9D17A8B94D56}.Debug|Win32.Build.0 = Debug|Win32
{659121F6-1639-AC6B-053E-9D17A8B94D56}.Debug|x64.Build.0 = Debug|x64
{659121F6-1639-AC6B-053E-9D17A8B94D56}.Release|Win32.Build.0 = Release|Win32
{659121F6-1639-AC6B-053E-9D17A8B94D56}.Release|x64.Build.0 = Release|x64
{659121F6-1639-AC6B-053E-9D17A8B94D56}.Debug-DLL|Win32.ActiveCfg = Debug|Win32
{659121F6-1639-AC6B-053E-9D17A8B94D56}.Debug-DLL|Win32.Build.0 = Debug|Win32
{659121F6-1639-AC6B-053E-9D17A8B94D56}.Debug-DLL|x64.ActiveCfg = Debug|x64
{659121F6-1639-AC6B-053E-9D17A8B94D56}.Debug-DLL|x64.Build.0 = Debug|x64
{659121F6-1639-AC6B-053E-9D17A8B94D56}.Release-DLL|Win32.ActiveCfg = Release|Win32
{659121F6-1639-AC6B-053E-9D17A8B94D56}.Release-DLL|Win32.Build.0 = Release|Win32
{659121F6-1639-AC6B-053E-9D17A8B94D56}.Release-DLL|x64.ActiveCfg = Release|x64
{659121F6-1639-AC6B-053E-9D17A8B94D56}.Release-DLL|x64.Build.0 = Release|x64
{89A119C5-0F62-33B8-5D08-1FAA29DA7DEB}.Debug|Win32.ActiveCfg = Debug|Win32
{89A119C5-0F62-33B8-5D08-1FAA29DA7DEB}.Debug|x64.ActiveCfg = Debug|x64
{89A119C5-0F62-33B8-5D08-1FAA29DA7DEB}.Release|Win32.ActiveCfg = Release|Win32

@ -0,0 +1,184 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props" Condition="Exists('..\..\..\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\1.0.204.1.props')" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{659121F6-1639-AC6B-053E-9D17A8B94D56}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(VisualStudioVersion)' == '10.0'" Label="Configuration">
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(VisualStudioVersion)' == '11.0'" Label="Configuration">
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(VisualStudioVersion)' == '12.0'" Label="Configuration">
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\vsprojects\global.props" />
<Import Project="..\..\..\..\vsprojects\openssl.props" />
<Import Project="..\..\..\..\vsprojects\winsock.props" />
<Import Project="..\..\..\..\vsprojects\zlib.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<TargetName>transport_connectivity_state_test</TargetName>
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<TargetName>transport_connectivity_state_test</TargetName>
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<TreatWarningAsError>true</TreatWarningAsError>
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation>
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<TreatWarningAsError>true</TreatWarningAsError>
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation>
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<TreatWarningAsError>true</TreatWarningAsError>
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation>
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<TreatWarningAsError>true</TreatWarningAsError>
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation>
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\test\core\transport\connectivity_state_test.c">
</ClCompile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\vsprojects\vcxproj\.\grpc_test_util\grpc_test_util.vcxproj">
<Project>{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\..\vsprojects\vcxproj\.\grpc\grpc.vcxproj">
<Project>{29D16885-7228-4C31-81ED-5F9187C7F2A9}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\..\vsprojects\vcxproj\.\gpr_test_util\gpr_test_util.vcxproj">
<Project>{EAB0A629-17A9-44DB-B5FF-E91A721FE037}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\..\vsprojects\vcxproj\.\gpr\gpr.vcxproj">
<Project>{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets" Condition="Exists('..\..\..\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" />
<Import Project="..\..\..\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets" Condition="Exists('..\..\..\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" />
<Import Project="..\..\..\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets" Condition="Exists('..\..\..\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" />
<Import Project="..\..\..\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets" Condition="Exists('..\..\..\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" />
<Error Condition="!Exists('..\..\..\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" />
<Error Condition="!Exists('..\..\..\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" />
<Error Condition="!Exists('..\..\..\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" />
<Error Condition="!Exists('..\..\..\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" />
</Target>
</Project>

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="..\..\..\..\test\core\transport\connectivity_state_test.c">
<Filter>test\core\transport</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="test">
<UniqueIdentifier>{714707eb-8e3c-a990-6aaf-a23ea345f0cc}</UniqueIdentifier>
</Filter>
<Filter Include="test\core">
<UniqueIdentifier>{b79db837-dc1a-74b2-dc04-664d00ca3ec7}</UniqueIdentifier>
</Filter>
<Filter Include="test\core\transport">
<UniqueIdentifier>{21b47183-e00e-b938-5cae-9f2d972d032b}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
Loading…
Cancel
Save