aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-02-26 14:05:56 -0800
committerGravatar Craig Tiller <ctiller@google.com>2015-02-26 14:27:05 -0800
commitcf133f41f84c6c8d306293a5dc8f81fbd9aed1a1 (patch)
treece405139ab89b1f4eedf5e8ad41abb015e503e4d /test
parenta1d7f7f70bd4bbc6976150672220a6fd25e209ca (diff)
Make it possible to compile with gcc4.6
Diffstat (limited to 'test')
-rw-r--r--test/build/c++11.cc52
-rw-r--r--test/cpp/end2end/async_end2end_test.cc4
-rw-r--r--test/cpp/end2end/end2end_test.cc18
-rw-r--r--test/cpp/interop/client.cc5
-rw-r--r--test/cpp/interop/server.cc3
-rw-r--r--test/cpp/qps/server.cc6
6 files changed, 72 insertions, 16 deletions
diff --git a/test/build/c++11.cc b/test/build/c++11.cc
new file mode 100644
index 0000000000..519395f20a
--- /dev/null
+++ b/test/build/c++11.cc
@@ -0,0 +1,52 @@
+/*
+ *
+ * Copyright 2015, 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.
+ *
+ */
+
+/* This is just a compilation test, to see if we have zlib installed. */
+
+#include <stdlib.h>
+#include <zlib.h>
+
+class Base {
+ public:
+ virtual void foo() = 0;
+};
+
+class Foo final : public Base {
+ public:
+ void foo() override {}
+};
+
+int main() {
+ Foo().foo();
+ return 0;
+}
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc
index 9e25a5308d..5a2762d049 100644
--- a/test/cpp/end2end/async_end2end_test.cc
+++ b/test/cpp/end2end/async_end2end_test.cc
@@ -81,7 +81,7 @@ class AsyncEnd2endTest : public ::testing::Test {
protected:
AsyncEnd2endTest() : service_(&srv_cq_) {}
- void SetUp() override {
+ void SetUp() GRPC_OVERRIDE {
int port = grpc_pick_unused_port_or_die();
server_address_ << "localhost:" << port;
// Setup server
@@ -91,7 +91,7 @@ class AsyncEnd2endTest : public ::testing::Test {
server_ = builder.BuildAndStart();
}
- void TearDown() override {
+ void TearDown() GRPC_OVERRIDE {
server_->Shutdown();
void* ignored_tag;
bool ignored_ok;
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc
index 45f12a9e9d..1d5dfc4e34 100644
--- a/test/cpp/end2end/end2end_test.cc
+++ b/test/cpp/end2end/end2end_test.cc
@@ -83,7 +83,7 @@ void MaybeEchoDeadline(ServerContext* context, const EchoRequest* request,
class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
public:
Status Echo(ServerContext* context, const EchoRequest* request,
- EchoResponse* response) override {
+ EchoResponse* response) GRPC_OVERRIDE {
response->set_message(request->message());
MaybeEchoDeadline(context, request, response);
return Status::OK;
@@ -93,7 +93,7 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
Status RequestStream(ServerContext* context,
ServerReader<EchoRequest>* reader,
- EchoResponse* response) override {
+ EchoResponse* response) GRPC_OVERRIDE {
EchoRequest request;
response->set_message("");
while (reader->Read(&request)) {
@@ -105,7 +105,7 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
// Return 3 messages.
// TODO(yangg) make it generic by adding a parameter into EchoRequest
Status ResponseStream(ServerContext* context, const EchoRequest* request,
- ServerWriter<EchoResponse>* writer) override {
+ ServerWriter<EchoResponse>* writer) GRPC_OVERRIDE {
EchoResponse response;
response.set_message(request->message() + "0");
writer->Write(response);
@@ -117,9 +117,9 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
return Status::OK;
}
- Status BidiStream(
- ServerContext* context,
- ServerReaderWriter<EchoResponse, EchoRequest>* stream) override {
+ Status BidiStream(ServerContext* context,
+ ServerReaderWriter<EchoResponse, EchoRequest>* stream)
+ GRPC_OVERRIDE {
EchoRequest request;
EchoResponse response;
while (stream->Read(&request)) {
@@ -135,7 +135,7 @@ class TestServiceImplDupPkg
: public ::grpc::cpp::test::util::duplicate::TestService::Service {
public:
Status Echo(ServerContext* context, const EchoRequest* request,
- EchoResponse* response) override {
+ EchoResponse* response) GRPC_OVERRIDE {
response->set_message("no package");
return Status::OK;
}
@@ -145,7 +145,7 @@ class End2endTest : public ::testing::Test {
protected:
End2endTest() : thread_pool_(2) {}
- void SetUp() override {
+ void SetUp() GRPC_OVERRIDE {
int port = grpc_pick_unused_port_or_die();
server_address_ << "localhost:" << port;
// Setup server
@@ -157,7 +157,7 @@ class End2endTest : public ::testing::Test {
server_ = builder.BuildAndStart();
}
- void TearDown() override { server_->Shutdown(); }
+ void TearDown() GRPC_OVERRIDE { server_->Shutdown(); }
void ResetStub() {
std::shared_ptr<ChannelInterface> channel =
diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc
index acfaa87ec8..f7537c2d7b 100644
--- a/test/cpp/interop/client.cc
+++ b/test/cpp/interop/client.cc
@@ -38,6 +38,8 @@
#include <string>
#include <thread>
+#include <unistd.h>
+
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <gflags/gflags.h>
@@ -313,8 +315,7 @@ void DoResponseStreamingWithSlowConsumer() {
GPR_ASSERT(response.payload().body() ==
grpc::string(kResponseMessageSize, '\0'));
gpr_log(GPR_INFO, "received message %d", i);
- std::this_thread::sleep_for(
- std::chrono::milliseconds(kReceiveDelayMilliSeconds));
+ usleep(kReceiveDelayMilliSeconds * 1000);
++i;
}
GPR_ASSERT(kNumResponseMessages == i);
diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc
index 263bd8e304..9810ff6622 100644
--- a/test/cpp/interop/server.cc
+++ b/test/cpp/interop/server.cc
@@ -36,6 +36,7 @@
#include <thread>
#include <signal.h>
+#include <unistd.h>
#include <gflags/gflags.h>
#include <grpc/grpc.h>
@@ -222,7 +223,7 @@ void RunServer() {
std::unique_ptr<Server> server(builder.BuildAndStart());
gpr_log(GPR_INFO, "Server listening on %s", server_address.str().c_str());
while (!got_sigint) {
- std::this_thread::sleep_for(std::chrono::seconds(5));
+ sleep(5);
}
}
diff --git a/test/cpp/qps/server.cc b/test/cpp/qps/server.cc
index 8e136349a1..be27c12b30 100644
--- a/test/cpp/qps/server.cc
+++ b/test/cpp/qps/server.cc
@@ -36,6 +36,8 @@
#include <sys/signal.h>
#include <thread>
+#include <unistd.h>
+
#include <gflags/gflags.h>
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
@@ -97,7 +99,7 @@ static bool SetPayload(PayloadType type, int size, Payload* payload) {
namespace {
-class TestServiceImpl final : public TestService::Service {
+class TestServiceImpl GRPC_FINAL : public TestService::Service {
public:
Status CollectServerStats(ServerContext* context, const StatsRequest*,
ServerStats* response) {
@@ -146,7 +148,7 @@ static void RunServer() {
grpc_profiler_start("qps_server.prof");
while (!got_sigint) {
- std::this_thread::sleep_for(std::chrono::seconds(5));
+ sleep(5);
}
grpc_profiler_stop();