Merge branch 'master' of github.com:grpc/grpc into compression_coverage_2

pull/4381/head
David Garcia Quintas 9 years ago
commit 48aa90a898
  1. 6
      BUILD
  2. 1076
      Makefile
  3. 1
      binding.gyp
  4. 34
      build.yaml
  5. 3
      gRPC.podspec
  6. 7
      include/grpc++/impl/rpc_service_method.h
  7. 8
      include/grpc/support/cmdline.h
  8. 1
      src/core/census/grpc_filter.c
  9. 118
      src/core/channel/noop_filter.c
  10. 9
      src/core/httpcli/httpcli.c
  11. 2
      src/core/httpcli/httpcli.h
  12. 10
      src/core/iomgr/tcp_server_posix.c
  13. 13
      src/core/iomgr/tcp_windows.c
  14. 9
      src/core/security/credentials.h
  15. 2
      src/core/security/credentials_posix.c
  16. 2
      src/core/security/credentials_win32.c
  17. 15
      src/core/security/google_default_credentials.c
  18. 4
      src/core/security/json_token.c
  19. 62
      src/core/support/cmdline.c
  20. 29
      src/core/support/string.c
  21. 10
      src/core/support/string.h
  22. 1
      src/core/surface/init.c
  23. 4
      src/core/surface/server_chttp2.c
  24. 4
      src/core/transport/chttp2/frame_settings.c
  25. 7
      src/core/transport/chttp2/timeout_encoding.c
  26. 3
      src/core/transport/connectivity_state.c
  27. 2
      src/core/transport/connectivity_state.h
  28. 2
      src/core/transport/metadata.c
  29. 10
      src/cpp/proto/proto_utils.cc
  30. 11
      src/csharp/Grpc.Core.Tests/ChannelTest.cs
  31. 14
      src/csharp/Grpc.Core.Tests/ClientServerTest.cs
  32. 1
      src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj
  33. 7
      src/csharp/Grpc.Core.Tests/MockServiceHelper.cs
  34. 101
      src/csharp/Grpc.Core.Tests/UserAgentStringTest.cs
  35. 42
      src/csharp/Grpc.Core/Channel.cs
  36. 7
      src/csharp/Grpc.Core/ChannelOptions.cs
  37. 2
      src/csharp/Grpc.Core/Internal/ServerCallHandler.cs
  38. 119
      src/csharp/Grpc.IntegrationTesting/InteropClient.cs
  39. 20
      src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
  40. 39
      src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs
  41. 6
      src/node/ext/channel_credentials.cc
  42. 24
      src/node/ext/server_credentials.cc
  43. 147
      src/node/test/credentials_test.js
  44. 25
      src/node/test/server_test.js
  45. 12
      templates/Makefile.template
  46. 23
      test/core/bad_client/tests/initial_settings_frame.c
  47. 6
      test/core/client_config/lb_policies_test.c
  48. 16
      test/core/httpcli/httpcli_test.c
  49. 188
      test/core/httpcli/httpscli_test.c
  50. 14
      test/core/httpcli/test_server.py
  51. 61
      test/core/security/credentials_test.c
  52. 187
      test/core/support/cmdline_test.c
  53. 50
      test/core/support/string_test.c
  54. 33
      test/core/surface/lame_client_test.c
  55. 23
      test/core/surface/server_chttp2_test.c
  56. 57
      test/core/transport/connectivity_state_test.c
  57. 20
      test/core/transport/metadata_test.c
  58. 1
      tools/codegen/core/gen_legal_metadata_characters.c
  59. 2
      tools/doxygen/Doxyfile.core.internal
  60. 24
      tools/run_tests/interop_html_report.template
  61. 3
      tools/run_tests/jobset.py
  62. 11
      tools/run_tests/report_utils.py
  63. 120
      tools/run_tests/run_interop_tests.py
  64. 81
      tools/run_tests/run_tests.py
  65. 48
      tools/run_tests/sources_and_headers.json
  66. 48
      tools/run_tests/tests.json
  67. 10
      vsprojects/build_vs2010.bat
  68. 0
      vsprojects/build_vs2013.bat
  69. 10
      vsprojects/build_vs2015.bat
  70. 54
      vsprojects/buildtests_c.sln
  71. 3
      vsprojects/vcxproj/grpc/grpc.vcxproj
  72. 6
      vsprojects/vcxproj/grpc/grpc.vcxproj.filters
  73. 3
      vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
  74. 6
      vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters
  75. 184
      vsprojects/vcxproj/test/server_chttp2_test/server_chttp2_test.vcxproj
  76. 21
      vsprojects/vcxproj/test/server_chttp2_test/server_chttp2_test.vcxproj.filters
  77. 184
      vsprojects/vcxproj/test/transport_connectivity_state_test/transport_connectivity_state_test.vcxproj
  78. 21
      vsprojects/vcxproj/test/transport_connectivity_state_test/transport_connectivity_state_test.vcxproj.filters

@ -161,7 +161,6 @@ cc_library(
"src/core/channel/context.h",
"src/core/channel/http_client_filter.h",
"src/core/channel/http_server_filter.h",
"src/core/channel/noop_filter.h",
"src/core/channel/subchannel_call_holder.h",
"src/core/client_config/client_config.h",
"src/core/client_config/connector.h",
@ -299,7 +298,6 @@ cc_library(
"src/core/channel/connected_channel.c",
"src/core/channel/http_client_filter.c",
"src/core/channel/http_server_filter.c",
"src/core/channel/noop_filter.c",
"src/core/channel/subchannel_call_holder.c",
"src/core/client_config/client_config.c",
"src/core/client_config/connector.c",
@ -453,7 +451,6 @@ cc_library(
"src/core/channel/context.h",
"src/core/channel/http_client_filter.h",
"src/core/channel/http_server_filter.h",
"src/core/channel/noop_filter.h",
"src/core/channel/subchannel_call_holder.h",
"src/core/client_config/client_config.h",
"src/core/client_config/connector.h",
@ -571,7 +568,6 @@ cc_library(
"src/core/channel/connected_channel.c",
"src/core/channel/http_client_filter.c",
"src/core/channel/http_server_filter.c",
"src/core/channel/noop_filter.c",
"src/core/channel/subchannel_call_holder.c",
"src/core/client_config/client_config.c",
"src/core/client_config/connector.c",
@ -1105,7 +1101,6 @@ objc_library(
"src/core/channel/connected_channel.c",
"src/core/channel/http_client_filter.c",
"src/core/channel/http_server_filter.c",
"src/core/channel/noop_filter.c",
"src/core/channel/subchannel_call_holder.c",
"src/core/client_config/client_config.c",
"src/core/client_config/connector.c",
@ -1256,7 +1251,6 @@ objc_library(
"src/core/channel/context.h",
"src/core/channel/http_client_filter.h",
"src/core/channel/http_server_filter.h",
"src/core/channel/noop_filter.h",
"src/core/channel/subchannel_call_holder.h",
"src/core/client_config/client_config.h",
"src/core/client_config/connector.h",

1076
Makefile

File diff suppressed because one or more lines are too long

@ -183,7 +183,6 @@
'src/core/channel/connected_channel.c',
'src/core/channel/http_client_filter.c',
'src/core/channel/http_server_filter.c',
'src/core/channel/noop_filter.c',
'src/core/channel/subchannel_call_holder.c',
'src/core/client_config/client_config.c',
'src/core/client_config/connector.c',

@ -116,7 +116,6 @@ filegroups:
- src/core/channel/context.h
- src/core/channel/http_client_filter.h
- src/core/channel/http_server_filter.h
- src/core/channel/noop_filter.h
- src/core/channel/subchannel_call_holder.h
- src/core/client_config/client_config.h
- src/core/client_config/connector.h
@ -231,7 +230,6 @@ filegroups:
- src/core/channel/connected_channel.c
- src/core/channel/http_client_filter.c
- src/core/channel/http_server_filter.c
- src/core/channel/noop_filter.c
- src/core/channel/subchannel_call_holder.c
- src/core/client_config/client_config.c
- src/core/client_config/connector.c
@ -1359,6 +1357,18 @@ targets:
- mac
- linux
- posix
- name: httpscli_test
build: test
language: c
src:
- test/core/httpcli/httpscli_test.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
platforms:
- linux
- name: init_test
build: test
language: c
@ -1500,6 +1510,16 @@ targets:
- grpc
- gpr_test_util
- gpr
- name: server_chttp2_test
build: test
language: c
src:
- test/core/surface/server_chttp2_test.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
- name: set_initial_connect_string_test
build: test
language: c
@ -1613,6 +1633,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

@ -165,7 +165,6 @@ Pod::Spec.new do |s|
'src/core/channel/context.h',
'src/core/channel/http_client_filter.h',
'src/core/channel/http_server_filter.h',
'src/core/channel/noop_filter.h',
'src/core/channel/subchannel_call_holder.h',
'src/core/client_config/client_config.h',
'src/core/client_config/connector.h',
@ -310,7 +309,6 @@ Pod::Spec.new do |s|
'src/core/channel/connected_channel.c',
'src/core/channel/http_client_filter.c',
'src/core/channel/http_server_filter.c',
'src/core/channel/noop_filter.c',
'src/core/channel/subchannel_call_holder.c',
'src/core/client_config/client_config.c',
'src/core/client_config/connector.c',
@ -463,7 +461,6 @@ Pod::Spec.new do |s|
'src/core/channel/context.h',
'src/core/channel/http_client_filter.h',
'src/core/channel/http_server_filter.h',
'src/core/channel/noop_filter.h',
'src/core/channel/subchannel_call_holder.h',
'src/core/client_config/client_config.h',
'src/core/client_config/connector.h',

@ -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_;

@ -83,8 +83,12 @@ void gpr_cmdline_add_string(gpr_cmdline *cl, const char *name, const char *help,
void gpr_cmdline_on_extra_arg(
gpr_cmdline *cl, const char *name, const char *help,
void (*on_extra_arg)(void *user_data, const char *arg), void *user_data);
/* Parse the command line */
void gpr_cmdline_parse(gpr_cmdline *cl, int argc, char **argv);
/* Enable surviving failure: default behavior is to exit the process */
void gpr_cmdline_set_survive_failure(gpr_cmdline *cl);
/* Parse the command line; returns 1 on success, on failure either dies
(by default) or returns 0 if gpr_cmdline_set_survive_failure() has been
called */
int gpr_cmdline_parse(gpr_cmdline *cl, int argc, char **argv);
/* Destroy the parser */
void gpr_cmdline_destroy(gpr_cmdline *cl);
/* Get a string describing usage */

@ -43,7 +43,6 @@
#include <grpc/support/time.h>
#include "src/core/channel/channel_stack.h"
#include "src/core/channel/noop_filter.h"
#include "src/core/statistics/census_interface.h"
#include "src/core/statistics/census_rpc_stats.h"
#include "src/core/transport/static_metadata.h"

@ -1,118 +0,0 @@
/*
*
* 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/channel/noop_filter.h"
#include <grpc/support/log.h>
typedef struct call_data {
int unused; /* C89 requires at least one struct element */
} call_data;
typedef struct channel_data {
int unused; /* C89 requires at least one struct element */
} channel_data;
/* used to silence 'variable not used' warnings */
static void ignore_unused(void *ignored) {}
static void noop_mutate_op(grpc_call_element *elem,
grpc_transport_stream_op *op) {
/* grab pointers to our data from the call element */
call_data *calld = elem->call_data;
channel_data *channeld = elem->channel_data;
ignore_unused(calld);
ignore_unused(channeld);
/* do nothing */
}
/* Called either:
- in response to an API call (or similar) from above, to send something
- a network event (or similar) from below, to receive something
op contains type and call direction information, in addition to the data
that is being sent or received. */
static void noop_start_transport_stream_op(grpc_exec_ctx *exec_ctx,
grpc_call_element *elem,
grpc_transport_stream_op *op) {
noop_mutate_op(elem, op);
/* pass control down the stack */
grpc_call_next_op(exec_ctx, elem, op);
}
/* Constructor for call_data */
static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
grpc_call_element_args *args) {
/* grab pointers to our data from the call element */
call_data *calld = elem->call_data;
channel_data *channeld = elem->channel_data;
/* initialize members */
calld->unused = channeld->unused;
}
/* Destructor for call_data */
static void destroy_call_elem(grpc_exec_ctx *exec_ctx,
grpc_call_element *elem) {}
/* Constructor for channel_data */
static void init_channel_elem(grpc_exec_ctx *exec_ctx,
grpc_channel_element *elem,
grpc_channel_element_args *args) {
/* grab pointers to our data from the channel element */
channel_data *channeld = elem->channel_data;
/* The last filter tends to be implemented differently to
handle the case that there's no 'next' filter to call on the down
path */
GPR_ASSERT(!args->is_last);
/* initialize members */
channeld->unused = 0;
}
/* Destructor for channel data */
static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
grpc_channel_element *elem) {
/* grab pointers to our data from the channel element */
channel_data *channeld = elem->channel_data;
ignore_unused(channeld);
}
const grpc_channel_filter grpc_no_op_filter = {
noop_start_transport_stream_op, grpc_channel_next_op, sizeof(call_data),
init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem,
sizeof(channel_data), init_channel_elem, destroy_channel_elem,
grpc_call_next_get_peer, "no-op"};

@ -53,6 +53,7 @@ typedef struct {
size_t next_address;
grpc_endpoint *ep;
char *host;
char *ssl_host_override;
gpr_timespec deadline;
int have_read_byte;
const grpc_httpcli_handshaker *handshaker;
@ -106,6 +107,7 @@ static void finish(grpc_exec_ctx *exec_ctx, internal_request *req,
}
gpr_slice_unref(req->request_text);
gpr_free(req->host);
gpr_free(req->ssl_host_override);
grpc_iomgr_unregister_object(&req->iomgr_obj);
gpr_slice_buffer_destroy(&req->incoming);
gpr_slice_buffer_destroy(&req->outgoing);
@ -180,8 +182,10 @@ static void on_connected(grpc_exec_ctx *exec_ctx, void *arg, int success) {
next_address(exec_ctx, req);
return;
}
req->handshaker->handshake(exec_ctx, req, req->ep, req->host,
on_handshake_done);
req->handshaker->handshake(
exec_ctx, req, req->ep,
req->ssl_host_override ? req->ssl_host_override : req->host,
on_handshake_done);
}
static void next_address(grpc_exec_ctx *exec_ctx, internal_request *req) {
@ -231,6 +235,7 @@ static void internal_request_begin(
gpr_slice_buffer_init(&req->outgoing);
grpc_iomgr_register_object(&req->iomgr_obj, name);
req->host = gpr_strdup(request->host);
req->ssl_host_override = gpr_strdup(request->ssl_host_override);
grpc_pollset_set_add_pollset(exec_ctx, &req->context->pollset_set,
req->pollset);

@ -74,6 +74,8 @@ extern const grpc_httpcli_handshaker grpc_httpcli_ssl;
typedef struct grpc_httpcli_request {
/* The host name to connect to */
char *host;
/* The host to verify in the SSL handshake (or NULL) */
char *ssl_host_override;
/* The path of the resource to fetch */
char *path;
/* Additional headers: count and key/values; the following are supplied

@ -411,7 +411,6 @@ static grpc_tcp_listener *add_socket_to_server(grpc_tcp_server *s, int fd,
grpc_tcp_listener *grpc_tcp_server_add_port(grpc_tcp_server *s,
const void *addr, size_t addr_len) {
int allocated_port = -1;
grpc_tcp_listener *sp;
grpc_tcp_listener *sp2 = NULL;
int fd;
@ -464,14 +463,13 @@ grpc_tcp_listener *grpc_tcp_server_add_port(grpc_tcp_server *s,
addr_len = sizeof(wild6);
fd = grpc_create_dualstack_socket(addr, SOCK_STREAM, 0, &dsmode);
sp = add_socket_to_server(s, fd, addr, addr_len);
allocated_port = sp->port;
if (fd >= 0 && dsmode == GRPC_DSMODE_DUALSTACK) {
goto done;
}
/* If we didn't get a dualstack socket, also listen on 0.0.0.0. */
if (port == 0 && allocated_port > 0) {
grpc_sockaddr_set_port((struct sockaddr *)&wild4, allocated_port);
if (port == 0 && sp != NULL) {
grpc_sockaddr_set_port((struct sockaddr *)&wild4, sp->port);
sp2 = sp;
}
addr = (struct sockaddr *)&wild4;
@ -488,8 +486,8 @@ grpc_tcp_listener *grpc_tcp_server_add_port(grpc_tcp_server *s,
addr_len = sizeof(addr4_copy);
}
sp = add_socket_to_server(s, fd, addr, addr_len);
sp->sibling = sp2;
if (sp2) sp2->is_sibling = 1;
if (sp != NULL) sp->sibling = sp2;
if (sp2 != NULL) sp2->is_sibling = 1;
done:
gpr_free(allocated_addr);

@ -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);

@ -62,11 +62,13 @@ struct gpr_cmdline {
void (*extra_arg)(void *user_data, const char *arg);
void *extra_arg_user_data;
void (*state)(gpr_cmdline *cl, char *arg);
int (*state)(gpr_cmdline *cl, char *arg);
arg *cur_arg;
int survive_failure;
};
static void normal_state(gpr_cmdline *cl, char *arg);
static int normal_state(gpr_cmdline *cl, char *arg);
gpr_cmdline *gpr_cmdline_create(const char *description) {
gpr_cmdline *cl = gpr_malloc(sizeof(gpr_cmdline));
@ -78,6 +80,10 @@ gpr_cmdline *gpr_cmdline_create(const char *description) {
return cl;
}
void gpr_cmdline_set_survive_failure(gpr_cmdline *cl) {
cl->survive_failure = 1;
}
void gpr_cmdline_destroy(gpr_cmdline *cl) {
while (cl->args) {
arg *a = cl->args;
@ -185,16 +191,22 @@ char *gpr_cmdline_usage_string(gpr_cmdline *cl, const char *argv0) {
return tmp;
}
static void print_usage_and_die(gpr_cmdline *cl) {
static int print_usage_and_die(gpr_cmdline *cl) {
char *usage = gpr_cmdline_usage_string(cl, cl->argv0);
fprintf(stderr, "%s", usage);
gpr_free(usage);
exit(1);
if (!cl->survive_failure) {
exit(1);
}
return 0;
}
static void extra_state(gpr_cmdline *cl, char *str) {
if (!cl->extra_arg) print_usage_and_die(cl);
static int extra_state(gpr_cmdline *cl, char *str) {
if (!cl->extra_arg) {
return print_usage_and_die(cl);
}
cl->extra_arg(cl->extra_arg_user_data, str);
return 1;
}
static arg *find_arg(gpr_cmdline *cl, char *name) {
@ -208,13 +220,13 @@ static arg *find_arg(gpr_cmdline *cl, char *name) {
if (!a) {
fprintf(stderr, "Unknown argument: %s\n", name);
print_usage_and_die(cl);
return NULL;
}
return a;
}
static void value_state(gpr_cmdline *cl, char *str) {
static int value_state(gpr_cmdline *cl, char *str) {
long intval;
char *end;
@ -226,7 +238,7 @@ static void value_state(gpr_cmdline *cl, char *str) {
if (*end || intval < INT_MIN || intval > INT_MAX) {
fprintf(stderr, "expected integer, got '%s' for %s\n", str,
cl->cur_arg->name);
print_usage_and_die(cl);
return print_usage_and_die(cl);
}
*(int *)cl->cur_arg->value = (int)intval;
break;
@ -238,7 +250,7 @@ static void value_state(gpr_cmdline *cl, char *str) {
} else {
fprintf(stderr, "expected boolean, got '%s' for %s\n", str,
cl->cur_arg->name);
print_usage_and_die(cl);
return print_usage_and_die(cl);
}
break;
case ARGTYPE_STRING:
@ -247,16 +259,18 @@ static void value_state(gpr_cmdline *cl, char *str) {
}
cl->state = normal_state;
return 1;
}
static void normal_state(gpr_cmdline *cl, char *str) {
static int normal_state(gpr_cmdline *cl, char *str) {
char *eq = NULL;
char *tmp = NULL;
char *arg_name = NULL;
int r = 1;
if (0 == strcmp(str, "-help") || 0 == strcmp(str, "--help") ||
0 == strcmp(str, "-h")) {
print_usage_and_die(cl);
return print_usage_and_die(cl);
}
cl->cur_arg = NULL;
@ -266,7 +280,7 @@ static void normal_state(gpr_cmdline *cl, char *str) {
if (str[2] == 0) {
/* handle '--' to move to just extra args */
cl->state = extra_state;
return;
return 1;
}
str += 2;
} else {
@ -277,12 +291,15 @@ static void normal_state(gpr_cmdline *cl, char *str) {
/* str is of the form '--no-foo' - it's a flag disable */
str += 3;
cl->cur_arg = find_arg(cl, str);
if (cl->cur_arg == NULL) {
return print_usage_and_die(cl);
}
if (cl->cur_arg->type != ARGTYPE_BOOL) {
fprintf(stderr, "%s is not a flag argument\n", str);
print_usage_and_die(cl);
return print_usage_and_die(cl);
}
*(int *)cl->cur_arg->value = 0;
return; /* early out */
return 1; /* early out */
}
eq = strchr(str, '=');
if (eq != NULL) {
@ -294,9 +311,12 @@ static void normal_state(gpr_cmdline *cl, char *str) {
arg_name = str;
}
cl->cur_arg = find_arg(cl, arg_name);
if (cl->cur_arg == NULL) {
return print_usage_and_die(cl);
}
if (eq != NULL) {
/* str was of the type --foo=value, parse the value */
value_state(cl, eq + 1);
r = value_state(cl, eq + 1);
} else if (cl->cur_arg->type != ARGTYPE_BOOL) {
/* flag types don't have a '--foo value' variant, other types do */
cl->state = value_state;
@ -305,19 +325,23 @@ static void normal_state(gpr_cmdline *cl, char *str) {
*(int *)cl->cur_arg->value = 1;
}
} else {
extra_state(cl, str);
r = extra_state(cl, str);
}
gpr_free(tmp);
return r;
}
void gpr_cmdline_parse(gpr_cmdline *cl, int argc, char **argv) {
int gpr_cmdline_parse(gpr_cmdline *cl, int argc, char **argv) {
int i;
GPR_ASSERT(argc >= 1);
cl->argv0 = argv[0];
for (i = 1; i < argc; i++) {
cl->state(cl, argv[i]);
if (!cl->state(cl, argv[i])) {
return 0;
}
}
return 1;
}

@ -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);

@ -147,6 +147,7 @@ void grpc_shutdown(void) {
gpr_timers_global_destroy();
grpc_tracer_shutdown();
grpc_resolver_registry_shutdown();
grpc_lb_policy_registry_shutdown();
for (i = 0; i < g_number_of_plugins; i++) {
if (g_all_of_the_plugins[i].destroy != NULL) {
g_all_of_the_plugins[i].destroy();

@ -101,9 +101,7 @@ int grpc_server_add_insecure_http2_port(grpc_server *server, const char *addr) {
}
tcp = grpc_tcp_server_create();
if (!tcp) {
goto error;
}
GPR_ASSERT(tcp);
for (i = 0; i < resolved->naddrs; i++) {
grpc_tcp_listener *listener;

@ -44,6 +44,8 @@
#include "src/core/transport/chttp2/http2_errors.h"
#include "src/core/transport/chttp2_transport.h"
#define MAX_MAX_HEADER_LIST_SIZE (1024*1024*1024)
/* HTTP/2 mandated initial connection settings */
const grpc_chttp2_setting_parameters
grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS] = {
@ -60,7 +62,7 @@ const grpc_chttp2_setting_parameters
GRPC_CHTTP2_FLOW_CONTROL_ERROR},
{"MAX_FRAME_SIZE", 16384, 16384, 16777215,
GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE, GRPC_CHTTP2_PROTOCOL_ERROR},
{"MAX_HEADER_LIST_SIZE", 0xffffffffu, 0, 0xffffffffu,
{"MAX_HEADER_LIST_SIZE", MAX_MAX_HEADER_LIST_SIZE, 0, MAX_MAX_HEADER_LIST_SIZE,
GRPC_CHTTP2_CLAMP_INVALID_VALUE, GRPC_CHTTP2_PROTOCOL_ERROR},
};

@ -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);

@ -711,7 +711,7 @@ int grpc_mdstr_is_legal_header(grpc_mdstr *s) {
int grpc_mdstr_is_legal_nonbin_header(grpc_mdstr *s) {
static const gpr_uint8 legal_header_bits[256 / 8] = {
0x00, 0x00, 0x00, 0x00, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
return conforms_to(s, legal_header_bits);

@ -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;
}

@ -47,6 +47,17 @@ namespace Grpc.Core.Tests
Assert.Throws(typeof(ArgumentNullException), () => new Channel(null, ChannelCredentials.Insecure));
}
[Test]
public void Constructor_RejectsDuplicateOptions()
{
var options = new ChannelOption[]
{
new ChannelOption(ChannelOptions.PrimaryUserAgentString, "ABC"),
new ChannelOption(ChannelOptions.PrimaryUserAgentString, "XYZ")
};
Assert.Throws(typeof(ArgumentException), () => new Channel("127.0.0.1", ChannelCredentials.Insecure, options));
}
[Test]
public void State_IdleAfterCreation()
{

@ -201,7 +201,7 @@ namespace Grpc.Core.Tests
Assert.AreEqual(headers[1].Key, trailers[1].Key);
CollectionAssert.AreEqual(headers[1].ValueBytes, trailers[1].ValueBytes);
}
[Test]
public void UnknownMethodHandler()
{
@ -218,18 +218,6 @@ namespace Grpc.Core.Tests
Assert.AreEqual(StatusCode.Unimplemented, ex.Status.StatusCode);
}
[Test]
public void UserAgentStringPresent()
{
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
{
return context.RequestHeaders.Where(entry => entry.Key == "user-agent").Single().Value;
});
string userAgent = Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "abc");
Assert.IsTrue(userAgent.StartsWith("grpc-csharp/"));
}
[Test]
public void PeerInfoPresent()
{

@ -64,6 +64,7 @@
<Link>Version.cs</Link>
</Compile>
<Compile Include="CallCredentialsTest.cs" />
<Compile Include="UserAgentStringTest.cs" />
<Compile Include="FakeCredentials.cs" />
<Compile Include="MarshallingErrorsTest.cs" />
<Compile Include="ChannelCredentialsTest.cs" />

@ -32,6 +32,7 @@
#endregion
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
@ -52,6 +53,7 @@ namespace Grpc.Core.Tests
readonly string host;
readonly ServerServiceDefinition serviceDefinition;
readonly IEnumerable<ChannelOption> channelOptions;
readonly Method<string, string> unaryMethod;
readonly Method<string, string> clientStreamingMethod;
@ -66,9 +68,10 @@ namespace Grpc.Core.Tests
Server server;
Channel channel;
public MockServiceHelper(string host = null, Marshaller<string> marshaller = null)
public MockServiceHelper(string host = null, Marshaller<string> marshaller = null, IEnumerable<ChannelOption> channelOptions = null)
{
this.host = host ?? "localhost";
this.channelOptions = channelOptions;
marshaller = marshaller ?? Marshallers.StringMarshaller;
unaryMethod = new Method<string, string>(
@ -154,7 +157,7 @@ namespace Grpc.Core.Tests
{
if (channel == null)
{
channel = new Channel(Host, GetServer().Ports.Single().BoundPort, ChannelCredentials.Insecure);
channel = new Channel(Host, GetServer().Ports.Single().BoundPort, ChannelCredentials.Insecure, channelOptions);
}
return channel;
}

@ -0,0 +1,101 @@
#region Copyright notice and license
// 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.
#endregion
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Grpc.Core;
using Grpc.Core.Internal;
using Grpc.Core.Profiling;
using Grpc.Core.Utils;
using NUnit.Framework;
namespace Grpc.Core.Tests
{
public class UserAgentStringTest
{
const string Host = "127.0.0.1";
MockServiceHelper helper;
Server server;
Channel channel;
[TearDown]
public void Cleanup()
{
channel.ShutdownAsync().Wait();
server.ShutdownAsync().Wait();
}
[Test]
public void DefaultUserAgentString()
{
helper = new MockServiceHelper(Host);
server = helper.GetServer();
server.Start();
channel = helper.GetChannel();
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
var userAgentString = context.RequestHeaders.First(m => (m.Key == "user-agent")).Value;
var parts = userAgentString.Split(new [] {' '}, 2);
Assert.AreEqual(string.Format("grpc-csharp/{0}", VersionInfo.CurrentVersion), parts[0]);
Assert.IsTrue(parts[1].StartsWith("grpc-c/"));
return Task.FromResult("PASS");
});
Assert.AreEqual("PASS", Calls.BlockingUnaryCall(helper.CreateUnaryCall(), ""));
}
[Test]
public void ApplicationUserAgentString()
{
helper = new MockServiceHelper(Host,
channelOptions: new[] { new ChannelOption(ChannelOptions.PrimaryUserAgentString, "XYZ") });
server = helper.GetServer();
server.Start();
channel = helper.GetChannel();
channel = helper.GetChannel();
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
var userAgentString = context.RequestHeaders.First(m => (m.Key == "user-agent")).Value;
var parts = userAgentString.Split(new[] { ' ' }, 3);
Assert.AreEqual("XYZ", parts[0]);
return Task.FromResult("PASS");
});
Assert.AreEqual("PASS", Calls.BlockingUnaryCall(helper.CreateUnaryCall(), ""));
}
}
}

@ -32,8 +32,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Grpc.Core.Internal;
@ -57,7 +55,7 @@ namespace Grpc.Core
readonly string target;
readonly GrpcEnvironment environment;
readonly ChannelSafeHandle handle;
readonly List<ChannelOption> options;
readonly Dictionary<string, ChannelOption> options;
bool shutdownRequested;
@ -71,12 +69,12 @@ namespace Grpc.Core
public Channel(string target, ChannelCredentials credentials, IEnumerable<ChannelOption> options = null)
{
this.target = Preconditions.CheckNotNull(target, "target");
this.options = CreateOptionsDictionary(options);
EnsureUserAgentChannelOption(this.options);
this.environment = GrpcEnvironment.AddRef();
this.options = options != null ? new List<ChannelOption>(options) : new List<ChannelOption>();
EnsureUserAgentChannelOption(this.options);
using (var nativeCredentials = credentials.ToNativeCredentials())
using (var nativeChannelArgs = ChannelOptions.CreateChannelArgs(this.options))
using (var nativeChannelArgs = ChannelOptions.CreateChannelArgs(this.options.Values))
{
if (nativeCredentials != null)
{
@ -233,18 +231,36 @@ namespace Grpc.Core
activeCallCounter.Decrement();
}
private static void EnsureUserAgentChannelOption(List<ChannelOption> options)
private static void EnsureUserAgentChannelOption(Dictionary<string, ChannelOption> options)
{
if (!options.Any((option) => option.Name == ChannelOptions.PrimaryUserAgentString))
var key = ChannelOptions.PrimaryUserAgentString;
var userAgentString = "";
ChannelOption option;
if (options.TryGetValue(key, out option))
{
options.Add(new ChannelOption(ChannelOptions.PrimaryUserAgentString, GetUserAgentString()));
}
// user-provided userAgentString needs to be at the beginning
userAgentString = option.StringValue + " ";
};
// TODO(jtattermusch): it would be useful to also provide .NET/mono version.
userAgentString += string.Format("grpc-csharp/{0}", VersionInfo.CurrentVersion);
options[ChannelOptions.PrimaryUserAgentString] = new ChannelOption(key, userAgentString);
}
private static string GetUserAgentString()
private static Dictionary<string, ChannelOption> CreateOptionsDictionary(IEnumerable<ChannelOption> options)
{
// TODO(jtattermusch): it would be useful to also provide .NET/mono version.
return string.Format("grpc-csharp/{0}", VersionInfo.CurrentVersion);
var dict = new Dictionary<string, ChannelOption>();
if (options == null)
{
return dict;
}
foreach (var option in options)
{
dict.Add(option.Name, option);
}
return dict;
}
}
}

@ -169,7 +169,7 @@ namespace Grpc.Core
/// Creates native object for a collection of channel options.
/// </summary>
/// <returns>The native channel arguments.</returns>
internal static ChannelArgsSafeHandle CreateChannelArgs(List<ChannelOption> options)
internal static ChannelArgsSafeHandle CreateChannelArgs(ICollection<ChannelOption> options)
{
if (options == null || options.Count == 0)
{
@ -179,9 +179,9 @@ namespace Grpc.Core
try
{
nativeArgs = ChannelArgsSafeHandle.Create(options.Count);
for (int i = 0; i < options.Count; i++)
int i = 0;
foreach (var option in options)
{
var option = options[i];
if (option.Type == ChannelOption.OptionType.Integer)
{
nativeArgs.SetInteger(i, option.Name, option.IntValue);
@ -194,6 +194,7 @@ namespace Grpc.Core
{
throw new InvalidOperationException("Unknown option type");
}
i++;
}
return nativeArgs;
}

@ -284,7 +284,7 @@ namespace Grpc.Core.Internal
var finishedTask = asyncCall.ServerSideCallAsync();
var responseStream = new ServerResponseStream<byte[], byte[]>(asyncCall);
await responseStream.WriteStatusAsync(new Status(StatusCode.Unimplemented, "No such method."), Metadata.Empty).ConfigureAwait(false);
await responseStream.WriteStatusAsync(new Status(StatusCode.Unimplemented, ""), Metadata.Empty).ConfigureAwait(false);
await finishedTask.ConfigureAwait(false);
}
}

@ -34,6 +34,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
@ -130,8 +131,7 @@ namespace Grpc.IntegrationTesting
};
}
var channel = new Channel(options.ServerHost, options.ServerPort, credentials, channelOptions);
TestService.TestServiceClient client = new TestService.TestServiceClient(channel);
await RunTestCaseAsync(client, options);
await RunTestCaseAsync(channel, options);
await channel.ShutdownAsync();
}
@ -159,8 +159,9 @@ namespace Grpc.IntegrationTesting
return credentials;
}
private async Task RunTestCaseAsync(TestService.TestServiceClient client, ClientOptions options)
private async Task RunTestCaseAsync(Channel channel, ClientOptions options)
{
var client = new TestService.TestServiceClient(channel);
switch (options.TestCase)
{
case "empty_unary":
@ -202,8 +203,14 @@ namespace Grpc.IntegrationTesting
case "timeout_on_sleeping_server":
await RunTimeoutOnSleepingServerAsync(client);
break;
case "benchmark_empty_unary":
RunBenchmarkEmptyUnary(client);
case "custom_metadata":
await RunCustomMetadataAsync(client);
break;
case "status_code_and_message":
await RunStatusCodeAndMessageAsync(client);
break;
case "unimplemented_method":
RunUnimplementedMethod(new UnimplementedService.UnimplementedServiceClient(channel));
break;
default:
throw new ArgumentException("Unknown test case " + options.TestCase);
@ -227,7 +234,6 @@ namespace Grpc.IntegrationTesting
ResponseSize = 314159,
Payload = CreateZerosPayload(271828)
};
var response = client.UnaryCall(request);
Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type);
@ -493,11 +499,95 @@ namespace Grpc.IntegrationTesting
Console.WriteLine("Passed!");
}
// This is not an official interop test, but it's useful.
public static void RunBenchmarkEmptyUnary(TestService.ITestServiceClient client)
public static async Task RunCustomMetadataAsync(TestService.ITestServiceClient client)
{
BenchmarkUtil.RunBenchmark(10000, 10000,
() => { client.EmptyCall(new Empty()); });
Console.WriteLine("running custom_metadata");
{
// step 1: test unary call
var request = new SimpleRequest
{
ResponseType = PayloadType.COMPRESSABLE,
ResponseSize = 314159,
Payload = CreateZerosPayload(271828)
};
var call = client.UnaryCallAsync(request, headers: CreateTestMetadata());
await call.ResponseAsync;
var responseHeaders = await call.ResponseHeadersAsync;
var responseTrailers = call.GetTrailers();
Assert.AreEqual("test_initial_metadata_value", responseHeaders.First((entry) => entry.Key == "x-grpc-test-echo-initial").Value);
CollectionAssert.AreEqual(new byte[] { 0xab, 0xab, 0xab }, responseTrailers.First((entry) => entry.Key == "x-grpc-test-echo-trailing-bin").ValueBytes);
}
{
// step 2: test full duplex call
var request = new StreamingOutputCallRequest
{
ResponseType = PayloadType.COMPRESSABLE,
ResponseParameters = { new ResponseParameters { Size = 31415 } },
Payload = CreateZerosPayload(27182)
};
var call = client.FullDuplexCall(headers: CreateTestMetadata());
var responseHeaders = await call.ResponseHeadersAsync;
await call.RequestStream.WriteAsync(request);
await call.RequestStream.CompleteAsync();
await call.ResponseStream.ToListAsync();
var responseTrailers = call.GetTrailers();
Assert.AreEqual("test_initial_metadata_value", responseHeaders.First((entry) => entry.Key == "x-grpc-test-echo-initial").Value);
CollectionAssert.AreEqual(new byte[] { 0xab, 0xab, 0xab }, responseTrailers.First((entry) => entry.Key == "x-grpc-test-echo-trailing-bin").ValueBytes);
}
Console.WriteLine("Passed!");
}
public static async Task RunStatusCodeAndMessageAsync(TestService.ITestServiceClient client)
{
Console.WriteLine("running status_code_and_message");
var echoStatus = new EchoStatus
{
Code = 2,
Message = "test status message"
};
{
// step 1: test unary call
var request = new SimpleRequest { ResponseStatus = echoStatus };
var e = Assert.Throws<RpcException>(() => client.UnaryCall(request));
Assert.AreEqual(StatusCode.Unknown, e.Status.StatusCode);
Assert.AreEqual(echoStatus.Message, e.Status.Detail);
}
{
// step 2: test full duplex call
var request = new StreamingOutputCallRequest { ResponseStatus = echoStatus };
var call = client.FullDuplexCall();
await call.RequestStream.WriteAsync(request);
await call.RequestStream.CompleteAsync();
var e = Assert.Throws<RpcException>(async () => await call.ResponseStream.ToListAsync());
Assert.AreEqual(StatusCode.Unknown, e.Status.StatusCode);
Assert.AreEqual(echoStatus.Message, e.Status.Detail);
}
Console.WriteLine("Passed!");
}
public static void RunUnimplementedMethod(UnimplementedService.IUnimplementedServiceClient client)
{
Console.WriteLine("running unimplemented_method");
var e = Assert.Throws<RpcException>(() => client.UnimplementedCall(new Empty()));
Assert.AreEqual(StatusCode.Unimplemented, e.Status.StatusCode);
Assert.AreEqual("", e.Status.Detail);
Console.WriteLine("Passed!");
}
private static Payload CreateZerosPayload(int size)
@ -516,5 +606,14 @@ namespace Grpc.IntegrationTesting
Assert.IsTrue(email.Length > 0); // spec requires nonempty client email.
return email;
}
private static Metadata CreateTestMetadata()
{
return new Metadata
{
{"x-grpc-test-echo-initial", "test_initial_metadata_value"},
{"x-grpc-test-echo-trailing-bin", new byte[] {0xab, 0xab, 0xab}}
};
}
}
}

@ -128,9 +128,27 @@ namespace Grpc.IntegrationTesting
}
[Test]
public async Task TimeoutOnSleepingServerAsync()
public async Task TimeoutOnSleepingServer()
{
await InteropClient.RunTimeoutOnSleepingServerAsync(client);
}
[Test]
public async Task CustomMetadata()
{
await InteropClient.RunCustomMetadataAsync(client);
}
[Test]
public async Task StatusCodeAndMessage()
{
await InteropClient.RunStatusCodeAndMessageAsync(client);
}
[Test]
public void UnimplementedMethod()
{
InteropClient.RunUnimplementedMethod(UnimplementedService.NewClient(channel));
}
}
}

@ -33,6 +33,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Google.Protobuf;
@ -51,14 +52,20 @@ namespace Grpc.Testing
return Task.FromResult(new Empty());
}
public Task<SimpleResponse> UnaryCall(SimpleRequest request, ServerCallContext context)
public async Task<SimpleResponse> UnaryCall(SimpleRequest request, ServerCallContext context)
{
await EnsureEchoMetadataAsync(context);
EnsureEchoStatus(request.ResponseStatus, context);
var response = new SimpleResponse { Payload = CreateZerosPayload(request.ResponseSize) };
return Task.FromResult(response);
return response;
}
public async Task StreamingOutputCall(StreamingOutputCallRequest request, IServerStreamWriter<StreamingOutputCallResponse> responseStream, ServerCallContext context)
{
await EnsureEchoMetadataAsync(context);
EnsureEchoStatus(request.ResponseStatus, context);
foreach (var responseParam in request.ResponseParameters)
{
var response = new StreamingOutputCallResponse { Payload = CreateZerosPayload(responseParam.Size) };
@ -68,6 +75,8 @@ namespace Grpc.Testing
public async Task<StreamingInputCallResponse> StreamingInputCall(IAsyncStreamReader<StreamingInputCallRequest> requestStream, ServerCallContext context)
{
await EnsureEchoMetadataAsync(context);
int sum = 0;
await requestStream.ForEachAsync(async request =>
{
@ -78,8 +87,11 @@ namespace Grpc.Testing
public async Task FullDuplexCall(IAsyncStreamReader<StreamingOutputCallRequest> requestStream, IServerStreamWriter<StreamingOutputCallResponse> responseStream, ServerCallContext context)
{
await EnsureEchoMetadataAsync(context);
await requestStream.ForEachAsync(async request =>
{
EnsureEchoStatus(request.ResponseStatus, context);
foreach (var responseParam in request.ResponseParameters)
{
var response = new StreamingOutputCallResponse { Payload = CreateZerosPayload(responseParam.Size) };
@ -97,5 +109,28 @@ namespace Grpc.Testing
{
return new Payload { Body = ByteString.CopyFrom(new byte[size]) };
}
private static async Task EnsureEchoMetadataAsync(ServerCallContext context)
{
var echoInitialList = context.RequestHeaders.Where((entry) => entry.Key == "x-grpc-test-echo-initial").ToList();
if (echoInitialList.Any()) {
var entry = echoInitialList.Single();
await context.WriteResponseHeadersAsync(new Metadata { entry });
}
var echoTrailingList = context.RequestHeaders.Where((entry) => entry.Key == "x-grpc-test-echo-trailing-bin").ToList();
if (echoTrailingList.Any()) {
context.ResponseTrailers.Add(echoTrailingList.Single());
}
}
private static void EnsureEchoStatus(EchoStatus responseStatus, ServerCallContext context)
{
if (responseStatus != null)
{
var statusCode = (StatusCode)responseStatus.Code;
context.Status = new Status(statusCode, responseStatus.Message);
}
}
}
}

@ -154,6 +154,12 @@ NAN_METHOD(ChannelCredentials::CreateSsl) {
return Nan::ThrowTypeError(
"createSSl's third argument must be a Buffer if provided");
}
if ((key_cert_pair.private_key == NULL) !=
(key_cert_pair.cert_chain == NULL)) {
return Nan::ThrowError(
"createSsl's second and third arguments must be"
" provided or omitted together");
}
grpc_channel_credentials *creds = grpc_ssl_credentials_create(
root_certs, key_cert_pair.private_key == NULL ? NULL : &key_cert_pair,
NULL);

@ -167,30 +167,18 @@ NAN_METHOD(ServerCredentials::CreateSsl) {
return Nan::ThrowTypeError("Key/cert pairs must be objects");
}
Local<Object> pair_obj = Nan::To<Object>(pair_val).ToLocalChecked();
MaybeLocal<Value> maybe_key = Nan::Get(pair_obj, key_key);
if (maybe_key.IsEmpty()) {
delete key_cert_pairs;
return Nan::ThrowTypeError(
"Key/cert pairs must have a private_key and a cert_chain");
}
MaybeLocal<Value> maybe_cert = Nan::Get(pair_obj, cert_key);
if (maybe_cert.IsEmpty()) {
delete key_cert_pairs;
return Nan::ThrowTypeError(
"Key/cert pairs must have a private_key and a cert_chain");
}
if (!::node::Buffer::HasInstance(maybe_key.ToLocalChecked())) {
Local<Value> maybe_key = Nan::Get(pair_obj, key_key).ToLocalChecked();
Local<Value> maybe_cert = Nan::Get(pair_obj, cert_key).ToLocalChecked();
if (!::node::Buffer::HasInstance(maybe_key)) {
delete key_cert_pairs;
return Nan::ThrowTypeError("private_key must be a Buffer");
}
if (!::node::Buffer::HasInstance(maybe_cert.ToLocalChecked())) {
if (!::node::Buffer::HasInstance(maybe_cert)) {
delete key_cert_pairs;
return Nan::ThrowTypeError("cert_chain must be a Buffer");
}
key_cert_pairs[i].private_key = ::node::Buffer::Data(
maybe_key.ToLocalChecked());
key_cert_pairs[i].cert_chain = ::node::Buffer::Data(
maybe_cert.ToLocalChecked());
key_cert_pairs[i].private_key = ::node::Buffer::Data(maybe_key);
key_cert_pairs[i].cert_chain = ::node::Buffer::Data(maybe_cert);
}
grpc_server_credentials *creds = grpc_ssl_server_credentials_create(
root_certs, key_cert_pairs, key_cert_pair_count, force_client_auth, NULL);

@ -76,6 +76,146 @@ var fakeFailingGoogleCredentials = {
}
};
var key_data, pem_data, ca_data;
before(function() {
var key_path = path.join(__dirname, './data/server1.key');
var pem_path = path.join(__dirname, './data/server1.pem');
var ca_path = path.join(__dirname, '../test/data/ca.pem');
key_data = fs.readFileSync(key_path);
pem_data = fs.readFileSync(pem_path);
ca_data = fs.readFileSync(ca_path);
});
describe('channel credentials', function() {
describe('#createSsl', function() {
it('works with no arguments', function() {
var creds;
assert.doesNotThrow(function() {
creds = grpc.credentials.createSsl();
});
assert.notEqual(creds, null);
});
it('works with just one Buffer argument', function() {
var creds;
assert.doesNotThrow(function() {
creds = grpc.credentials.createSsl(ca_data);
});
assert.notEqual(creds, null);
});
it('works with 3 Buffer arguments', function() {
var creds;
assert.doesNotThrow(function() {
creds = grpc.credentials.createSsl(ca_data, key_data, pem_data);
});
assert.notEqual(creds, null);
});
it('works if the first argument is null', function() {
var creds;
assert.doesNotThrow(function() {
creds = grpc.credentials.createSsl(null, key_data, pem_data);
});
assert.notEqual(creds, null);
});
it('fails if the first argument is a non-Buffer value', function() {
assert.throws(function() {
grpc.credentials.createSsl('test');
}, TypeError);
});
it('fails if the second argument is a non-Buffer value', function() {
assert.throws(function() {
grpc.credentials.createSsl(null, 'test', pem_data);
}, TypeError);
});
it('fails if the third argument is a non-Buffer value', function() {
assert.throws(function() {
grpc.credentials.createSsl(null, key_data, 'test');
}, TypeError);
});
it('fails if only 1 of the last 2 arguments is provided', function() {
assert.throws(function() {
grpc.credentials.createSsl(null, key_data);
});
assert.throws(function() {
grpc.credentials.createSsl(null, null, pem_data);
});
});
});
});
describe('server credentials', function() {
describe('#createSsl', function() {
it('accepts a buffer and array as the first 2 arguments', function() {
var creds;
assert.doesNotThrow(function() {
creds = grpc.ServerCredentials.createSsl(ca_data, []);
});
assert.notEqual(creds, null);
});
it('accepts a boolean as the third argument', function() {
var creds;
assert.doesNotThrow(function() {
creds = grpc.ServerCredentials.createSsl(ca_data, [], true);
});
assert.notEqual(creds, null);
});
it('accepts an object with two buffers in the second argument', function() {
var creds;
assert.doesNotThrow(function() {
creds = grpc.ServerCredentials.createSsl(null,
[{private_key: key_data,
cert_chain: pem_data}]);
});
assert.notEqual(creds, null);
});
it('accepts multiple objects in the second argument', function() {
var creds;
assert.doesNotThrow(function() {
creds = grpc.ServerCredentials.createSsl(null,
[{private_key: key_data,
cert_chain: pem_data},
{private_key: key_data,
cert_chain: pem_data}]);
});
assert.notEqual(creds, null);
});
it('fails if the second argument is not an Array', function() {
assert.throws(function() {
grpc.ServerCredentials.createSsl(ca_data, 'test');
}, TypeError);
});
it('fails if the first argument is a non-Buffer value', function() {
assert.throws(function() {
grpc.ServerCredentials.createSsl('test', []);
}, TypeError);
});
it('fails if the third argument is a non-boolean value', function() {
assert.throws(function() {
grpc.ServerCredentials.createSsl(ca_data, [], 'test');
}, TypeError);
});
it('fails if the array elements are not objects', function() {
assert.throws(function() {
grpc.ServerCredentials.createSsl(ca_data, 'test');
}, TypeError);
});
it('fails if the object does not have a Buffer private_key', function() {
assert.throws(function() {
grpc.ServerCredentials.createSsl(null,
[{private_key: 'test',
cert_chain: pem_data}]);
}, TypeError);
});
it('fails if the object does not have a Buffer cert_chain', function() {
assert.throws(function() {
grpc.ServerCredentials.createSsl(null,
[{private_key: key_data,
cert_chain: 'test'}]);
}, TypeError);
});
});
});
describe('client credentials', function() {
var Client;
var server;
@ -109,20 +249,13 @@ describe('client credentials', function() {
});
}
});
var key_path = path.join(__dirname, './data/server1.key');
var pem_path = path.join(__dirname, './data/server1.pem');
var key_data = fs.readFileSync(key_path);
var pem_data = fs.readFileSync(pem_path);
var creds = grpc.ServerCredentials.createSsl(null,
[{private_key: key_data,
cert_chain: pem_data}]);
//creds = grpc.ServerCredentials.createInsecure();
port = server.bind('localhost:0', creds);
server.start();
Client = proto.TestService;
var ca_path = path.join(__dirname, '../test/data/ca.pem');
var ca_data = fs.readFileSync(ca_path);
client_ssl_creds = grpc.credentials.createSsl(ca_data);
var host_override = 'foo.test.google.fr';
client_options['grpc.ssl_target_name_override'] = host_override;

@ -45,9 +45,30 @@ describe('server', function() {
new grpc.Server();
});
});
it('should work with an empty list argument', function() {
it('should work with an empty object argument', function() {
assert.doesNotThrow(function() {
new grpc.Server([]);
new grpc.Server({});
});
});
it('should work without the new keyword', function() {
var server;
assert.doesNotThrow(function() {
server = grpc.Server();
});
assert(server instanceof grpc.Server);
});
it('should only accept objects with string or int values', function() {
assert.doesNotThrow(function() {
new grpc.Server({'key' : 'value'});
});
assert.doesNotThrow(function() {
new grpc.Server({'key' : 5});
});
assert.throws(function() {
new grpc.Server({'key' : null});
});
assert.throws(function() {
new grpc.Server({'key' : new Date()});
});
});
});

@ -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

@ -94,7 +94,28 @@ int main(int argc, char **argv) {
/* some settings values are illegal */
/* max frame size = 0 */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR ONE_SETTING_HDR "\x00\x05\x00\x00\x00\x00", GRPC_BAD_CLIENT_DISCONNECT);
PFX_STR ONE_SETTING_HDR "\x00\x05\x00\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR ONE_SETTING_HDR "\x00\x06\xff\xff\xff\xff",
GRPC_BAD_CLIENT_DISCONNECT);
/* update intiial window size */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR ONE_SETTING_HDR "\x00\x04\x00\x01\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
/* ack with data */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR
"\x00\x00\x00\x04\x00\x00\x00\x00\x00"
"\x00\x00\x01\x04\x01\x00\x00\x00\x00", 0);
/* settings frame with invalid flags */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR
"\x00\x00\x00\x04\x10\x00\x00\x00\x00", 0);
/* unknown settings should be ignored */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR ONE_SETTING_HDR "\x00\x99\x00\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
return 0;
}

@ -42,8 +42,9 @@
#include <grpc/support/string_util.h>
#include "src/core/channel/channel_stack.h"
#include "src/core/surface/channel.h"
#include "src/core/channel/client_channel.h"
#include "src/core/client_config/lb_policy_registry.h"
#include "src/core/surface/channel.h"
#include "src/core/support/string.h"
#include "src/core/surface/server.h"
#include "test/core/util/test_config.h"
@ -716,6 +717,9 @@ int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_init();
GPR_ASSERT(grpc_lb_policy_create("this-lb-policy-does-not-exist", NULL) == NULL);
GPR_ASSERT(grpc_lb_policy_create(NULL, NULL) == NULL);
/* everything is fine, all servers stay up the whole time and life's peachy */
spec = test_spec_create(NUM_ITERS, NUM_SERVERS);
spec->verifier = verify_vanilla_round_robin;

@ -69,13 +69,13 @@ static void on_finish(grpc_exec_ctx *exec_ctx, void *arg,
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
}
static void test_get(int use_ssl, int port) {
static void test_get(int port) {
grpc_httpcli_request req;
char *host;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
g_done = 0;
gpr_log(GPR_INFO, "running %s with use_ssl=%d.", "test_get", use_ssl);
gpr_log(GPR_INFO, "test_get");
gpr_asprintf(&host, "localhost:%d", port);
gpr_log(GPR_INFO, "requesting from %s", host);
@ -83,7 +83,7 @@ static void test_get(int use_ssl, int port) {
memset(&req, 0, sizeof(req));
req.host = host;
req.path = "/get";
req.handshaker = use_ssl ? &grpc_httpcli_ssl : &grpc_httpcli_plaintext;
req.handshaker = &grpc_httpcli_plaintext;
grpc_httpcli_get(&exec_ctx, &g_context, &g_pollset, &req, n_seconds_time(15),
on_finish, (void *)42);
@ -100,13 +100,13 @@ static void test_get(int use_ssl, int port) {
gpr_free(host);
}
static void test_post(int use_ssl, int port) {
static void test_post(int port) {
grpc_httpcli_request req;
char *host;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
g_done = 0;
gpr_log(GPR_INFO, "running %s with use_ssl=%d.", "test_post", (int)use_ssl);
gpr_log(GPR_INFO, "test_post");
gpr_asprintf(&host, "localhost:%d", port);
gpr_log(GPR_INFO, "posting to %s", host);
@ -114,7 +114,7 @@ static void test_post(int use_ssl, int port) {
memset(&req, 0, sizeof(req));
req.host = host;
req.path = "/post";
req.handshaker = use_ssl ? &grpc_httpcli_ssl : &grpc_httpcli_plaintext;
req.handshaker = &grpc_httpcli_plaintext;
grpc_httpcli_post(&exec_ctx, &g_context, &g_pollset, &req, "hello", 5,
n_seconds_time(15), on_finish, (void *)42);
@ -170,8 +170,8 @@ int main(int argc, char **argv) {
grpc_httpcli_context_init(&g_context);
grpc_pollset_init(&g_pollset);
test_get(0, port);
test_post(0, port);
test_get(port);
test_post(port);
grpc_httpcli_context_destroy(&g_context);
grpc_closure_init(&destroyed, destroy_pollset, &g_pollset);

@ -0,0 +1,188 @@
/*
*
* 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/httpcli/httpcli.h"
#include <string.h>
#include <grpc/grpc.h>
#include "src/core/iomgr/iomgr.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/subprocess.h>
#include <grpc/support/sync.h>
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
static int g_done = 0;
static grpc_httpcli_context g_context;
static grpc_pollset g_pollset;
static gpr_timespec n_seconds_time(int seconds) {
return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(seconds);
}
static void on_finish(grpc_exec_ctx *exec_ctx, void *arg,
const grpc_httpcli_response *response) {
const char *expect =
"<html><head><title>Hello world!</title></head>"
"<body><p>This is a test</p></body></html>";
GPR_ASSERT(arg == (void *)42);
GPR_ASSERT(response);
GPR_ASSERT(response->status == 200);
GPR_ASSERT(response->body_length == strlen(expect));
GPR_ASSERT(0 == memcmp(expect, response->body, response->body_length));
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
g_done = 1;
grpc_pollset_kick(&g_pollset, NULL);
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
}
static void test_get(int port) {
grpc_httpcli_request req;
char *host;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
g_done = 0;
gpr_log(GPR_INFO, "test_get");
gpr_asprintf(&host, "localhost:%d", port);
gpr_log(GPR_INFO, "requesting from %s", host);
memset(&req, 0, sizeof(req));
req.host = host;
req.ssl_host_override = "foo.test.google.fr";
req.path = "/get";
req.handshaker = &grpc_httpcli_ssl;
grpc_httpcli_get(&exec_ctx, &g_context, &g_pollset, &req, n_seconds_time(15),
on_finish, (void *)42);
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
while (!g_done) {
grpc_pollset_worker worker;
grpc_pollset_work(&exec_ctx, &g_pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC), n_seconds_time(20));
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
grpc_exec_ctx_finish(&exec_ctx);
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
}
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
gpr_free(host);
}
static void test_post(int port) {
grpc_httpcli_request req;
char *host;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
g_done = 0;
gpr_log(GPR_INFO, "test_post");
gpr_asprintf(&host, "localhost:%d", port);
gpr_log(GPR_INFO, "posting to %s", host);
memset(&req, 0, sizeof(req));
req.host = host;
req.ssl_host_override = "foo.test.google.fr";
req.path = "/post";
req.handshaker = &grpc_httpcli_ssl;
grpc_httpcli_post(&exec_ctx, &g_context, &g_pollset, &req, "hello", 5,
n_seconds_time(15), on_finish, (void *)42);
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
while (!g_done) {
grpc_pollset_worker worker;
grpc_pollset_work(&exec_ctx, &g_pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC), n_seconds_time(20));
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
grpc_exec_ctx_finish(&exec_ctx);
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
}
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
gpr_free(host);
}
static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, int success) {
grpc_pollset_destroy(p);
}
int main(int argc, char **argv) {
grpc_closure destroyed;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_subprocess *server;
char *me = argv[0];
char *lslash = strrchr(me, '/');
char *args[5];
char root[1024];
int port = grpc_pick_unused_port_or_die();
/* figure out where we are */
if (lslash) {
memcpy(root, me, (size_t)(lslash - me));
root[lslash - me] = 0;
} else {
strcpy(root, ".");
}
/* start the server */
gpr_asprintf(&args[0], "%s/../../test/core/httpcli/test_server.py", root);
args[1] = "--port";
gpr_asprintf(&args[2], "%d", port);
args[3] = "--ssl";
server = gpr_subprocess_create(4, (const char **)args);
GPR_ASSERT(server);
gpr_free(args[0]);
gpr_free(args[2]);
gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
gpr_time_from_seconds(5, GPR_TIMESPAN)));
grpc_test_init(argc, argv);
grpc_init();
grpc_httpcli_context_init(&g_context);
grpc_pollset_init(&g_pollset);
test_get(port);
test_post(port);
grpc_httpcli_context_destroy(&g_context);
grpc_closure_init(&destroyed, destroy_pollset, &g_pollset);
grpc_pollset_shutdown(&exec_ctx, &g_pollset, &destroyed);
grpc_exec_ctx_finish(&exec_ctx);
grpc_shutdown();
gpr_subprocess_destroy(server);
return 0;
}

@ -4,9 +4,18 @@
import argparse
import BaseHTTPServer
import os
import ssl
import sys
_PEM = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '../../..', 'src/core/tsi/test_creds/server1.pem'))
_KEY = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '../../..', 'src/core/tsi/test_creds/server1.key'))
print _PEM
open(_PEM).close()
argp = argparse.ArgumentParser(description='Server for httpcli_test')
argp.add_argument('-p', '--port', default=10080, type=int)
argp.add_argument('-s', '--ssl', default=False, action='store_true')
args = argp.parse_args()
print 'server running on port %d' % args.port
@ -28,4 +37,7 @@ class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
if self.path == '/post' and content == 'hello':
self.good()
BaseHTTPServer.HTTPServer(('', args.port), Handler).serve_forever()
httpd = BaseHTTPServer.HTTPServer(('localhost', args.port), Handler)
if args.ssl:
httpd.socket = ssl.wrap_socket(httpd.socket, certfile=_PEM, keyfile=_KEY, server_side=True)
httpd.serve_forever()

@ -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,
@ -1042,6 +1096,7 @@ static void test_get_well_known_google_credentials_file_path(void) {
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_init();
test_empty_md_store();
test_ref_unref_empty_md_store();
test_add_to_empty_md_store();
@ -1067,9 +1122,11 @@ 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();
grpc_shutdown();
return 0;
}

@ -40,7 +40,7 @@
#include <grpc/support/useful.h>
#include "test/core/util/test_config.h"
#define LOG_TEST() gpr_log(GPR_INFO, "%s", __FILE__)
#define LOG_TEST() gpr_log(GPR_INFO, "test at %s:%d", __FILE__, __LINE__)
static void test_simple_int(void) {
int x = 1;
@ -273,6 +273,44 @@ static void test_many(void) {
gpr_cmdline_destroy(cl);
}
static void extra_arg_cb(void *user_data, const char *arg) {
int *count = user_data;
GPR_ASSERT(arg != NULL);
GPR_ASSERT(strlen(arg) == 1);
GPR_ASSERT(arg[0] == 'a' + *count);
++*count;
}
static void test_extra(void) {
gpr_cmdline *cl;
int count = 0;
char *args[] = {(char *)__FILE__, "a", "b", "c"};
LOG_TEST();
cl = gpr_cmdline_create(NULL);
gpr_cmdline_on_extra_arg(cl, "file", "filenames to process", extra_arg_cb,
&count);
gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(args), args);
GPR_ASSERT(count == 3);
gpr_cmdline_destroy(cl);
}
static void test_extra_dashdash(void) {
gpr_cmdline *cl;
int count = 0;
char *args[] = {(char *)__FILE__, "--", "a", "b", "c"};
LOG_TEST();
cl = gpr_cmdline_create(NULL);
gpr_cmdline_on_extra_arg(cl, "file", "filenames to process", extra_arg_cb,
&count);
gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(args), args);
GPR_ASSERT(count == 3);
gpr_cmdline_destroy(cl);
}
static void test_usage(void) {
gpr_cmdline *cl;
char *usage;
@ -281,20 +319,154 @@ static void test_usage(void) {
int x = 0;
int flag = 2;
LOG_TEST();
cl = gpr_cmdline_create(NULL);
gpr_cmdline_add_string(cl, "str", NULL, &str);
gpr_cmdline_add_int(cl, "x", NULL, &x);
gpr_cmdline_add_flag(cl, "flag", NULL, &flag);
gpr_cmdline_on_extra_arg(cl, "file", "filenames to process", extra_arg_cb,
NULL);
usage = gpr_cmdline_usage_string(cl, "test");
GPR_ASSERT(
0 == strcmp(usage,
"Usage: test [--str=string] [--x=int] [--flag|--no-flag]\n"));
GPR_ASSERT(0 == strcmp(usage,
"Usage: test [--str=string] [--x=int] "
"[--flag|--no-flag] [file...]\n"));
gpr_free(usage);
usage = gpr_cmdline_usage_string(cl, "/foo/test");
GPR_ASSERT(0 == strcmp(usage,
"Usage: test [--str=string] [--x=int] "
"[--flag|--no-flag] [file...]\n"));
gpr_free(usage);
gpr_cmdline_destroy(cl);
}
static void test_help(void) {
gpr_cmdline *cl;
char *str = NULL;
int x = 0;
int flag = 2;
char *help[] = {(char *)__FILE__, "-h"};
LOG_TEST();
cl = gpr_cmdline_create(NULL);
gpr_cmdline_set_survive_failure(cl);
gpr_cmdline_add_string(cl, "str", NULL, &str);
gpr_cmdline_add_int(cl, "x", NULL, &x);
gpr_cmdline_add_flag(cl, "flag", NULL, &flag);
gpr_cmdline_on_extra_arg(cl, "file", "filenames to process", extra_arg_cb,
NULL);
GPR_ASSERT(0 == gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(help), help));
gpr_cmdline_destroy(cl);
}
static void test_badargs1(void) {
gpr_cmdline *cl;
char *str = NULL;
int x = 0;
int flag = 2;
char *bad_arg_name[] = {(char *)__FILE__, "--y"};
LOG_TEST();
cl = gpr_cmdline_create(NULL);
gpr_cmdline_set_survive_failure(cl);
gpr_cmdline_add_string(cl, "str", NULL, &str);
gpr_cmdline_add_int(cl, "x", NULL, &x);
gpr_cmdline_add_flag(cl, "flag", NULL, &flag);
gpr_cmdline_on_extra_arg(cl, "file", "filenames to process", extra_arg_cb,
NULL);
GPR_ASSERT(0 ==
gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(bad_arg_name), bad_arg_name));
gpr_cmdline_destroy(cl);
}
static void test_badargs2(void) {
gpr_cmdline *cl;
char *str = NULL;
int x = 0;
int flag = 2;
char *bad_int_value[] = {(char *)__FILE__, "--x", "henry"};
LOG_TEST();
cl = gpr_cmdline_create(NULL);
gpr_cmdline_set_survive_failure(cl);
gpr_cmdline_add_string(cl, "str", NULL, &str);
gpr_cmdline_add_int(cl, "x", NULL, &x);
gpr_cmdline_add_flag(cl, "flag", NULL, &flag);
gpr_cmdline_on_extra_arg(cl, "file", "filenames to process", extra_arg_cb,
NULL);
GPR_ASSERT(
0 == gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(bad_int_value), bad_int_value));
gpr_cmdline_destroy(cl);
}
static void test_badargs3(void) {
gpr_cmdline *cl;
char *str = NULL;
int x = 0;
int flag = 2;
char *bad_bool_value[] = {(char *)__FILE__, "--flag=henry"};
LOG_TEST();
cl = gpr_cmdline_create(NULL);
gpr_cmdline_set_survive_failure(cl);
gpr_cmdline_add_string(cl, "str", NULL, &str);
gpr_cmdline_add_int(cl, "x", NULL, &x);
gpr_cmdline_add_flag(cl, "flag", NULL, &flag);
gpr_cmdline_on_extra_arg(cl, "file", "filenames to process", extra_arg_cb,
NULL);
GPR_ASSERT(0 == gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(bad_bool_value),
bad_bool_value));
gpr_cmdline_destroy(cl);
}
static void test_badargs4(void) {
gpr_cmdline *cl;
char *str = NULL;
int x = 0;
int flag = 2;
char *bad_bool_value[] = {(char *)__FILE__, "--no-str"};
LOG_TEST();
cl = gpr_cmdline_create(NULL);
gpr_cmdline_set_survive_failure(cl);
gpr_cmdline_add_string(cl, "str", NULL, &str);
gpr_cmdline_add_int(cl, "x", NULL, &x);
gpr_cmdline_add_flag(cl, "flag", NULL, &flag);
gpr_cmdline_on_extra_arg(cl, "file", "filenames to process", extra_arg_cb,
NULL);
GPR_ASSERT(0 == gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(bad_bool_value),
bad_bool_value));
gpr_cmdline_destroy(cl);
}
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
test_simple_int();
@ -312,6 +484,13 @@ int main(int argc, char **argv) {
test_flag_val_true();
test_flag_val_false();
test_many();
test_extra();
test_extra_dashdash();
test_usage();
test_help();
test_badargs1();
test_badargs2();
test_badargs3();
test_badargs4();
return 0;
}

@ -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;
}

@ -31,12 +31,13 @@
*
*/
#include <grpc/grpc.h>
#include <string.h>
#include "test/core/end2end/cq_verifier.h"
#include "test/core/util/test_config.h"
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "test/core/end2end/cq_verifier.h"
#include "test/core/util/test_config.h"
static void *tag(gpr_intptr x) { return (void *)x; }
@ -47,21 +48,25 @@ int main(int argc, char **argv) {
cq_verifier *cqv;
grpc_op ops[6];
grpc_op *op;
grpc_metadata_array initial_metadata_recv;
grpc_metadata_array trailing_metadata_recv;
grpc_status_code status;
grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
char *peer;
grpc_test_init(argc, argv);
grpc_init();
grpc_metadata_array_init(&initial_metadata_recv);
grpc_metadata_array_init(&trailing_metadata_recv);
chan = grpc_lame_client_channel_create(
"lampoon:national", GRPC_STATUS_UNKNOWN, "Rpc sent on a lame channel.");
GPR_ASSERT(chan);
cq = grpc_completion_queue_create(NULL);
call = grpc_channel_create_call(chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq,
"/Foo", "anywhere",
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(100), NULL);
@ -74,6 +79,19 @@ int main(int argc, char **argv) {
op->flags = 0;
op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
op->reserved = NULL;
op++;
error = grpc_call_start_batch(call, ops, (size_t)(op - ops), tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
/* the call should immediately fail */
cq_expect_completion(cqv, tag(1), 0);
cq_verify(cqv);
op = ops;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
op->data.recv_status_on_client.status = &status;
@ -82,18 +100,23 @@ int main(int argc, char **argv) {
op->flags = 0;
op->reserved = NULL;
op++;
error = grpc_call_start_batch(call, ops, (size_t)(op - ops), tag(1), NULL);
error = grpc_call_start_batch(call, ops, (size_t)(op - ops), tag(2), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
/* the call should immediately fail */
cq_expect_completion(cqv, tag(1), 1);
cq_expect_completion(cqv, tag(2), 1);
cq_verify(cqv);
peer = grpc_call_get_peer(call);
GPR_ASSERT(strcmp(peer, "lampoon:national") == 0);
gpr_free(peer);
grpc_call_destroy(call);
grpc_channel_destroy(chan);
cq_verifier_destroy(cqv);
grpc_completion_queue_destroy(cq);
grpc_metadata_array_destroy(&initial_metadata_recv);
grpc_metadata_array_destroy(&trailing_metadata_recv);
gpr_free(details);

@ -31,14 +31,19 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CHANNEL_NOOP_FILTER_H
#define GRPC_INTERNAL_CORE_CHANNEL_NOOP_FILTER_H
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include "test/core/util/test_config.h"
#include "src/core/channel/channel_stack.h"
void test_unparsable_target(void) {
int port = grpc_server_add_insecure_http2_port(NULL, "[");
GPR_ASSERT(port == 0);
}
/* No-op filter: simply takes everything it's given, and passes it on to the
next filter. Exists simply as a starting point that others can take and
customize for their own filters */
extern const grpc_channel_filter grpc_no_op_filter;
#endif /* GRPC_INTERNAL_CORE_CHANNEL_NOOP_FILTER_H */
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_init();
test_unparsable_target();
grpc_shutdown();
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;
}

@ -241,6 +241,25 @@ static void test_base64_and_huffman_works(void) {
grpc_shutdown();
}
static void test_user_data_works(void) {
int *ud1;
int *ud2;
grpc_mdelem *md;
LOG_TEST("test_user_data_works");
grpc_init();
ud1 = gpr_malloc(sizeof(int));
*ud1 = 1;
ud2 = gpr_malloc(sizeof(int));
*ud2 = 2;
md = grpc_mdelem_from_strings("abc", "123");
grpc_mdelem_set_user_data(md, gpr_free, ud1);
grpc_mdelem_set_user_data(md, gpr_free, ud2);
GPR_ASSERT(grpc_mdelem_get_user_data(md, gpr_free) == ud1);
GRPC_MDELEM_UNREF(md);
grpc_shutdown();
}
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
test_no_op();
@ -252,5 +271,6 @@ int main(int argc, char **argv) {
test_things_stick_around();
test_slices_work();
test_base64_and_huffman_works();
test_user_data_works();
return 0;
}

@ -72,7 +72,6 @@ int main(void) {
clear();
for (i = 32; i <= 126; i++) {
if (i == ',') continue;
legal(i);
}
dump();

@ -790,7 +790,6 @@ src/core/channel/connected_channel.h \
src/core/channel/context.h \
src/core/channel/http_client_filter.h \
src/core/channel/http_server_filter.h \
src/core/channel/noop_filter.h \
src/core/channel/subchannel_call_holder.h \
src/core/client_config/client_config.h \
src/core/client_config/connector.h \
@ -928,7 +927,6 @@ src/core/channel/compress_filter.c \
src/core/channel/connected_channel.c \
src/core/channel/http_client_filter.c \
src/core/channel/http_server_filter.c \
src/core/channel/noop_filter.c \
src/core/channel/subchannel_call_holder.c \
src/core/client_config/client_config.c \
src/core/client_config/connector.c \

@ -40,6 +40,26 @@
% endif
</%def>
<%def name="fill_one_http2_test_result(shortname, resultset)">
## keep this mostly in sync with the template above
% if shortname in resultset:
## Because interop tests does not have runs_per_test flag, each test is
## run once. So there should only be one element for each result.
<% result = resultset[shortname][0] %>
<td bgcolor="white">
<div style="width:95%; border: 1px solid black; position: relative; padding: 3px;">
<span style="position: absolute; left: 45%;">${int(result.http2results['percent'] * 100)}&#37;</span>
<div style="height: 20px;
background-color: hsl(${result.http2results['percent'] * 120}, 100%, 50%);
width: ${result.http2results['percent'] * 100}%;"
title="${result.http2results['failed_cases'] | h}"></div>
</div>
</td>
% else:
<td bgcolor="magenta">Not implemented</td>
% endif
</%def>
% if num_failures > 1:
<p><h2><font color="red">${num_failures} tests failed!</font></h2></p>
% elif num_failures:
@ -95,11 +115,11 @@
shortname = 'cloud_to_cloud:http2:%s_server:%s' % (
server_lang, test_case)
%>
${fill_one_test_result(shortname, resultset)}
${fill_one_http2_test_result(shortname, resultset)}
% endfor
% if cloud_to_prod:
<% shortname = 'cloud_to_prod:http2:%s' % test_case %>
${fill_one_test_result(shortname, resultset)}
${fill_one_http2_test_result(shortname, resultset)}
% endif
</tr>
% endfor

@ -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):

@ -32,6 +32,7 @@
try:
from mako.runtime import Context
from mako.template import Template
from mako import exceptions
except (ImportError):
pass # Mako not installed but it is ok.
import os
@ -103,9 +104,15 @@ def render_interop_html_report(
'num_failures': num_failures,
'cloud_to_prod': cloud_to_prod,
'http2_interop': http2_interop}
html_report_out_dir = 'reports'
if not os.path.exists(html_report_out_dir):
os.mkdir(html_report_out_dir)
html_file_path = os.path.join(html_report_out_dir, 'index.html')
with open(html_file_path, 'w') as output_file:
mytemplate.render_context(Context(output_file, **args))
try:
with open(html_file_path, 'w') as output_file:
mytemplate.render_context(Context(output_file, **args))
except:
print(exceptions.text_error_template().render())
raise

@ -31,17 +31,24 @@
"""Run interop (cross-language) tests in parallel."""
import argparse
import atexit
import dockerjob
import itertools
import jobset
import json
import multiprocessing
import os
import re
import report_utils
import subprocess
import sys
import tempfile
import time
import uuid
# Docker doesn't clean up after itself, so we do it on exit.
atexit.register(lambda: subprocess.call(['stty', 'echo']))
ROOT = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '../..'))
os.chdir(ROOT)
@ -52,6 +59,11 @@ _DEFAULT_SERVER_PORT=8080
# supported by C core SslCredentials instead.
_SSL_CERT_ENV = { 'SSL_CERT_FILE':'/usr/local/share/grpc/roots.pem' }
_SKIP_COMPRESSION = ['large_compressed_unary',
'server_compressed_streaming']
_SKIP_ADVANCED = ['custom_metadata', 'status_code_and_message',
'unimplemented_method']
class CXXLanguage:
@ -73,7 +85,10 @@ class CXXLanguage:
return {}
def unimplemented_test_cases(self):
return []
return _SKIP_ADVANCED + _SKIP_COMPRESSION
def unimplemented_test_cases_server(self):
return _SKIP_ADVANCED + _SKIP_COMPRESSION
def __str__(self):
return 'c++'
@ -99,7 +114,11 @@ class CSharpLanguage:
return {}
def unimplemented_test_cases(self):
return []
# TODO: status_code_and_message doesn't work against node_server
return _SKIP_COMPRESSION + ['status_code_and_message']
def unimplemented_test_cases_server(self):
return _SKIP_COMPRESSION
def __str__(self):
return 'csharp'
@ -125,7 +144,10 @@ class JavaLanguage:
return {}
def unimplemented_test_cases(self):
return []
return _SKIP_ADVANCED + _SKIP_COMPRESSION
def unimplemented_test_cases_server(self):
return _SKIP_ADVANCED + _SKIP_COMPRESSION
def __str__(self):
return 'java'
@ -152,7 +174,10 @@ class GoLanguage:
return {}
def unimplemented_test_cases(self):
return []
return _SKIP_ADVANCED + _SKIP_COMPRESSION
def unimplemented_test_cases_server(self):
return _SKIP_ADVANCED + _SKIP_COMPRESSION
def __str__(self):
return 'go'
@ -180,6 +205,9 @@ class Http2Client:
def unimplemented_test_cases(self):
return _TEST_CASES
def unimplemented_test_cases_server(self):
return []
def __str__(self):
return 'http2'
@ -203,7 +231,10 @@ class NodeLanguage:
return {}
def unimplemented_test_cases(self):
return []
return _SKIP_COMPRESSION
def unimplemented_test_cases_server(self):
return _SKIP_COMPRESSION
def __str__(self):
return 'node'
@ -225,6 +256,9 @@ class PHPLanguage:
return {}
def unimplemented_test_cases(self):
return _SKIP_ADVANCED + _SKIP_COMPRESSION
def unimplemented_test_cases_server(self):
return []
def __str__(self):
@ -251,7 +285,10 @@ class RubyLanguage:
return {}
def unimplemented_test_cases(self):
return []
return _SKIP_ADVANCED + _SKIP_COMPRESSION
def unimplemented_test_cases_server(self):
return _SKIP_ADVANCED + _SKIP_COMPRESSION
def __str__(self):
return 'ruby'
@ -289,7 +326,11 @@ class PythonLanguage:
return {'LD_LIBRARY_PATH': '{}/libs/opt'.format(DOCKER_WORKDIR_ROOT)}
def unimplemented_test_cases(self):
return ['jwt_token_creds', 'per_rpc_creds']
return _SKIP_ADVANCED + _SKIP_COMPRESSION + ['jwt_token_creds',
'per_rpc_creds']
def unimplemented_test_cases_server(self):
return _SKIP_ADVANCED + _SKIP_COMPRESSION
def __str__(self):
return 'python'
@ -312,7 +353,9 @@ _SERVERS = ['c++', 'node', 'csharp', 'java', 'go', 'ruby', 'python']
_TEST_CASES = ['large_unary', 'empty_unary', 'ping_pong',
'empty_stream', 'client_streaming', 'server_streaming',
'cancel_after_begin', 'cancel_after_first_response',
'timeout_on_sleeping_server']
'timeout_on_sleeping_server', 'custom_metadata',
'status_code_and_message', 'unimplemented_method',
'large_compressed_unary', 'server_compressed_streaming']
_AUTH_TEST_CASES = ['compute_engine_creds', 'jwt_token_creds',
'oauth2_auth_token', 'per_rpc_creds']
@ -513,6 +556,33 @@ def build_interop_image_jobspec(language, tag=None):
return build_job
def aggregate_http2_results(stdout):
match = re.search(r'\{"cases[^\]]*\]\}', stdout)
if not match:
return None
results = json.loads(match.group(0))
skipped = 0
passed = 0
failed = 0
failed_cases = []
for case in results['cases']:
if case.get('skipped', False):
skipped += 1
else:
if case.get('passed', False):
passed += 1
else:
failed += 1
failed_cases.append(case.get('name', "NONAME"))
return {
'passed': passed,
'failed': failed,
'skipped': skipped,
'failed_cases': ', '.join(failed_cases),
'percent': 1.0 * passed / (passed + failed)
}
argp = argparse.ArgumentParser(description='Run interop tests.')
argp.add_argument('-l', '--language',
choices=['all'] + sorted(_LANGUAGES),
@ -635,13 +705,12 @@ try:
for language in languages:
for test_case in _TEST_CASES:
if not test_case in language.unimplemented_test_cases():
test_job = cloud_to_prod_jobspec(language, test_case,
docker_image=docker_images.get(str(language)))
jobs.append(test_job)
if not test_case in _SKIP_ADVANCED + _SKIP_COMPRESSION:
test_job = cloud_to_prod_jobspec(language, test_case,
docker_image=docker_images.get(str(language)))
jobs.append(test_job)
# TODO(carl-mastrangelo): Currently prod TLS terminators aren't spec compliant. Reenable
# this once a better solution is in place.
if args.http2_interop and False:
if args.http2_interop:
for test_case in _HTTP2_TEST_CASES:
test_job = cloud_to_prod_jobspec(http2Interop, test_case,
docker_image=docker_images.get(str(http2Interop)))
@ -664,16 +733,21 @@ try:
for server_name, server_address in server_addresses.iteritems():
(server_host, server_port) = server_address
server_language = _LANGUAGES.get(server_name, None)
skip_server = [] # test cases unimplemented by server
if server_language:
skip_server = server_language.unimplemented_test_cases_server()
for language in languages:
for test_case in _TEST_CASES:
if not test_case in language.unimplemented_test_cases():
test_job = cloud_to_cloud_jobspec(language,
test_case,
server_name,
server_host,
server_port,
docker_image=docker_images.get(str(language)))
jobs.append(test_job)
if not test_case in skip_server:
test_job = cloud_to_cloud_jobspec(language,
test_case,
server_name,
server_host,
server_port,
docker_image=docker_images.get(str(language)))
jobs.append(test_job)
if args.http2_interop:
for test_case in _HTTP2_TEST_CASES:
@ -703,6 +777,10 @@ try:
report_utils.render_junit_xml_report(resultset, 'report.xml')
for name, job in resultset.iteritems():
if "http2" in name:
job[0].http2results = aggregate_http2_results(job[0].message)
report_utils.render_interop_html_report(
set([str(l) for l in languages]), servers, _TEST_CASES, _AUTH_TEST_CASES,
_HTTP2_TEST_CASES, resultset, num_failures,

@ -152,7 +152,10 @@ class CLanguage(object):
else:
binary = 'bins/%s/%s' % (config.build_config, target['name'])
if os.path.isfile(binary):
out.append(config.job_spec([binary], [binary]))
out.append(config.job_spec([binary], [binary],
environ={'GRPC_DEFAULT_SSL_ROOTS_FILE_PATH':
os.path.abspath(os.path.dirname(
sys.argv[0]) + '/../../src/core/tsi/test_creds/ca.pem')}))
elif args.regex == '.*' or platform_string() == 'windows':
print '\nWARNING: binary not found, skipping', binary
return sorted(out)
@ -192,6 +195,7 @@ class CLanguage(object):
def __str__(self):
return self.make_target
class NodeLanguage(object):
def test_specs(self, config, args):
@ -508,6 +512,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 +613,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 +687,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 +705,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 +904,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 +912,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 +992,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 +1005,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:

@ -742,6 +742,20 @@
"test/core/httpcli/httpcli_test.c"
]
},
{
"deps": [
"gpr",
"gpr_test_util",
"grpc",
"grpc_test_util"
],
"headers": [],
"language": "c",
"name": "httpscli_test",
"src": [
"test/core/httpcli/httpscli_test.c"
]
},
{
"deps": [
"gpr",
@ -934,6 +948,20 @@
"test/core/security/secure_endpoint_test.c"
]
},
{
"deps": [
"gpr",
"gpr_test_util",
"grpc",
"grpc_test_util"
],
"headers": [],
"language": "c",
"name": "server_chttp2_test",
"src": [
"test/core/surface/server_chttp2_test.c"
]
},
{
"deps": [
"gpr",
@ -1075,6 +1103,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",
@ -14473,7 +14515,6 @@
"src/core/channel/context.h",
"src/core/channel/http_client_filter.h",
"src/core/channel/http_server_filter.h",
"src/core/channel/noop_filter.h",
"src/core/channel/subchannel_call_holder.h",
"src/core/client_config/client_config.h",
"src/core/client_config/connector.h",
@ -14628,8 +14669,6 @@
"src/core/channel/http_client_filter.h",
"src/core/channel/http_server_filter.c",
"src/core/channel/http_server_filter.h",
"src/core/channel/noop_filter.c",
"src/core/channel/noop_filter.h",
"src/core/channel/subchannel_call_holder.c",
"src/core/channel/subchannel_call_holder.h",
"src/core/client_config/client_config.c",
@ -14985,7 +15024,6 @@
"src/core/channel/context.h",
"src/core/channel/http_client_filter.h",
"src/core/channel/http_server_filter.h",
"src/core/channel/noop_filter.h",
"src/core/channel/subchannel_call_holder.h",
"src/core/client_config/client_config.h",
"src/core/client_config/connector.h",
@ -15126,8 +15164,6 @@
"src/core/channel/http_client_filter.h",
"src/core/channel/http_server_filter.c",
"src/core/channel/http_server_filter.h",
"src/core/channel/noop_filter.c",
"src/core/channel/noop_filter.h",
"src/core/channel/subchannel_call_holder.c",
"src/core/channel/subchannel_call_holder.h",
"src/core/client_config/client_config.c",

@ -851,6 +851,18 @@
"posix"
]
},
{
"ci_platforms": [
"linux"
],
"exclude_configs": [],
"flaky": false,
"language": "c",
"name": "httpscli_test",
"platforms": [
"linux"
]
},
{
"ci_platforms": [
"linux",
@ -1067,6 +1079,24 @@
"windows"
]
},
{
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"exclude_configs": [],
"flaky": false,
"language": "c",
"name": "server_chttp2_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
]
},
{
"ci_platforms": [
"linux",
@ -1241,6 +1271,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

@ -1769,6 +1769,17 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "secure_endpoint_test", "vcx
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "server_chttp2_test", "vcxproj\test\server_chttp2_test\server_chttp2_test.vcxproj", "{BF9F909B-8266-6AAC-A81B-05F8210AA8CA}"
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}") = "set_initial_connect_string_test", "vcxproj\test\set_initial_connect_string_test\set_initial_connect_string_test.vcxproj", "{4A48E5A5-2E69-ED6D-063C-C297180A54D0}"
ProjectSection(myProperties) = preProject
lib = "False"
@ -1847,6 +1858,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"
@ -12722,6 +12744,22 @@ Global
{A7747106-A6BC-62D4-2A21-04A4F0CC2683}.Release-DLL|Win32.Build.0 = Release|Win32
{A7747106-A6BC-62D4-2A21-04A4F0CC2683}.Release-DLL|x64.ActiveCfg = Release|x64
{A7747106-A6BC-62D4-2A21-04A4F0CC2683}.Release-DLL|x64.Build.0 = Release|x64
{BF9F909B-8266-6AAC-A81B-05F8210AA8CA}.Debug|Win32.ActiveCfg = Debug|Win32
{BF9F909B-8266-6AAC-A81B-05F8210AA8CA}.Debug|x64.ActiveCfg = Debug|x64
{BF9F909B-8266-6AAC-A81B-05F8210AA8CA}.Release|Win32.ActiveCfg = Release|Win32
{BF9F909B-8266-6AAC-A81B-05F8210AA8CA}.Release|x64.ActiveCfg = Release|x64
{BF9F909B-8266-6AAC-A81B-05F8210AA8CA}.Debug|Win32.Build.0 = Debug|Win32
{BF9F909B-8266-6AAC-A81B-05F8210AA8CA}.Debug|x64.Build.0 = Debug|x64
{BF9F909B-8266-6AAC-A81B-05F8210AA8CA}.Release|Win32.Build.0 = Release|Win32
{BF9F909B-8266-6AAC-A81B-05F8210AA8CA}.Release|x64.Build.0 = Release|x64
{BF9F909B-8266-6AAC-A81B-05F8210AA8CA}.Debug-DLL|Win32.ActiveCfg = Debug|Win32
{BF9F909B-8266-6AAC-A81B-05F8210AA8CA}.Debug-DLL|Win32.Build.0 = Debug|Win32
{BF9F909B-8266-6AAC-A81B-05F8210AA8CA}.Debug-DLL|x64.ActiveCfg = Debug|x64
{BF9F909B-8266-6AAC-A81B-05F8210AA8CA}.Debug-DLL|x64.Build.0 = Debug|x64
{BF9F909B-8266-6AAC-A81B-05F8210AA8CA}.Release-DLL|Win32.ActiveCfg = Release|Win32
{BF9F909B-8266-6AAC-A81B-05F8210AA8CA}.Release-DLL|Win32.Build.0 = Release|Win32
{BF9F909B-8266-6AAC-A81B-05F8210AA8CA}.Release-DLL|x64.ActiveCfg = Release|x64
{BF9F909B-8266-6AAC-A81B-05F8210AA8CA}.Release-DLL|x64.Build.0 = Release|x64
{4A48E5A5-2E69-ED6D-063C-C297180A54D0}.Debug|Win32.ActiveCfg = Debug|Win32
{4A48E5A5-2E69-ED6D-063C-C297180A54D0}.Debug|x64.ActiveCfg = Debug|x64
{4A48E5A5-2E69-ED6D-063C-C297180A54D0}.Release|Win32.ActiveCfg = Release|Win32
@ -12834,6 +12872,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

@ -276,7 +276,6 @@
<ClInclude Include="..\..\..\src\core\channel\context.h" />
<ClInclude Include="..\..\..\src\core\channel\http_client_filter.h" />
<ClInclude Include="..\..\..\src\core\channel\http_server_filter.h" />
<ClInclude Include="..\..\..\src\core\channel\noop_filter.h" />
<ClInclude Include="..\..\..\src\core\channel\subchannel_call_holder.h" />
<ClInclude Include="..\..\..\src\core\client_config\client_config.h" />
<ClInclude Include="..\..\..\src\core\client_config\connector.h" />
@ -447,8 +446,6 @@
</ClCompile>
<ClCompile Include="..\..\..\src\core\channel\http_server_filter.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\channel\noop_filter.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\channel\subchannel_call_holder.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\client_config\client_config.c">

@ -94,9 +94,6 @@
<ClCompile Include="..\..\..\src\core\channel\http_server_filter.c">
<Filter>src\core\channel</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\core\channel\noop_filter.c">
<Filter>src\core\channel</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\core\channel\subchannel_call_holder.c">
<Filter>src\core\channel</Filter>
</ClCompile>
@ -545,9 +542,6 @@
<ClInclude Include="..\..\..\src\core\channel\http_server_filter.h">
<Filter>src\core\channel</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\channel\noop_filter.h">
<Filter>src\core\channel</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\channel\subchannel_call_holder.h">
<Filter>src\core\channel</Filter>
</ClInclude>

@ -255,7 +255,6 @@
<ClInclude Include="..\..\..\src\core\channel\context.h" />
<ClInclude Include="..\..\..\src\core\channel\http_client_filter.h" />
<ClInclude Include="..\..\..\src\core\channel\http_server_filter.h" />
<ClInclude Include="..\..\..\src\core\channel\noop_filter.h" />
<ClInclude Include="..\..\..\src\core\channel\subchannel_call_holder.h" />
<ClInclude Include="..\..\..\src\core\client_config\client_config.h" />
<ClInclude Include="..\..\..\src\core\client_config\connector.h" />
@ -386,8 +385,6 @@
</ClCompile>
<ClCompile Include="..\..\..\src\core\channel\http_server_filter.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\channel\noop_filter.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\channel\subchannel_call_holder.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\client_config\client_config.c">

@ -34,9 +34,6 @@
<ClCompile Include="..\..\..\src\core\channel\http_server_filter.c">
<Filter>src\core\channel</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\core\channel\noop_filter.c">
<Filter>src\core\channel</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\core\channel\subchannel_call_holder.c">
<Filter>src\core\channel</Filter>
</ClCompile>
@ -443,9 +440,6 @@
<ClInclude Include="..\..\..\src\core\channel\http_server_filter.h">
<Filter>src\core\channel</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\channel\noop_filter.h">
<Filter>src\core\channel</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\channel\subchannel_call_holder.h">
<Filter>src\core\channel</Filter>
</ClInclude>

@ -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>{BF9F909B-8266-6AAC-A81B-05F8210AA8CA}</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>server_chttp2_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>server_chttp2_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\surface\server_chttp2_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\surface\server_chttp2_test.c">
<Filter>test\core\surface</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="test">
<UniqueIdentifier>{95a6b4b6-b1fb-3c20-945d-ec3dbde1b334}</UniqueIdentifier>
</Filter>
<Filter Include="test\core">
<UniqueIdentifier>{c0e66b85-9758-a554-2a83-be1a4ee1e27e}</UniqueIdentifier>
</Filter>
<Filter Include="test\core\surface">
<UniqueIdentifier>{621e8242-2bcf-70e0-9db0-2c27907e925c}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>

@ -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