diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/core/statistics/census_log_tests.c | 6 | ||||
-rw-r--r-- | test/core/support/sync_test.c | 4 | ||||
-rw-r--r-- | test/core/support/time_test.c | 8 | ||||
-rw-r--r-- | test/core/transport/chttp2/timeout_encoding_test.c | 2 | ||||
-rw-r--r-- | test/core/util/test_config.h | 18 | ||||
-rw-r--r-- | test/cpp/qps/client_async.cc | 34 | ||||
-rw-r--r-- | test/cpp/qps/driver.h | 2 | ||||
-rw-r--r-- | test/cpp/util/time_test.cc | 4 | ||||
-rw-r--r-- | test/distrib/python/distribtest.py | 29 |
9 files changed, 65 insertions, 42 deletions
diff --git a/test/core/statistics/census_log_tests.c b/test/core/statistics/census_log_tests.c index aac20fd96a..77cc57d4d6 100644 --- a/test/core/statistics/census_log_tests.c +++ b/test/core/statistics/census_log_tests.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -237,8 +237,8 @@ static void reader_thread(void *arg) { gpr_timespec interval; int counter = 0; printf(" Reader starting\n"); - interval = gpr_time_from_micros(args->read_iteration_interval_in_msec * 1000, - GPR_TIMESPAN); + interval = gpr_time_from_micros( + (int64_t)args->read_iteration_interval_in_msec * 1000, GPR_TIMESPAN); gpr_mu_lock(args->mu); while (!args->stop_flag && records_read < args->total_records) { gpr_cv_wait(&args->stop, args->mu, interval); diff --git a/test/core/support/sync_test.c b/test/core/support/sync_test.c index 0149bc3afd..d311eb136a 100644 --- a/test/core/support/sync_test.c +++ b/test/core/support/sync_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -251,7 +251,7 @@ static void test(const char *name, void (*body)(void *m), gpr_timespec start = gpr_now(GPR_CLOCK_REALTIME); gpr_timespec time_taken; gpr_timespec deadline = gpr_time_add( - start, gpr_time_from_micros(timeout_s * 1000000, GPR_TIMESPAN)); + start, gpr_time_from_micros((int64_t)timeout_s * 1000000, GPR_TIMESPAN)); fprintf(stderr, "%s:", name); while (gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), deadline) < 0) { iterations <<= 1; diff --git a/test/core/support/time_test.c b/test/core/support/time_test.c index fc26f94d29..6cc3786df1 100644 --- a/test/core/support/time_test.c +++ b/test/core/support/time_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -125,15 +125,15 @@ static void test_values(void) { } /* Test possible overflow in conversion of -ve values. */ - x = gpr_time_from_micros(-(LONG_MAX - 999997), GPR_TIMESPAN); + x = gpr_time_from_micros(-(INT64_MAX - 999997), GPR_TIMESPAN); GPR_ASSERT(x.tv_sec < 0); GPR_ASSERT(x.tv_nsec >= 0 && x.tv_nsec < GPR_NS_PER_SEC); - x = gpr_time_from_nanos(-(LONG_MAX - 999999997), GPR_TIMESPAN); + x = gpr_time_from_nanos(-(INT64_MAX - 999999997), GPR_TIMESPAN); GPR_ASSERT(x.tv_sec < 0); GPR_ASSERT(x.tv_nsec >= 0 && x.tv_nsec < GPR_NS_PER_SEC); - x = gpr_time_from_millis(-(LONG_MAX - 997), GPR_TIMESPAN); + x = gpr_time_from_millis(-(INT64_MAX - 997), GPR_TIMESPAN); GPR_ASSERT(x.tv_sec < 0); GPR_ASSERT(x.tv_nsec >= 0 && x.tv_nsec < GPR_NS_PER_SEC); diff --git a/test/core/transport/chttp2/timeout_encoding_test.c b/test/core/transport/chttp2/timeout_encoding_test.c index f0e8ec386f..483e79fb25 100644 --- a/test/core/transport/chttp2/timeout_encoding_test.c +++ b/test/core/transport/chttp2/timeout_encoding_test.c @@ -93,7 +93,7 @@ static void assert_decodes_as(const char *buffer, gpr_timespec expected) { } void decode_suite(char ext, - gpr_timespec (*answer)(long x, gpr_clock_type clock)) { + gpr_timespec (*answer)(int64_t x, gpr_clock_type clock)) { long test_vals[] = {1, 12, 123, 1234, 12345, 123456, 1234567, 12345678, 123456789, 98765432, 9876543, 987654, 98765, 9876, 987, 98, 9}; diff --git a/test/core/util/test_config.h b/test/core/util/test_config.h index 15b71747fb..f6bb2e1f72 100644 --- a/test/core/util/test_config.h +++ b/test/core/util/test_config.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,16 +54,16 @@ extern double g_fixture_slowdown_factor; (GRPC_TEST_SLOWDOWN_BUILD_FACTOR * GRPC_TEST_SLOWDOWN_MACHINE_FACTOR * \ g_fixture_slowdown_factor) -#define GRPC_TIMEOUT_SECONDS_TO_DEADLINE(x) \ - gpr_time_add( \ - gpr_now(GPR_CLOCK_MONOTONIC), \ - gpr_time_from_millis((long)(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)), \ +#define GRPC_TIMEOUT_SECONDS_TO_DEADLINE(x) \ + gpr_time_add( \ + gpr_now(GPR_CLOCK_MONOTONIC), \ + gpr_time_from_millis((int64_t)(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)), \ GPR_TIMESPAN)) -#define GRPC_TIMEOUT_MILLIS_TO_DEADLINE(x) \ - gpr_time_add( \ - gpr_now(GPR_CLOCK_MONOTONIC), \ - gpr_time_from_micros((long)(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)), \ +#define GRPC_TIMEOUT_MILLIS_TO_DEADLINE(x) \ + gpr_time_add( \ + gpr_now(GPR_CLOCK_MONOTONIC), \ + gpr_time_from_micros((int64_t)(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)), \ GPR_TIMESPAN)) #ifndef GRPC_TEST_CUSTOM_PICK_PORT diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index 6b6294ba51..f3f8f37051 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -96,8 +96,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { std::function< std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>( BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, - CompletionQueue*)> - start_req, + CompletionQueue*)> start_req, std::function<void(grpc::Status, ResponseType*)> on_done) : ClientRpcContext(channel_id), context_(), @@ -143,8 +142,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { std::function<void(grpc::Status, ResponseType*)> callback_; std::function<std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>( BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, - CompletionQueue*)> - start_req_; + CompletionQueue*)> start_req_; grpc::Status status_; double start_; std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>> @@ -164,12 +162,11 @@ class AsyncClient : public ClientImpl<StubType, RequestType> { using ClientImpl<StubType, RequestType>::cores_; using ClientImpl<StubType, RequestType>::channels_; using ClientImpl<StubType, RequestType>::request_; - AsyncClient( - const ClientConfig& config, - std::function<ClientRpcContext*(int, StubType*, const RequestType&)> - setup_ctx, - std::function<std::unique_ptr<StubType>(std::shared_ptr<Channel>)> - create_stub) + AsyncClient(const ClientConfig& config, + std::function<ClientRpcContext*(int, StubType*, + const RequestType&)> setup_ctx, + std::function<std::unique_ptr<StubType>(std::shared_ptr<Channel>)> + create_stub) : ClientImpl<StubType, RequestType>(config, create_stub), num_async_threads_(NumThreads(config)), channel_lock_(new std::mutex[config.client_channels()]), @@ -411,8 +408,7 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext { std::function<std::unique_ptr< grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>( BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, - void*)> - start_req, + void*)> start_req, std::function<void(grpc::Status, ResponseType*)> on_done) : ClientRpcContext(channel_id), context_(), @@ -464,10 +460,10 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext { ResponseType response_; bool (ClientRpcContextStreamingImpl::*next_state_)(bool, Histogram*); std::function<void(grpc::Status, ResponseType*)> callback_; - std::function<std::unique_ptr< - grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>( - BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, void*)> - start_req_; + std::function< + std::unique_ptr<grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>( + BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, + void*)> start_req_; grpc::Status status_; double start_; std::unique_ptr<grpc::ClientAsyncReaderWriter<RequestType, ResponseType>> @@ -511,8 +507,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext { int channel_id, grpc::GenericStub* stub, const ByteBuffer& req, std::function<std::unique_ptr<grpc::GenericClientAsyncReaderWriter>( grpc::GenericStub*, grpc::ClientContext*, - const grpc::string& method_name, CompletionQueue*, void*)> - start_req, + const grpc::string& method_name, CompletionQueue*, void*)> start_req, std::function<void(grpc::Status, ByteBuffer*)> on_done) : ClientRpcContext(channel_id), context_(), @@ -569,8 +564,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext { std::function<void(grpc::Status, ByteBuffer*)> callback_; std::function<std::unique_ptr<grpc::GenericClientAsyncReaderWriter>( grpc::GenericStub*, grpc::ClientContext*, const grpc::string&, - CompletionQueue*, void*)> - start_req_; + CompletionQueue*, void*)> start_req_; grpc::Status status_; double start_; std::unique_ptr<grpc::GenericClientAsyncReaderWriter> stream_; diff --git a/test/cpp/qps/driver.h b/test/cpp/qps/driver.h index 4b2b400c0c..3af61f7391 100644 --- a/test/cpp/qps/driver.h +++ b/test/cpp/qps/driver.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/test/cpp/util/time_test.cc b/test/cpp/util/time_test.cc index 1e501dfd28..48c6ce7697 100644 --- a/test/cpp/util/time_test.cc +++ b/test/cpp/util/time_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,7 +45,7 @@ namespace { class TimeTest : public ::testing::Test {}; TEST_F(TimeTest, AbsolutePointTest) { - long us = 10000000L; + int64_t us = 10000000L; gpr_timespec ts = gpr_time_from_micros(us, GPR_TIMESPAN); ts.clock_type = GPR_CLOCK_REALTIME; system_clock::time_point tp{microseconds(us)}; diff --git a/test/distrib/python/distribtest.py b/test/distrib/python/distribtest.py index 428ffe2b34..66c1f88796 100644 --- a/test/distrib/python/distribtest.py +++ b/test/distrib/python/distribtest.py @@ -1,3 +1,32 @@ +# Copyright 2015-2016, 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. + from grpc.beta import implementations # This code doesn't do much but makes sure the native extension is loaded |