diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2015-05-17 14:28:56 -0700 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-05-17 14:28:56 -0700 |
commit | 0596621ec2b8c79b39fdffa12132b445eea8e49f (patch) | |
tree | 1c666cab69dcd23ea54bbce7d79923321760aa8b /test | |
parent | 83b826aef5631f797f912a5c7570aa1f6b76cabc (diff) | |
parent | 669df902c997cc66abfa7aad21c5abbcc6344ea4 (diff) |
Merge github.com:grpc/grpc into we-dont-need-no-backup
Diffstat (limited to 'test')
-rwxr-xr-x | test/core/end2end/gen_build_json.py | 1 | ||||
-rw-r--r-- | test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c | 7 | ||||
-rw-r--r-- | test/core/fling/fling_test.c | 81 | ||||
-rw-r--r-- | test/core/tsi/transport_security_test.c | 11 |
4 files changed, 36 insertions, 64 deletions
diff --git a/test/core/end2end/gen_build_json.py b/test/core/end2end/gen_build_json.py index 77b929ec18..bce2d7a796 100755 --- a/test/core/end2end/gen_build_json.py +++ b/test/core/end2end/gen_build_json.py @@ -75,6 +75,7 @@ END2END_TESTS = { 'ping_pong_streaming': default_test_options, 'registered_call': default_test_options, 'request_response_with_binary_metadata_and_payload': default_test_options, + 'request_response_with_trailing_metadata_and_payload': default_test_options, 'request_response_with_metadata_and_payload': default_test_options, 'request_response_with_payload': default_test_options, 'request_response_with_payload_and_call_creds': TestOptions(flaky=False, secure=True), diff --git a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c index 1f1cb4cb42..12f289cfdd 100644 --- a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c @@ -164,14 +164,9 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, -<<<<<<< HEAD - f.server_cq, tag(101))); - cq_expect_completion(v_server, tag(101), 1); -======= f.server_cq, f.server_cq, tag(101))); - cq_expect_completion(v_server, tag(101), GRPC_OP_OK); ->>>>>>> a468c36601dd5997580129bbd66b5ebed02521f8 + cq_expect_completion(v_server, tag(101), 1); cq_verify(v_server); op = ops; diff --git a/test/core/fling/fling_test.c b/test/core/fling/fling_test.c index c0066cf101..7c1643df6a 100644 --- a/test/core/fling/fling_test.c +++ b/test/core/fling/fling_test.c @@ -31,20 +31,11 @@ * */ -#ifndef _POSIX_SOURCE -#define _POSIX_SOURCE -#endif - -#include <unistd.h> -#include <assert.h> -#include <stdio.h> #include <string.h> -#include <signal.h> -#include <stdlib.h> -#include <sys/types.h> -#include <sys/wait.h> +#include <stdio.h> #include <grpc/support/alloc.h> +#include <grpc/support/subprocess.h> #include <grpc/support/host_port.h> #include "src/core/support/string.h" #include "test/core/util/port.h" @@ -56,10 +47,7 @@ int main(int argc, char **argv) { int port = grpc_pick_unused_port_or_die(); char *args[10]; int status; - pid_t svr, cli; - /* seed rng with pid, so we don't end up with the same random numbers as a - concurrently running test binary */ - srand(getpid()); + gpr_subprocess *svr, *cli; /* figure out where we are */ if (lslash) { memcpy(root, me, lslash - me); @@ -68,45 +56,36 @@ int main(int argc, char **argv) { strcpy(root, "."); } /* start the server */ - svr = fork(); - if (svr == 0) { - gpr_asprintf(&args[0], "%s/fling_server", root); - args[1] = "--bind"; - gpr_join_host_port(&args[2], "::", port); - args[3] = "--no-secure"; - args[4] = 0; - execv(args[0], args); + gpr_asprintf(&args[0], "%s/fling_server%s", root, gpr_subprocess_binary_extension()); + args[1] = "--bind"; + gpr_join_host_port(&args[2], "::", port); + args[3] = "--no-secure"; + svr = gpr_subprocess_create(4, args); + gpr_free(args[0]); + gpr_free(args[2]); - gpr_free(args[0]); - gpr_free(args[2]); - return 1; - } - /* wait a little */ - sleep(2); /* start the client */ - cli = fork(); - if (cli == 0) { - gpr_asprintf(&args[0], "%s/fling_client", root); - args[1] = "--target"; - gpr_join_host_port(&args[2], "127.0.0.1", port); - args[3] = "--scenario=ping-pong-request"; - args[4] = "--no-secure"; - args[5] = 0; - execv(args[0], args); + gpr_asprintf(&args[0], "%s/fling_client%s", root, gpr_subprocess_binary_extension()); + args[1] = "--target"; + gpr_join_host_port(&args[2], "127.0.0.1", port); + args[3] = "--scenario=ping-pong-request"; + args[4] = "--no-secure"; + args[5] = 0; + cli = gpr_subprocess_create(6, args); + gpr_free(args[0]); + gpr_free(args[2]); - gpr_free(args[0]); - gpr_free(args[2]); - return 1; - } /* wait for completion */ printf("waiting for client\n"); - if (waitpid(cli, &status, 0) == -1) return 2; - if (!WIFEXITED(status)) return 4; - if (WEXITSTATUS(status)) return WEXITSTATUS(status); - printf("waiting for server\n"); - kill(svr, SIGINT); - if (waitpid(svr, &status, 0) == -1) return 2; - if (!WIFEXITED(status)) return 4; - if (WEXITSTATUS(status)) return WEXITSTATUS(status); - return 0; + if ((status = gpr_subprocess_join(cli))) { + gpr_subprocess_destroy(cli); + gpr_subprocess_destroy(svr); + return status; + } + gpr_subprocess_destroy(cli); + + gpr_subprocess_interrupt(svr); + status = gpr_subprocess_join(svr); + gpr_subprocess_destroy(svr); + return status; } diff --git a/test/core/tsi/transport_security_test.c b/test/core/tsi/transport_security_test.c index d591e43faa..e45602bab7 100644 --- a/test/core/tsi/transport_security_test.c +++ b/test/core/tsi/transport_security_test.c @@ -256,19 +256,16 @@ static tsi_peer peer_from_cert_name_test_entry( name_list *nl; parsed_dns_names dns_entries = parse_dns_names(entry->dns_names); nl = dns_entries.names; - GPR_ASSERT(tsi_construct_peer(2, &peer) == TSI_OK); + GPR_ASSERT(tsi_construct_peer(1 + dns_entries.name_count, &peer) == TSI_OK); GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, entry->common_name, &peer.properties[0]) == TSI_OK); - GPR_ASSERT(tsi_construct_list_peer_property( - TSI_X509_SUBJECT_ALTERNATIVE_NAMES_PEER_PROPERTY, - dns_entries.name_count, &peer.properties[1]) == TSI_OK); - i = 0; + i = 1; while (nl != NULL) { char *processed = processed_dns_name(nl->name); GPR_ASSERT(tsi_construct_string_peer_property( - NULL, processed, strlen(nl->name), - &peer.properties[1].value.list.children[i++]) == TSI_OK); + TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY, processed, + strlen(nl->name), &peer.properties[i++]) == TSI_OK); nl = nl->next; gpr_free(processed); } |