mirror of https://github.com/grpc/grpc.git
commit
fc966ecb99
932 changed files with 18124 additions and 6982 deletions
@ -0,0 +1,312 @@ |
||||
/*
|
||||
* |
||||
* 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 "rb_call_credentials.h" |
||||
|
||||
#include <ruby/ruby.h> |
||||
#include <ruby/thread.h> |
||||
|
||||
#include <grpc/grpc.h> |
||||
#include <grpc/grpc_security.h> |
||||
|
||||
#include "rb_call.h" |
||||
#include "rb_grpc.h" |
||||
|
||||
/* grpc_rb_cCallCredentials is the ruby class that proxies
|
||||
* grpc_call_credentials */ |
||||
static VALUE grpc_rb_cCallCredentials = Qnil; |
||||
|
||||
/* grpc_rb_call_credentials wraps a grpc_call_credentials. It provides a peer
|
||||
* ruby object, 'mark' to minimize copying when a credential is created from |
||||
* ruby. */ |
||||
typedef struct grpc_rb_call_credentials { |
||||
/* Holder of ruby objects involved in contructing the credentials */ |
||||
VALUE mark; |
||||
|
||||
/* The actual credentials */ |
||||
grpc_call_credentials *wrapped; |
||||
} grpc_rb_call_credentials; |
||||
|
||||
typedef struct callback_params { |
||||
VALUE get_metadata; |
||||
grpc_auth_metadata_context context; |
||||
void *user_data; |
||||
grpc_credentials_plugin_metadata_cb callback; |
||||
} callback_params; |
||||
|
||||
static VALUE grpc_rb_call_credentials_callback(VALUE callback_args) { |
||||
VALUE result = rb_hash_new(); |
||||
VALUE metadata = rb_funcall(rb_ary_entry(callback_args, 0), rb_intern("call"), |
||||
1, rb_ary_entry(callback_args, 1)); |
||||
rb_hash_aset(result, rb_str_new2("metadata"), metadata); |
||||
rb_hash_aset(result, rb_str_new2("status"), INT2NUM(GRPC_STATUS_OK)); |
||||
rb_hash_aset(result, rb_str_new2("details"), rb_str_new2("")); |
||||
return result; |
||||
} |
||||
|
||||
static VALUE grpc_rb_call_credentials_callback_rescue(VALUE args, |
||||
VALUE exception_object) { |
||||
VALUE result = rb_hash_new(); |
||||
rb_hash_aset(result, rb_str_new2("metadata"), Qnil); |
||||
/* Currently only gives the exception class name. It should be possible get
|
||||
more details */ |
||||
rb_hash_aset(result, rb_str_new2("status"), |
||||
INT2NUM(GRPC_STATUS_PERMISSION_DENIED)); |
||||
rb_hash_aset(result, rb_str_new2("details"), |
||||
rb_str_new2(rb_obj_classname(exception_object))); |
||||
return result; |
||||
} |
||||
|
||||
static void *grpc_rb_call_credentials_callback_with_gil(void *param) { |
||||
callback_params *const params = (callback_params *)param; |
||||
VALUE auth_uri = rb_str_new_cstr(params->context.service_url); |
||||
/* Pass the arguments to the proc in a hash, which currently only has they key
|
||||
'auth_uri' */ |
||||
VALUE callback_args = rb_ary_new(); |
||||
VALUE args = rb_hash_new(); |
||||
VALUE result; |
||||
grpc_metadata_array md_ary; |
||||
grpc_status_code status; |
||||
VALUE details; |
||||
char *error_details; |
||||
grpc_metadata_array_init(&md_ary); |
||||
rb_hash_aset(args, ID2SYM(rb_intern("jwt_aud_uri")), auth_uri); |
||||
rb_ary_push(callback_args, params->get_metadata); |
||||
rb_ary_push(callback_args, args); |
||||
result = rb_rescue(grpc_rb_call_credentials_callback, callback_args, |
||||
grpc_rb_call_credentials_callback_rescue, Qnil); |
||||
// Both callbacks return a hash, so result should be a hash
|
||||
grpc_rb_md_ary_convert(rb_hash_aref(result, rb_str_new2("metadata")), &md_ary); |
||||
status = NUM2INT(rb_hash_aref(result, rb_str_new2("status"))); |
||||
details = rb_hash_aref(result, rb_str_new2("details")); |
||||
error_details = StringValueCStr(details); |
||||
params->callback(params->user_data, md_ary.metadata, md_ary.count, status, |
||||
error_details); |
||||
grpc_metadata_array_destroy(&md_ary); |
||||
|
||||
return NULL; |
||||
} |
||||
|
||||
static void grpc_rb_call_credentials_plugin_get_metadata( |
||||
void *state, grpc_auth_metadata_context context, |
||||
grpc_credentials_plugin_metadata_cb cb, void *user_data) { |
||||
callback_params params; |
||||
params.get_metadata = (VALUE)state; |
||||
params.context = context; |
||||
params.user_data = user_data; |
||||
params.callback = cb; |
||||
|
||||
rb_thread_call_with_gvl(grpc_rb_call_credentials_callback_with_gil, |
||||
(void*)(¶ms)); |
||||
} |
||||
|
||||
static void grpc_rb_call_credentials_plugin_destroy(void *state) { |
||||
// Not sure what needs to be done here
|
||||
} |
||||
|
||||
/* Destroys the credentials instances. */ |
||||
static void grpc_rb_call_credentials_free(void *p) { |
||||
grpc_rb_call_credentials *wrapper; |
||||
if (p == NULL) { |
||||
return; |
||||
} |
||||
wrapper = (grpc_rb_call_credentials *)p; |
||||
|
||||
/* Delete the wrapped object if the mark object is Qnil, which indicates that
|
||||
* no other object is the actual owner. */ |
||||
if (wrapper->wrapped != NULL && wrapper->mark == Qnil) { |
||||
grpc_call_credentials_release(wrapper->wrapped); |
||||
wrapper->wrapped = NULL; |
||||
} |
||||
|
||||
xfree(p); |
||||
} |
||||
|
||||
/* Protects the mark object from GC */ |
||||
static void grpc_rb_call_credentials_mark(void *p) { |
||||
grpc_rb_call_credentials *wrapper = NULL; |
||||
if (p == NULL) { |
||||
return; |
||||
} |
||||
wrapper = (grpc_rb_call_credentials *)p; |
||||
|
||||
/* If it's not already cleaned up, mark the mark object */ |
||||
if (wrapper->mark != Qnil) { |
||||
rb_gc_mark(wrapper->mark); |
||||
} |
||||
} |
||||
|
||||
static rb_data_type_t grpc_rb_call_credentials_data_type = { |
||||
"grpc_call_credentials", |
||||
{grpc_rb_call_credentials_mark, grpc_rb_call_credentials_free, |
||||
GRPC_RB_MEMSIZE_UNAVAILABLE, {NULL, NULL}}, |
||||
NULL, |
||||
NULL, |
||||
#ifdef RUBY_TYPED_FREE_IMMEDIATELY |
||||
RUBY_TYPED_FREE_IMMEDIATELY |
||||
#endif |
||||
}; |
||||
|
||||
/* Allocates CallCredentials instances.
|
||||
Provides safe initial defaults for the instance fields. */ |
||||
static VALUE grpc_rb_call_credentials_alloc(VALUE cls) { |
||||
grpc_rb_call_credentials *wrapper = ALLOC(grpc_rb_call_credentials); |
||||
wrapper->wrapped = NULL; |
||||
wrapper->mark = Qnil; |
||||
return TypedData_Wrap_Struct(cls, &grpc_rb_call_credentials_data_type, wrapper); |
||||
} |
||||
|
||||
/* Creates a wrapping object for a given call credentials. This should only be
|
||||
* called with grpc_call_credentials objects that are not already associated |
||||
* with any Ruby object */ |
||||
VALUE grpc_rb_wrap_call_credentials(grpc_call_credentials *c) { |
||||
VALUE rb_wrapper; |
||||
grpc_rb_call_credentials *wrapper; |
||||
if (c == NULL) { |
||||
return Qnil; |
||||
} |
||||
rb_wrapper = grpc_rb_call_credentials_alloc(grpc_rb_cCallCredentials); |
||||
TypedData_Get_Struct(rb_wrapper, grpc_rb_call_credentials, |
||||
&grpc_rb_call_credentials_data_type, wrapper); |
||||
wrapper->wrapped = c; |
||||
return rb_wrapper; |
||||
} |
||||
|
||||
/* Clones CallCredentials instances.
|
||||
Gives CallCredentials a consistent implementation of Ruby's object copy/dup |
||||
protocol. */ |
||||
static VALUE grpc_rb_call_credentials_init_copy(VALUE copy, VALUE orig) { |
||||
grpc_rb_call_credentials *orig_cred = NULL; |
||||
grpc_rb_call_credentials *copy_cred = NULL; |
||||
|
||||
if (copy == orig) { |
||||
return copy; |
||||
} |
||||
|
||||
/* Raise an error if orig is not a credentials object or a subclass. */ |
||||
if (TYPE(orig) != T_DATA || |
||||
RDATA(orig)->dfree != (RUBY_DATA_FUNC)grpc_rb_call_credentials_free) { |
||||
rb_raise(rb_eTypeError, "not a %s", |
||||
rb_obj_classname(grpc_rb_cCallCredentials)); |
||||
} |
||||
|
||||
TypedData_Get_Struct(orig, grpc_rb_call_credentials, |
||||
&grpc_rb_call_credentials_data_type, orig_cred); |
||||
TypedData_Get_Struct(copy, grpc_rb_call_credentials, |
||||
&grpc_rb_call_credentials_data_type, copy_cred); |
||||
|
||||
/* use ruby's MEMCPY to make a byte-for-byte copy of the credentials
|
||||
* wrapper object. */ |
||||
MEMCPY(copy_cred, orig_cred, grpc_rb_call_credentials, 1); |
||||
return copy; |
||||
} |
||||
|
||||
/* The attribute used on the mark object to hold the callback */ |
||||
static ID id_callback; |
||||
|
||||
/*
|
||||
call-seq: |
||||
creds = Credentials.new auth_proc |
||||
proc: (required) Proc that generates auth metadata |
||||
Initializes CallCredential instances. */ |
||||
static VALUE grpc_rb_call_credentials_init(VALUE self, VALUE proc) { |
||||
grpc_rb_call_credentials *wrapper = NULL; |
||||
grpc_call_credentials *creds = NULL; |
||||
grpc_metadata_credentials_plugin plugin; |
||||
|
||||
TypedData_Get_Struct(self, grpc_rb_call_credentials, |
||||
&grpc_rb_call_credentials_data_type, wrapper); |
||||
|
||||
plugin.get_metadata = grpc_rb_call_credentials_plugin_get_metadata; |
||||
plugin.destroy = grpc_rb_call_credentials_plugin_destroy; |
||||
if (!rb_obj_is_proc(proc)) { |
||||
rb_raise(rb_eTypeError, "Argument to CallCredentials#new must be a proc"); |
||||
return Qnil; |
||||
} |
||||
plugin.state = (void*)proc; |
||||
plugin.type = ""; |
||||
|
||||
creds = grpc_metadata_credentials_create_from_plugin(plugin, NULL); |
||||
if (creds == NULL) { |
||||
rb_raise(rb_eRuntimeError, "could not create a credentials, not sure why"); |
||||
return Qnil; |
||||
} |
||||
|
||||
wrapper->wrapped = creds; |
||||
rb_ivar_set(self, id_callback, proc); |
||||
|
||||
return self; |
||||
} |
||||
|
||||
static VALUE grpc_rb_call_credentials_compose(int argc, VALUE *argv, |
||||
VALUE self) { |
||||
grpc_call_credentials *creds; |
||||
grpc_call_credentials *other; |
||||
if (argc == 0) { |
||||
return self; |
||||
} |
||||
creds = grpc_rb_get_wrapped_call_credentials(self); |
||||
for (int i = 0; i < argc; i++) { |
||||
other = grpc_rb_get_wrapped_call_credentials(argv[i]); |
||||
creds = grpc_composite_call_credentials_create(creds, other, NULL); |
||||
} |
||||
return grpc_rb_wrap_call_credentials(creds); |
||||
} |
||||
|
||||
void Init_grpc_call_credentials() { |
||||
grpc_rb_cCallCredentials = |
||||
rb_define_class_under(grpc_rb_mGrpcCore, "CallCredentials", rb_cObject); |
||||
|
||||
/* Allocates an object managed by the ruby runtime */ |
||||
rb_define_alloc_func(grpc_rb_cCallCredentials, |
||||
grpc_rb_call_credentials_alloc); |
||||
|
||||
/* Provides a ruby constructor and support for dup/clone. */ |
||||
rb_define_method(grpc_rb_cCallCredentials, "initialize", |
||||
grpc_rb_call_credentials_init, 1); |
||||
rb_define_method(grpc_rb_cCallCredentials, "initialize_copy", |
||||
grpc_rb_call_credentials_init_copy, 1); |
||||
rb_define_method(grpc_rb_cCallCredentials, "compose", |
||||
grpc_rb_call_credentials_compose, -1); |
||||
|
||||
id_callback = rb_intern("__callback"); |
||||
} |
||||
|
||||
/* Gets the wrapped grpc_call_credentials from the ruby wrapper */ |
||||
grpc_call_credentials *grpc_rb_get_wrapped_call_credentials(VALUE v) { |
||||
grpc_rb_call_credentials *wrapper = NULL; |
||||
TypedData_Get_Struct(v, grpc_rb_call_credentials, |
||||
&grpc_rb_call_credentials_data_type, |
||||
wrapper); |
||||
return wrapper->wrapped; |
||||
} |
@ -0,0 +1,46 @@ |
||||
/*
|
||||
* |
||||
* 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. |
||||
* |
||||
*/ |
||||
|
||||
#ifndef GRPC_RB_CALL_CREDENTIALS_H_ |
||||
#define GRPC_RB_CALL_CREDENTIALS_H_ |
||||
|
||||
#include <ruby/ruby.h> |
||||
|
||||
#include <grpc/grpc_security.h> |
||||
|
||||
/* Initializes the ruby CallCredentials class. */ |
||||
void Init_grpc_call_credentials(); |
||||
|
||||
grpc_call_credentials* grpc_rb_get_wrapped_call_credentials(VALUE v); |
||||
|
||||
#endif /* GRPC_RB_CALL_CREDENTIALS_H_ */ |
@ -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. |
||||
|
||||
require 'grpc' |
||||
|
||||
describe GRPC::Core::CallCredentials do |
||||
CallCredentials = GRPC::Core::CallCredentials |
||||
|
||||
let(:auth_proc) { proc { { 'plugin_key' => 'plugin_value' } } } |
||||
|
||||
describe '#new' do |
||||
it 'can successfully create a CallCredentials from a proc' do |
||||
expect { CallCredentials.new(auth_proc) }.not_to raise_error |
||||
end |
||||
end |
||||
|
||||
describe '#compose' do |
||||
it 'can compose with another CallCredentials' do |
||||
creds1 = CallCredentials.new(auth_proc) |
||||
creds2 = CallCredentials.new(auth_proc) |
||||
expect { creds1.compose creds2 }.not_to raise_error |
||||
end |
||||
|
||||
it 'can compose with multiple CallCredentials' do |
||||
creds1 = CallCredentials.new(auth_proc) |
||||
creds2 = CallCredentials.new(auth_proc) |
||||
creds3 = CallCredentials.new(auth_proc) |
||||
expect { creds1.compose(creds2, creds3) }.not_to raise_error |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,106 @@ |
||||
/*
|
||||
* |
||||
* 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/client_config/resolvers/dns_resolver.h" |
||||
|
||||
#include <string.h> |
||||
|
||||
#include <grpc/support/log.h> |
||||
|
||||
#include "src/core/client_config/resolver.h" |
||||
#include "test/core/util/test_config.h" |
||||
|
||||
static void subchannel_factory_ref(grpc_subchannel_factory *scv) {} |
||||
static void subchannel_factory_unref(grpc_exec_ctx *exec_ctx,
|
||||
grpc_subchannel_factory *scv) {} |
||||
static grpc_subchannel *subchannel_factory_create_subchannel(grpc_exec_ctx *exec_ctx, |
||||
grpc_subchannel_factory *factory, |
||||
grpc_subchannel_args *args) { |
||||
GPR_UNREACHABLE_CODE(return NULL); |
||||
} |
||||
|
||||
static const grpc_subchannel_factory_vtable sc_vtable = { |
||||
subchannel_factory_ref, |
||||
subchannel_factory_unref, |
||||
subchannel_factory_create_subchannel |
||||
}; |
||||
|
||||
static grpc_subchannel_factory sc_factory = { &sc_vtable }; |
||||
|
||||
static void test_succeeds(grpc_resolver_factory *factory, const char *string) { |
||||
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; |
||||
grpc_uri *uri = grpc_uri_parse(string, 0); |
||||
grpc_resolver_args args; |
||||
grpc_resolver *resolver; |
||||
gpr_log(GPR_DEBUG, "test: '%s' should be valid for '%s'", string, factory->vtable->scheme); |
||||
GPR_ASSERT(uri); |
||||
memset(&args, 0, sizeof(args)); |
||||
args.uri = uri; |
||||
args.subchannel_factory = &sc_factory; |
||||
resolver = grpc_resolver_factory_create_resolver(factory, &args); |
||||
GPR_ASSERT(resolver != NULL); |
||||
GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test_succeeds"); |
||||
grpc_uri_destroy(uri); |
||||
grpc_exec_ctx_finish(&exec_ctx); |
||||
} |
||||
|
||||
static void test_fails(grpc_resolver_factory *factory, const char *string) { |
||||
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; |
||||
grpc_uri *uri = grpc_uri_parse(string, 0); |
||||
grpc_resolver_args args; |
||||
grpc_resolver *resolver; |
||||
gpr_log(GPR_DEBUG, "test: '%s' should be invalid for '%s'", string, factory->vtable->scheme); |
||||
GPR_ASSERT(uri); |
||||
memset(&args, 0, sizeof(args)); |
||||
args.uri = uri; |
||||
resolver = grpc_resolver_factory_create_resolver(factory, &args); |
||||
GPR_ASSERT(resolver == NULL); |
||||
grpc_uri_destroy(uri); |
||||
grpc_exec_ctx_finish(&exec_ctx); |
||||
} |
||||
|
||||
int main(int argc, char **argv) { |
||||
grpc_resolver_factory *dns; |
||||
grpc_test_init(argc, argv); |
||||
|
||||
dns = grpc_dns_resolver_factory_create(); |
||||
|
||||
test_succeeds(dns, "dns:10.2.1.1"); |
||||
test_succeeds(dns, "dns:10.2.1.1:1234"); |
||||
test_succeeds(dns, "ipv4:www.google.com"); |
||||
test_fails(dns, "ipv4://8.8.8.8/8.8.8.8:8888"); |
||||
|
||||
grpc_resolver_factory_unref(dns); |
||||
|
||||
return 0; |
||||
} |
@ -0,0 +1,104 @@ |
||||
/*
|
||||
* |
||||
* 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/compression/algorithm_metadata.h" |
||||
|
||||
#include <stdlib.h> |
||||
#include <string.h> |
||||
|
||||
#include <grpc/grpc.h> |
||||
#include <grpc/support/log.h> |
||||
#include <grpc/support/useful.h> |
||||
|
||||
#include "src/core/transport/static_metadata.h" |
||||
#include "test/core/util/test_config.h" |
||||
|
||||
static void test_algorithm_mesh(void) { |
||||
int i; |
||||
|
||||
gpr_log(GPR_DEBUG, "test_algorithm_mesh"); |
||||
|
||||
for (i = 0; i < GRPC_COMPRESS_ALGORITHMS_COUNT; i++) { |
||||
char *name; |
||||
grpc_compression_algorithm parsed; |
||||
grpc_mdstr *mdstr; |
||||
grpc_mdelem *mdelem; |
||||
GPR_ASSERT( |
||||
grpc_compression_algorithm_name((grpc_compression_algorithm)i, &name)); |
||||
GPR_ASSERT(grpc_compression_algorithm_parse(name, strlen(name), &parsed)); |
||||
GPR_ASSERT((int)parsed == i); |
||||
mdstr = grpc_mdstr_from_string(name); |
||||
GPR_ASSERT(mdstr == grpc_compression_algorithm_mdstr(parsed)); |
||||
GPR_ASSERT(parsed == grpc_compression_algorithm_from_mdstr(mdstr)); |
||||
mdelem = grpc_compression_encoding_mdelem(parsed); |
||||
GPR_ASSERT(mdelem->value == mdstr); |
||||
GPR_ASSERT(mdelem->key == GRPC_MDSTR_GRPC_ENCODING); |
||||
GRPC_MDSTR_UNREF(mdstr); |
||||
GRPC_MDELEM_UNREF(mdelem); |
||||
} |
||||
|
||||
/* test failure */ |
||||
GPR_ASSERT(NULL == |
||||
grpc_compression_encoding_mdelem(GRPC_COMPRESS_ALGORITHMS_COUNT)); |
||||
} |
||||
|
||||
static void test_algorithm_failure(void) { |
||||
grpc_mdstr *mdstr; |
||||
|
||||
gpr_log(GPR_DEBUG, "test_algorithm_failure"); |
||||
|
||||
GPR_ASSERT(grpc_compression_algorithm_name(GRPC_COMPRESS_ALGORITHMS_COUNT, |
||||
NULL) == 0); |
||||
GPR_ASSERT(grpc_compression_algorithm_name(GRPC_COMPRESS_ALGORITHMS_COUNT + 1, |
||||
NULL) == 0); |
||||
mdstr = grpc_mdstr_from_string("this-is-an-invalid-algorithm"); |
||||
GPR_ASSERT(grpc_compression_algorithm_from_mdstr(mdstr) == |
||||
GRPC_COMPRESS_ALGORITHMS_COUNT); |
||||
GPR_ASSERT(grpc_compression_algorithm_mdstr(GRPC_COMPRESS_ALGORITHMS_COUNT) == |
||||
NULL); |
||||
GPR_ASSERT(grpc_compression_algorithm_mdstr(GRPC_COMPRESS_ALGORITHMS_COUNT + |
||||
1) == NULL); |
||||
GRPC_MDSTR_UNREF(mdstr); |
||||
} |
||||
|
||||
int main(int argc, char **argv) { |
||||
grpc_test_init(argc, argv); |
||||
grpc_init(); |
||||
|
||||
test_algorithm_mesh(); |
||||
test_algorithm_failure(); |
||||
|
||||
grpc_shutdown(); |
||||
|
||||
return 0; |
||||
} |
@ -0,0 +1,121 @@ |
||||
/*
|
||||
* |
||||
* 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 "test/core/end2end/end2end_tests.h" |
||||
|
||||
#include <string.h> |
||||
|
||||
#include "src/core/channel/client_channel.h" |
||||
#include "src/core/channel/connected_channel.h" |
||||
#include "src/core/channel/http_server_filter.h" |
||||
#include "src/core/surface/channel.h" |
||||
#include "src/core/surface/server.h" |
||||
#include "src/core/transport/chttp2_transport.h" |
||||
#include <grpc/support/alloc.h> |
||||
#include <grpc/support/host_port.h> |
||||
#include <grpc/support/log.h> |
||||
#include <grpc/support/sync.h> |
||||
#include <grpc/support/thd.h> |
||||
#include <grpc/support/useful.h> |
||||
#include "test/core/util/port.h" |
||||
#include "test/core/util/test_config.h" |
||||
#include "src/core/iomgr/wakeup_fd_posix.h" |
||||
|
||||
|
||||
typedef struct fullstack_fixture_data { |
||||
char *localaddr; |
||||
} fullstack_fixture_data; |
||||
|
||||
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( |
||||
grpc_channel_args *client_args, grpc_channel_args *server_args) { |
||||
grpc_end2end_test_fixture f; |
||||
int port = grpc_pick_unused_port_or_die(); |
||||
fullstack_fixture_data *ffd = gpr_malloc(sizeof(fullstack_fixture_data)); |
||||
memset(&f, 0, sizeof(f)); |
||||
|
||||
gpr_join_host_port(&ffd->localaddr, "localhost", port); |
||||
|
||||
f.fixture_data = ffd; |
||||
f.cq = grpc_completion_queue_create(NULL); |
||||
|
||||
return f; |
||||
} |
||||
|
||||
void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f, |
||||
grpc_channel_args *client_args) { |
||||
fullstack_fixture_data *ffd = f->fixture_data; |
||||
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); |
||||
GPR_ASSERT(f->client); |
||||
} |
||||
|
||||
void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, |
||||
grpc_channel_args *server_args) { |
||||
fullstack_fixture_data *ffd = f->fixture_data; |
||||
if (f->server) { |
||||
grpc_server_destroy(f->server); |
||||
} |
||||
f->server = grpc_server_create(server_args, NULL); |
||||
grpc_server_register_completion_queue(f->server, f->cq, NULL); |
||||
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr)); |
||||
grpc_server_start(f->server); |
||||
} |
||||
|
||||
void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { |
||||
fullstack_fixture_data *ffd = f->fixture_data; |
||||
gpr_free(ffd->localaddr); |
||||
gpr_free(ffd); |
||||
} |
||||
|
||||
/* All test configurations */ |
||||
static grpc_end2end_test_config configs[] = { |
||||
{"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION, |
||||
chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, |
||||
chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, |
||||
}; |
||||
|
||||
int main(int argc, char **argv) { |
||||
size_t i; |
||||
|
||||
grpc_allow_specialized_wakeup_fd = 0; |
||||
|
||||
grpc_test_init(argc, argv); |
||||
grpc_init(); |
||||
|
||||
for (i = 0; i < sizeof(configs) / sizeof(*configs); i++) { |
||||
grpc_end2end_tests(configs[i]); |
||||
} |
||||
|
||||
grpc_shutdown(); |
||||
|
||||
return 0; |
||||
} |
@ -0,0 +1,120 @@ |
||||
/*
|
||||
* |
||||
* 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 "test/core/end2end/end2end_tests.h" |
||||
|
||||
#include <string.h> |
||||
|
||||
#include "src/core/channel/client_channel.h" |
||||
#include "src/core/channel/connected_channel.h" |
||||
#include "src/core/channel/http_server_filter.h" |
||||
#include "src/core/surface/channel.h" |
||||
#include "src/core/surface/server.h" |
||||
#include "src/core/transport/chttp2_transport.h" |
||||
#include <grpc/support/alloc.h> |
||||
#include <grpc/support/host_port.h> |
||||
#include <grpc/support/log.h> |
||||
#include <grpc/support/sync.h> |
||||
#include <grpc/support/thd.h> |
||||
#include <grpc/support/useful.h> |
||||
#include "test/core/util/port.h" |
||||
#include "test/core/util/test_config.h" |
||||
#include "src/core/iomgr/wakeup_fd_posix.h" |
||||
|
||||
typedef struct fullstack_fixture_data { |
||||
char *localaddr; |
||||
} fullstack_fixture_data; |
||||
|
||||
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( |
||||
grpc_channel_args *client_args, grpc_channel_args *server_args) { |
||||
grpc_end2end_test_fixture f; |
||||
int port = grpc_pick_unused_port_or_die(); |
||||
fullstack_fixture_data *ffd = gpr_malloc(sizeof(fullstack_fixture_data)); |
||||
memset(&f, 0, sizeof(f)); |
||||
|
||||
gpr_join_host_port(&ffd->localaddr, "localhost", port); |
||||
|
||||
f.fixture_data = ffd; |
||||
f.cq = grpc_completion_queue_create(NULL); |
||||
|
||||
return f; |
||||
} |
||||
|
||||
void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f, |
||||
grpc_channel_args *client_args) { |
||||
fullstack_fixture_data *ffd = f->fixture_data; |
||||
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); |
||||
} |
||||
|
||||
void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, |
||||
grpc_channel_args *server_args) { |
||||
fullstack_fixture_data *ffd = f->fixture_data; |
||||
if (f->server) { |
||||
grpc_server_destroy(f->server); |
||||
} |
||||
f->server = grpc_server_create(server_args, NULL); |
||||
grpc_server_register_completion_queue(f->server, f->cq, NULL); |
||||
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr)); |
||||
grpc_server_start(f->server); |
||||
} |
||||
|
||||
void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { |
||||
fullstack_fixture_data *ffd = f->fixture_data; |
||||
gpr_free(ffd->localaddr); |
||||
gpr_free(ffd); |
||||
} |
||||
|
||||
/* All test configurations */ |
||||
static grpc_end2end_test_config configs[] = { |
||||
{"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION, |
||||
chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, |
||||
chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, |
||||
}; |
||||
|
||||
int main(int argc, char **argv) { |
||||
size_t i; |
||||
|
||||
grpc_allow_specialized_wakeup_fd = 0; |
||||
grpc_platform_become_multipoller = grpc_poll_become_multipoller; |
||||
|
||||
grpc_test_init(argc, argv); |
||||
grpc_init(); |
||||
|
||||
for (i = 0; i < sizeof(configs) / sizeof(*configs); i++) { |
||||
grpc_end2end_tests(configs[i]); |
||||
} |
||||
|
||||
grpc_shutdown(); |
||||
|
||||
return 0; |
||||
} |
@ -0,0 +1,75 @@ |
||||
/*
|
||||
* |
||||
* 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 <stdio.h> |
||||
#include <stdlib.h> |
||||
|
||||
#include <grpc/support/alloc.h> |
||||
#include <grpc/support/useful.h> |
||||
#include <grpc/support/log.h> |
||||
#include "test/core/util/test_config.h" |
||||
|
||||
#include "src/core/json/json_reader.h" |
||||
#include "src/core/json/json_writer.h" |
||||
|
||||
static int g_string_clear_once = 0; |
||||
|
||||
static void string_clear(void *userdata) { |
||||
GPR_ASSERT(!g_string_clear_once); |
||||
g_string_clear_once = 1; |
||||
} |
||||
|
||||
static gpr_uint32 read_char(void *userdata) { |
||||
return GRPC_JSON_READ_CHAR_ERROR; |
||||
} |
||||
|
||||
static grpc_json_reader_vtable reader_vtable = { |
||||
string_clear, NULL, NULL, read_char, NULL, NULL, |
||||
NULL, NULL, NULL, NULL, NULL, NULL |
||||
}; |
||||
|
||||
static void read_error() { |
||||
grpc_json_reader reader; |
||||
grpc_json_reader_status status; |
||||
grpc_json_reader_init(&reader, &reader_vtable, NULL); |
||||
|
||||
status = grpc_json_reader_run(&reader); |
||||
GPR_ASSERT(status == GRPC_JSON_READ_ERROR); |
||||
} |
||||
|
||||
int main(int argc, char **argv) { |
||||
grpc_test_init(argc, argv); |
||||
read_error(); |
||||
gpr_log(GPR_INFO, "json_stream_error success"); |
||||
return 0; |
||||
} |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,187 @@ |
||||
<?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>{216FDCB2-9D93-0D86-F0F1-12E16312A191}</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="'$(VisualStudioVersion)' == '14.0'" Label="Configuration"> |
||||
<PlatformToolset>v140</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>algorithm_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>algorithm_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;%(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;%(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\compression\algorithm_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\compression\algorithm_test.c"> |
||||
<Filter>test\core\compression</Filter> |
||||
</ClCompile> |
||||
</ItemGroup> |
||||
|
||||
<ItemGroup> |
||||
<Filter Include="test"> |
||||
<UniqueIdentifier>{578848dc-8093-ced0-747d-7506e3daa00a}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="test\core"> |
||||
<UniqueIdentifier>{2428bb9e-2466-0c4c-0bfe-0be54b35d2b7}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="test\core\compression"> |
||||
<UniqueIdentifier>{27e6f7a4-cb96-47a1-9328-614b672c3124}</UniqueIdentifier> |
||||
</Filter> |
||||
</ItemGroup> |
||||
</Project> |
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue