Skip to content
Snippets Groups Projects
Commit cab82fd1 authored by Yang Gao's avatar Yang Gao
Browse files

Merge pull request #4921 from ctiller/fix-c++

Small testing fixes
parents 26e4f5b1 a0fef147
No related branches found
No related tags found
No related merge requests found
// Copyright 2015, Google Inc. // Copyright 2015-2016, Google Inc.
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
...@@ -41,6 +41,7 @@ message RequestParams { ...@@ -41,6 +41,7 @@ message RequestParams {
int32 response_message_length = 6; int32 response_message_length = 6;
bool echo_peer = 7; bool echo_peer = 7;
string expected_client_identity = 8; // will force check_auth_context. string expected_client_identity = 8; // will force check_auth_context.
bool skip_cancelled_check = 9;
} }
message EchoRequest { message EchoRequest {
......
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "test/core/util/port.h" #include "test/core/util/port.h"
#include <math.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <stdio.h> #include <stdio.h>
...@@ -229,10 +230,10 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg, ...@@ -229,10 +230,10 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg,
grpc_httpcli_request req; grpc_httpcli_request req;
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
GPR_ASSERT(pr->retries < 10); GPR_ASSERT(pr->retries < 10);
sleep(1 + (unsigned)(pow(1.3, pr->retries) * rand() / RAND_MAX));
pr->retries++; pr->retries++;
req.host = pr->server; req.host = pr->server;
req.path = "/get"; req.path = "/get";
sleep(1);
grpc_httpcli_get(exec_ctx, pr->ctx, &pr->pollset, &req, grpc_httpcli_get(exec_ctx, pr->ctx, &pr->pollset, &req,
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), got_port_from_server, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), got_port_from_server,
pr); pr);
......
...@@ -244,7 +244,8 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { ...@@ -244,7 +244,8 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
gpr_time_from_micros(request->param().server_cancel_after_us(), gpr_time_from_micros(request->param().server_cancel_after_us(),
GPR_TIMESPAN))); GPR_TIMESPAN)));
return Status::CANCELLED; return Status::CANCELLED;
} else { } else if (!request->has_param() ||
!request->param().skip_cancelled_check()) {
EXPECT_FALSE(context->IsCancelled()); EXPECT_FALSE(context->IsCancelled());
} }
...@@ -823,6 +824,7 @@ TEST_P(ProxyEnd2endTest, RpcDeadlineExpires) { ...@@ -823,6 +824,7 @@ TEST_P(ProxyEnd2endTest, RpcDeadlineExpires) {
EchoRequest request; EchoRequest request;
EchoResponse response; EchoResponse response;
request.set_message("Hello"); request.set_message("Hello");
request.mutable_param()->set_skip_cancelled_check(true);
ClientContext context; ClientContext context;
std::chrono::system_clock::time_point deadline = std::chrono::system_clock::time_point deadline =
......
...@@ -151,9 +151,9 @@ class CLanguage(object): ...@@ -151,9 +151,9 @@ class CLanguage(object):
def make_targets(self, test_regex): def make_targets(self, test_regex):
if platform_string() != 'windows' and test_regex != '.*': if platform_string() != 'windows' and test_regex != '.*':
# use the regex to minimize the number of things to build # use the regex to minimize the number of things to build
return [target['name'] return [os.path.basename(target['name'])
for target in get_c_tests(False, self.test_lang) for target in get_c_tests(False, self.test_lang)
if re.search(test_regex, target['name'])] if re.search(test_regex, '/' + target['name'])]
if platform_string() == 'windows': if platform_string() == 'windows':
# don't build tools on windows just yet # don't build tools on windows just yet
return ['buildtests_%s' % self.make_target] return ['buildtests_%s' % self.make_target]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment