aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-10-12 13:18:56 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-10-12 13:18:56 -0700
commitfb324c4d39442d6c7120229880b15bd2fbde5b90 (patch)
tree038a8e1584257d363a04adcff218fd7484631e18 /test
parent7f6b0e7d7ad270074d8662c753f2bffe6762061c (diff)
parent9381c00857d0acc4fc034937260f32ee26e836b9 (diff)
Merge branch 'direct-calls' into buffer_pools_for_realsies
Diffstat (limited to 'test')
-rw-r--r--test/core/iomgr/tcp_server_posix_test.c3
-rw-r--r--test/core/iomgr/udp_server_test.c10
-rw-r--r--test/core/security/credentials_test.c31
-rwxr-xr-xtest/distrib/cpp/run_distrib_test.sh7
4 files changed, 42 insertions, 9 deletions
diff --git a/test/core/iomgr/tcp_server_posix_test.c b/test/core/iomgr/tcp_server_posix_test.c
index f747dbc6e3..6d712b7c20 100644
--- a/test/core/iomgr/tcp_server_posix_test.c
+++ b/test/core/iomgr/tcp_server_posix_test.c
@@ -319,11 +319,10 @@ static void test_connect(unsigned n) {
GPR_ASSERT(grpc_tcp_server_port_fd(s, 0, 0) >= 0);
grpc_tcp_server_unref(&exec_ctx, s);
+ grpc_exec_ctx_finish(&exec_ctx);
/* Weak ref lost. */
GPR_ASSERT(weak_ref.server == NULL);
-
- grpc_exec_ctx_finish(&exec_ctx);
}
static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p,
diff --git a/test/core/iomgr/udp_server_test.c b/test/core/iomgr/udp_server_test.c
index 2a30427504..71d2fb5bd4 100644
--- a/test/core/iomgr/udp_server_test.c
+++ b/test/core/iomgr/udp_server_test.c
@@ -131,8 +131,9 @@ static void test_no_op_with_port_and_start(void) {
grpc_udp_server_destroy(&exec_ctx, s, NULL);
grpc_exec_ctx_finish(&exec_ctx);
- /* The server had a single FD, which should have been orphaned. */
- GPR_ASSERT(g_number_of_orphan_calls == 1);
+ /* The server had a single FD, which is orphaned once in *
+ * deactivated_all_ports, and once in grpc_udp_server_destroy. */
+ GPR_ASSERT(g_number_of_orphan_calls == 2);
}
static void test_receive(int number_of_clients) {
@@ -196,8 +197,9 @@ static void test_receive(int number_of_clients) {
grpc_udp_server_destroy(&exec_ctx, s, NULL);
grpc_exec_ctx_finish(&exec_ctx);
- /* The server had a single FD, which should have been orphaned. */
- GPR_ASSERT(g_number_of_orphan_calls == 1);
+ /* The server had a single FD, which is orphaned once in *
+ * deactivated_all_ports, and once in grpc_udp_server_destroy. */
+ GPR_ASSERT(g_number_of_orphan_calls == 2);
}
static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p,
diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c
index 7043953154..2f8ffe4da6 100644
--- a/test/core/security/credentials_test.c
+++ b/test/core/security/credentials_test.c
@@ -46,6 +46,7 @@
#include "src/core/lib/http/httpcli.h"
#include "src/core/lib/security/credentials/composite/composite_credentials.h"
+#include "src/core/lib/security/credentials/fake/fake_credentials.h"
#include "src/core/lib/security/credentials/google_default/google_default_credentials.h"
#include "src/core/lib/security/credentials/jwt/jwt_credentials.h"
#include "src/core/lib/security/credentials/oauth2/oauth2_credentials.h"
@@ -411,7 +412,7 @@ static grpc_security_status check_channel_oauth2_create_security_connector(
static void test_channel_oauth2_composite_creds(void) {
grpc_channel_args *new_args;
grpc_channel_credentials_vtable vtable = {
- NULL, check_channel_oauth2_create_security_connector};
+ NULL, check_channel_oauth2_create_security_connector, NULL};
grpc_channel_credentials *channel_creds =
grpc_mock_channel_credentials_create(&vtable);
grpc_call_credentials *oauth2_creds =
@@ -495,7 +496,7 @@ check_channel_oauth2_google_iam_create_security_connector(
static void test_channel_oauth2_google_iam_composite_creds(void) {
grpc_channel_args *new_args;
grpc_channel_credentials_vtable vtable = {
- NULL, check_channel_oauth2_google_iam_create_security_connector};
+ NULL, check_channel_oauth2_google_iam_create_security_connector, NULL};
grpc_channel_credentials *channel_creds =
grpc_mock_channel_credentials_create(&vtable);
grpc_call_credentials *oauth2_creds =
@@ -1148,6 +1149,31 @@ static void test_get_well_known_google_credentials_file_path(void) {
#endif
}
+static void test_channel_creds_duplicate_without_call_creds(void) {
+ grpc_channel_credentials *channel_creds =
+ grpc_fake_transport_security_credentials_create();
+
+ grpc_channel_credentials *dup =
+ grpc_channel_credentials_duplicate_without_call_credentials(
+ channel_creds);
+ GPR_ASSERT(dup == channel_creds);
+ grpc_channel_credentials_unref(dup);
+
+ grpc_call_credentials *call_creds =
+ grpc_access_token_credentials_create("blah", NULL);
+ grpc_channel_credentials *composite_creds =
+ grpc_composite_channel_credentials_create(channel_creds, call_creds,
+ NULL);
+ grpc_call_credentials_unref(call_creds);
+ dup = grpc_channel_credentials_duplicate_without_call_credentials(
+ composite_creds);
+ GPR_ASSERT(dup == channel_creds);
+ grpc_channel_credentials_unref(dup);
+
+ grpc_channel_credentials_unref(channel_creds);
+ grpc_channel_credentials_unref(composite_creds);
+}
+
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_init();
@@ -1182,6 +1208,7 @@ int main(int argc, char **argv) {
test_metadata_plugin_success();
test_metadata_plugin_failure();
test_get_well_known_google_credentials_file_path();
+ test_channel_creds_duplicate_without_call_creds();
grpc_shutdown();
return 0;
}
diff --git a/test/distrib/cpp/run_distrib_test.sh b/test/distrib/cpp/run_distrib_test.sh
index bc84b84b8f..15fbf28107 100755
--- a/test/distrib/cpp/run_distrib_test.sh
+++ b/test/distrib/cpp/run_distrib_test.sh
@@ -30,7 +30,12 @@
set -ex
-git clone --recursive $EXTERNAL_GIT_ROOT
+git clone $EXTERNAL_GIT_ROOT
+# clone gRPC submodules, use data from locally cloned submodules where possible
+(cd ${EXTERNAL_GIT_ROOT} && git submodule foreach 'cd /var/local/git/grpc \
+&& git submodule update --init --reference ${EXTERNAL_GIT_ROOT}/${name} \
+${name}')
+
cd grpc
cd third_party/protobuf && ./autogen.sh && \