From 840931eec9bfd95c2d69f6b1e60413d18dd8281e Mon Sep 17 00:00:00 2001
From: Craig Tiller <ctiller@google.com>
Date: Fri, 19 May 2017 15:37:45 -0700
Subject: [PATCH] More import fixes

---
 include/grpc++/impl/codegen/status.h |  5 +++++
 src/core/lib/iomgr/timer_manager.c   |  9 ++++-----
 test/cpp/end2end/BUILD               |  1 +
 test/cpp/interop/BUILD               | 14 +++++++++++---
 test/cpp/qps/BUILD                   |  3 ---
 test/cpp/qps/client_sync.cc          |  2 +-
 6 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/include/grpc++/impl/codegen/status.h b/include/grpc++/impl/codegen/status.h
index 31fd6cdbe7..e89103f85b 100644
--- a/include/grpc++/impl/codegen/status.h
+++ b/include/grpc++/impl/codegen/status.h
@@ -75,6 +75,11 @@ class Status {
   /// Is the status OK?
   bool ok() const { return code_ == StatusCode::OK; }
 
+  // Ignores any errors. This method does nothing except potentially suppress
+  // complaints from any tools that are checking that errors are not dropped on
+  // the floor.
+  void IgnoreError() const {}
+
  private:
   StatusCode code_;
   grpc::string error_message_;
diff --git a/src/core/lib/iomgr/timer_manager.c b/src/core/lib/iomgr/timer_manager.c
index 24085093e7..fd9a7a2f04 100644
--- a/src/core/lib/iomgr/timer_manager.c
+++ b/src/core/lib/iomgr/timer_manager.c
@@ -93,10 +93,10 @@ static void start_timer_thread_and_unlock(void) {
   if (GRPC_TRACER_ON(grpc_timer_check_trace)) {
     gpr_log(GPR_DEBUG, "Spawn timer thread");
   }
-  gpr_thd_id thd;
   gpr_thd_options opt = gpr_thd_options_default();
   gpr_thd_options_set_joinable(&opt);
-  gpr_thd_new(&thd, timer_thread, NULL, &opt);
+  completed_thread *ct = gpr_malloc(sizeof(*ct));
+  gpr_thd_new(&ct->t, timer_thread, ct, &opt);
 }
 
 void grpc_timer_manager_tick() {
@@ -107,7 +107,7 @@ void grpc_timer_manager_tick() {
   grpc_exec_ctx_finish(&exec_ctx);
 }
 
-static void timer_thread(void *unused) {
+static void timer_thread(void *completed_thread_ptr) {
   // this threads exec_ctx: we try to run things through to completion here
   // since it's easy to spin up new threads
   grpc_exec_ctx exec_ctx =
@@ -194,8 +194,7 @@ static void timer_thread(void *unused) {
   if (0 == g_thread_count) {
     gpr_cv_signal(&g_cv_shutdown);
   }
-  completed_thread *ct = gpr_malloc(sizeof(*ct));
-  ct->t = gpr_thd_currentid();
+  completed_thread *ct = completed_thread_ptr;
   ct->next = g_completed_threads;
   g_completed_threads = ct;
   gpr_mu_unlock(&g_mu);
diff --git a/test/cpp/end2end/BUILD b/test/cpp/end2end/BUILD
index 9b691a83e0..1f7a4870d4 100644
--- a/test/cpp/end2end/BUILD
+++ b/test/cpp/end2end/BUILD
@@ -35,6 +35,7 @@ package(default_visibility=["//visibility:public"]) # Allows external users to i
 
 grpc_cc_library(
     name = "test_service_impl",
+    testonly = True,
     srcs = ["test_service_impl.cc"],
     hdrs = ["test_service_impl.h"],
     deps = [
diff --git a/test/cpp/interop/BUILD b/test/cpp/interop/BUILD
index 04c3489adc..8892da32be 100644
--- a/test/cpp/interop/BUILD
+++ b/test/cpp/interop/BUILD
@@ -86,13 +86,21 @@ grpc_cc_library(
     ],
 )
 
-grpc_cc_binary(
-    name = "interop_client",
+grpc_cc_library(
+    name = "interop_client_main",
     language = "c++",
     srcs = [
         "client.cc",
     ],
     deps = [
-        ":client_helper_lib",
+        ":client_helper_lib"
+    ],
+)
+
+grpc_cc_binary(
+    name = "interop_client",
+    language = "c++",
+    deps = [
+        ":interop_client_main",
     ],
 )
diff --git a/test/cpp/qps/BUILD b/test/cpp/qps/BUILD
index c6a1fd2fce..1f33dc55ff 100644
--- a/test/cpp/qps/BUILD
+++ b/test/cpp/qps/BUILD
@@ -67,9 +67,6 @@ grpc_cc_library(
         "//test/core/util:grpc_test_util",
         "//test/cpp/util:test_util",
     ],
-    external_deps = [
-        "gtest",
-    ],
 )
 
 grpc_cc_library(
diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc
index f35713280a..0aae82604d 100644
--- a/test/cpp/qps/client_sync.cc
+++ b/test/cpp/qps/client_sync.cc
@@ -155,7 +155,7 @@ class SynchronousStreamingClient : public SynchronousClient {
         if (*stream) {
           // forcibly cancel the streams, then finish
           context_[i].TryCancel();
-          (*stream)->Finish();
+          (*stream)->Finish().IgnoreError();
           // don't log any error message on !ok since this was canceled
         }
       });
-- 
GitLab