diff options
author | 2015-04-10 22:39:44 +0200 | |
---|---|---|
committer | 2015-04-10 22:39:44 +0200 | |
commit | 7a6d8fde095501016dc98f43299be2facc79f17e (patch) | |
tree | f88972d1f17e78920ee1228dee061878562dd27b /test/core | |
parent | f0863b02270f1b95d5c8b9f3f962959e4cbbdd42 (diff) | |
parent | 046c6656c961bb65508d725edb9adc60f63e3424 (diff) |
Merge branch 'master' of github.com:grpc/grpc into freebsd
Diffstat (limited to 'test/core')
-rw-r--r-- | test/core/end2end/tests/cancel_after_invoke.c | 6 | ||||
-rw-r--r-- | test/core/end2end/tests/cancel_test_helpers.h | 9 | ||||
-rw-r--r-- | test/core/iomgr/tcp_server_posix_test.c | 10 | ||||
-rw-r--r-- | test/core/support/thd_test.c | 11 | ||||
-rw-r--r-- | test/core/tsi/transport_security_test.c | 10 | ||||
-rw-r--r-- | test/core/util/port_posix.c | 7 | ||||
-rw-r--r-- | test/core/util/test_config.h | 4 |
7 files changed, 44 insertions, 13 deletions
diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index e15fa7fcd9..592dfd415f 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -51,10 +51,11 @@ static void *tag(gpr_intptr t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char *test_name, + cancellation_mode mode, grpc_channel_args *client_args, grpc_channel_args *server_args) { grpc_end2end_test_fixture f; - gpr_log(GPR_INFO, "%s/%s", test_name, config.name); + gpr_log(GPR_INFO, "%s/%s/%s", test_name, config.name, mode.name); f = config.create_fixture(client_args, server_args); config.init_client(&f, client_args); config.init_server(&f, server_args); @@ -109,7 +110,8 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, grpc_op ops[6]; grpc_op *op; grpc_call *c; - grpc_end2end_test_fixture f = begin_test(config, __FUNCTION__, NULL, NULL); + grpc_end2end_test_fixture f = + begin_test(config, __FUNCTION__, mode, NULL, NULL); gpr_timespec deadline = five_seconds_time(); cq_verifier *v_client = cq_verifier_create(f.client_cq); grpc_metadata_array initial_metadata_recv; diff --git a/test/core/end2end/tests/cancel_test_helpers.h b/test/core/end2end/tests/cancel_test_helpers.h index f2581dc32f..0d680fcfe1 100644 --- a/test/core/end2end/tests/cancel_test_helpers.h +++ b/test/core/end2end/tests/cancel_test_helpers.h @@ -35,6 +35,7 @@ #define GRPC_TEST_CORE_END2END_TESTS_CANCEL_TEST_HELPERS_H typedef struct { + const char *name; grpc_call_error (*initiate_cancel)(grpc_call *call); grpc_status_code expect_status; const char *expect_details; @@ -45,7 +46,9 @@ static grpc_call_error wait_for_deadline(grpc_call *call) { } static const cancellation_mode cancellation_modes[] = { - {grpc_call_cancel, GRPC_STATUS_CANCELLED, ""}, - {wait_for_deadline, GRPC_STATUS_DEADLINE_EXCEEDED, "Deadline Exceeded"}, }; + {"cancel", grpc_call_cancel, GRPC_STATUS_CANCELLED, ""}, + {"deadline", wait_for_deadline, GRPC_STATUS_DEADLINE_EXCEEDED, + "Deadline Exceeded"}, +}; -#endif /* GRPC_TEST_CORE_END2END_TESTS_CANCEL_TEST_HELPERS_H */ +#endif /* GRPC_TEST_CORE_END2END_TESTS_CANCEL_TEST_HELPERS_H */ diff --git a/test/core/iomgr/tcp_server_posix_test.c b/test/core/iomgr/tcp_server_posix_test.c index 708444a287..1c02c4b2f8 100644 --- a/test/core/iomgr/tcp_server_posix_test.c +++ b/test/core/iomgr/tcp_server_posix_test.c @@ -61,14 +61,14 @@ static void on_connect(void *arg, grpc_endpoint *tcp) { static void test_no_op(void) { grpc_tcp_server *s = grpc_tcp_server_create(); - grpc_tcp_server_destroy(s); + grpc_tcp_server_destroy(s, NULL, NULL); } static void test_no_op_with_start(void) { grpc_tcp_server *s = grpc_tcp_server_create(); LOG_TEST(); grpc_tcp_server_start(s, NULL, 0, on_connect, NULL); - grpc_tcp_server_destroy(s); + grpc_tcp_server_destroy(s, NULL, NULL); } static void test_no_op_with_port(void) { @@ -81,7 +81,7 @@ static void test_no_op_with_port(void) { GPR_ASSERT( grpc_tcp_server_add_port(s, (struct sockaddr *)&addr, sizeof(addr))); - grpc_tcp_server_destroy(s); + grpc_tcp_server_destroy(s, NULL, NULL); } static void test_no_op_with_port_and_start(void) { @@ -96,7 +96,7 @@ static void test_no_op_with_port_and_start(void) { grpc_tcp_server_start(s, NULL, 0, on_connect, NULL); - grpc_tcp_server_destroy(s); + grpc_tcp_server_destroy(s, NULL, NULL); } static void test_connect(int n) { @@ -145,7 +145,7 @@ static void test_connect(int n) { gpr_mu_unlock(&mu); - grpc_tcp_server_destroy(s); + grpc_tcp_server_destroy(s, NULL, NULL); } int main(int argc, char **argv) { diff --git a/test/core/support/thd_test.c b/test/core/support/thd_test.c index c03a905d2a..bb3d54a262 100644 --- a/test/core/support/thd_test.c +++ b/test/core/support/thd_test.c @@ -60,12 +60,16 @@ static void thd_body(void *v) { gpr_mu_unlock(&t->mu); } +static void thd_body_joinable(void *v) { } + /* Test that we can create a number of threads and wait for them. */ static void test(void) { int i; gpr_thd_id thd; + gpr_thd_id thds[1000]; struct test t; int n = 1000; + gpr_thd_options options = gpr_thd_options_default(); gpr_mu_init(&t.mu); gpr_cv_init(&t.done_cv); t.n = n; @@ -79,6 +83,13 @@ static void test(void) { } gpr_mu_unlock(&t.mu); GPR_ASSERT(t.n == 0); + gpr_thd_options_set_joinable(&options); + for (i = 0; i < n; i++) { + GPR_ASSERT(gpr_thd_new(&thds[i], &thd_body_joinable, NULL, &options)); + } + for (i = 0; i < n; i++) { + gpr_thd_join(thds[i]); + } } /* ------------------------------------------------- */ diff --git a/test/core/tsi/transport_security_test.c b/test/core/tsi/transport_security_test.c index c5882af966..d591e43faa 100644 --- a/test/core/tsi/transport_security_test.c +++ b/test/core/tsi/transport_security_test.c @@ -39,10 +39,15 @@ #include <grpc/support/log.h> #include <grpc/support/useful.h> +#include <openssl/crypto.h> + #include "src/core/support/string.h" #include "src/core/tsi/ssl_transport_security.h" #include "test/core/util/test_config.h" +/* Currently points to 1.0.2a. */ +#define GRPC_MIN_OPENSSL_VERSION_NUMBER 0x1000201fL + typedef struct { /* 1 if success, 0 if failure. */ int expected; @@ -296,8 +301,13 @@ static void test_peer_matches_name(void) { } } +static void test_openssl_version(void) { + GPR_ASSERT(OPENSSL_VERSION_NUMBER >= GRPC_MIN_OPENSSL_VERSION_NUMBER); +} + int main(int argc, char **argv) { grpc_test_init(argc, argv); test_peer_matches_name(); + test_openssl_version(); return 0; } diff --git a/test/core/util/port_posix.c b/test/core/util/port_posix.c index 36f13e1b51..7467c2f9ea 100644 --- a/test/core/util/port_posix.c +++ b/test/core/util/port_posix.c @@ -32,7 +32,8 @@ */ #include <grpc/support/port_platform.h> -#ifdef GPR_POSIX_SOCKET +#include "test/core/util/test_config.h" +#if defined(GPR_POSIX_SOCKET) && defined(GRPC_TEST_PICK_PORT) #include "test/core/util/port.h" @@ -125,7 +126,7 @@ int grpc_pick_unused_port(void) { } else { port = 0; } - + if (!is_port_available(&port, is_tcp)) { continue; } @@ -155,4 +156,4 @@ int grpc_pick_unused_port_or_die(void) { return port; } -#endif /* GPR_POSIX_SOCKET */ +#endif /* GPR_POSIX_SOCKET && GRPC_TEST_PICK_PORT */ diff --git a/test/core/util/test_config.h b/test/core/util/test_config.h index 668a069f26..0b3c54373d 100644 --- a/test/core/util/test_config.h +++ b/test/core/util/test_config.h @@ -59,6 +59,10 @@ extern "C" { gpr_time_add(gpr_now(), \ gpr_time_from_micros(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x))) +#ifndef GRPC_TEST_CUSTOM_PICK_PORT +#define GRPC_TEST_PICK_PORT +#endif + void grpc_test_init(int argc, char **argv); #ifdef __cplusplus |