aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--examples/pubsub/publisher_test.cc3
-rw-r--r--examples/pubsub/subscriber_test.cc3
-rw-r--r--include/grpc++/create_channel.h6
-rw-r--r--include/grpc++/server.h5
-rw-r--r--include/grpc/support/alloc.h4
-rw-r--r--include/grpc/support/atm.h4
-rw-r--r--include/grpc/support/atm_win32.h4
-rw-r--r--include/grpc/support/port_platform.h14
-rw-r--r--include/grpc/support/slice.h4
-rw-r--r--include/grpc/support/sync.h2
-rw-r--r--include/grpc/support/sync_posix.h1
-rw-r--r--include/grpc/support/sync_win32.h1
-rw-r--r--include/grpc/support/time.h2
-rw-r--r--src/compiler/cpp_generator.cc169
-rw-r--r--src/core/compression/message_compress.c3
-rw-r--r--src/core/debug/trace.c2
-rw-r--r--src/core/debug/trace.h3
-rw-r--r--src/core/iomgr/resolve_address_posix.c17
-rw-r--r--src/core/security/security_context.c8
-rw-r--r--src/core/statistics/census_init.c2
-rw-r--r--src/core/statistics/census_log.c4
-rw-r--r--src/core/statistics/census_rpc_stats.c2
-rw-r--r--src/core/statistics/census_tracing.c2
-rw-r--r--src/core/support/alloc.c3
-rw-r--r--src/core/support/cpu_linux.c25
-rw-r--r--src/core/support/cpu_posix.c20
-rw-r--r--src/core/support/log_win32.c2
-rw-r--r--src/core/support/string.c1
-rw-r--r--src/core/support/string_posix.c2
-rw-r--r--src/core/support/sync.c4
-rw-r--r--src/core/support/time.c14
-rw-r--r--src/core/transport/chttp2/frame_settings.c18
-rw-r--r--src/core/transport/chttp2_transport.c26
-rw-r--r--src/core/tsi/ssl_transport_security.c1
-rw-r--r--src/cpp/client/create_channel.cc4
-rw-r--r--src/cpp/server/server.cc25
-rw-r--r--src/cpp/server/thread_pool.cc6
-rw-r--r--src/node/examples/pubsub/pubsub_demo.js68
-rw-r--r--src/node/examples/route_guide_client.js66
-rw-r--r--src/node/examples/route_guide_server.js72
-rw-r--r--src/node/ext/credentials.cc2
-rw-r--r--src/node/index.js2
-rw-r--r--src/node/interop/interop_client.js2
-rw-r--r--src/node/interop/messages.proto6
-rw-r--r--src/node/package.json2
-rw-r--r--src/node/src/client.js8
-rw-r--r--src/python/src/grpc/_adapter/rear.py5
-rw-r--r--src/ruby/ext/grpc/rb_credentials.c2
-rw-r--r--src/ruby/spec/generic/active_call_spec.rb4
-rw-r--r--templates/Makefile.template4
-rw-r--r--test/core/support/time_test.c8
-rw-r--r--test/cpp/end2end/async_end2end_test.cc4
-rw-r--r--test/cpp/end2end/end2end_test.cc29
-rw-r--r--test/cpp/util/create_test_channel.cc2
-rw-r--r--tools/dockerfile/grpc_build_deb/Dockerfile29
-rw-r--r--tools/dockerfile/grpc_ruby_deb/Dockerfile29
-rwxr-xr-xtools/gce_setup/cloud_prod_runner.sh13
-rwxr-xr-xtools/gce_setup/grpc_docker.sh43
-rwxr-xr-xtools/run_tests/jobset.py32
-rwxr-xr-xtools/run_tests/run_tests.py5
61 files changed, 490 insertions, 367 deletions
diff --git a/Makefile b/Makefile
index 7b662e575c..277e8caebc 100644
--- a/Makefile
+++ b/Makefile
@@ -257,7 +257,7 @@ HAS_SYSTEM_ZLIB = false
HAS_SYSTEM_PROTOBUF = false
endif
-HAS_PROTOC = $(shell $(PROTOC_CMD) && echo true || echo false)
+HAS_PROTOC = $(shell $(PROTOC_CMD) > /dev/null && echo true || echo false)
ifeq ($(HAS_PROTOC),true)
HAS_VALID_PROTOC = $(shell $(PROTOC_CHECK_CMD) 2> /dev/null && echo true || echo false)
else
@@ -2084,7 +2084,7 @@ install-certs: etc/roots.pem
$(Q) $(INSTALL) etc/roots.pem $(prefix)/share/grpc/roots.pem
verify-install:
-ifeq ($(SYSTEM_OK),true)
+ifeq ($(INSTALL_OK),true)
@echo "Your system looks ready to go."
@echo
else
diff --git a/examples/pubsub/publisher_test.cc b/examples/pubsub/publisher_test.cc
index b7bea5b1bd..4539557a35 100644
--- a/examples/pubsub/publisher_test.cc
+++ b/examples/pubsub/publisher_test.cc
@@ -110,7 +110,8 @@ class PublisherTest : public ::testing::Test {
builder.RegisterService(&service_);
server_ = builder.BuildAndStart();
- channel_ = CreateChannel(server_address_.str(), ChannelArguments());
+ channel_ =
+ CreateChannelDeprecated(server_address_.str(), ChannelArguments());
publisher_.reset(new grpc::examples::pubsub::Publisher(channel_));
}
diff --git a/examples/pubsub/subscriber_test.cc b/examples/pubsub/subscriber_test.cc
index 1fdcc8f755..c634aa4f82 100644
--- a/examples/pubsub/subscriber_test.cc
+++ b/examples/pubsub/subscriber_test.cc
@@ -109,7 +109,8 @@ class SubscriberTest : public ::testing::Test {
builder.RegisterService(&service_);
server_ = builder.BuildAndStart();
- channel_ = CreateChannel(server_address_.str(), ChannelArguments());
+ channel_ =
+ CreateChannelDeprecated(server_address_.str(), ChannelArguments());
subscriber_.reset(new grpc::examples::pubsub::Subscriber(channel_));
}
diff --git a/include/grpc++/create_channel.h b/include/grpc++/create_channel.h
index eadabda359..80ca0c4dc4 100644
--- a/include/grpc++/create_channel.h
+++ b/include/grpc++/create_channel.h
@@ -43,8 +43,10 @@ namespace grpc {
class ChannelArguments;
class ChannelInterface;
-std::shared_ptr<ChannelInterface> CreateChannel(const grpc::string& target,
- const ChannelArguments& args);
+// Deprecation warning: This function will soon be deleted
+// (See pull request #711)
+std::shared_ptr<ChannelInterface> CreateChannelDeprecated(
+ const grpc::string& target, const ChannelArguments& args);
// If creds does not hold an object or is invalid, a lame channel is returned.
std::shared_ptr<ChannelInterface> CreateChannel(
diff --git a/include/grpc++/server.h b/include/grpc++/server.h
index 26d18d1bbe..429c0ff3cf 100644
--- a/include/grpc++/server.h
+++ b/include/grpc++/server.h
@@ -69,6 +69,11 @@ class Server final : private CallHook,
// Shutdown the server, block until all rpc processing finishes.
void Shutdown();
+ // Block waiting for all work to complete (the server must either
+ // be shutting down or some other thread must call Shutdown for this
+ // function to ever return)
+ void Wait();
+
private:
friend class ServerBuilder;
diff --git a/include/grpc/support/alloc.h b/include/grpc/support/alloc.h
index c758065576..09ea97565b 100644
--- a/include/grpc/support/alloc.h
+++ b/include/grpc/support/alloc.h
@@ -46,8 +46,8 @@ void *gpr_malloc(size_t size);
void gpr_free(void *ptr);
/* realloc, never returns NULL */
void *gpr_realloc(void *p, size_t size);
-/* aligned malloc, never returns NULL, alignment must be power of 2 */
-void *gpr_malloc_aligned(size_t size, size_t alignment);
+/* aligned malloc, never returns NULL, will align to 1 << alignment_log */
+void *gpr_malloc_aligned(size_t size, size_t alignment_log);
/* free memory allocated by gpr_malloc_aligned */
void gpr_free_aligned(void *ptr);
diff --git a/include/grpc/support/atm.h b/include/grpc/support/atm.h
index 0cac9bf586..f1e30d31e8 100644
--- a/include/grpc/support/atm.h
+++ b/include/grpc/support/atm.h
@@ -51,12 +51,12 @@
The routines may be implemented as macros.
- // Atomic operations acton an intergral_type gpr_atm that is guaranteed to
+ // Atomic operations act on an intergral_type gpr_atm that is guaranteed to
// be the same size as a pointer.
typedef gpr_intptr gpr_atm;
// A memory barrier, providing both acquire and release semantics, but not
- // otherwise acting no memory.
+ // otherwise acting on memory.
void gpr_atm_full_barrier(void);
// Atomically return *p, with acquire semantics.
diff --git a/include/grpc/support/atm_win32.h b/include/grpc/support/atm_win32.h
index acacf12013..9bb1cfec35 100644
--- a/include/grpc/support/atm_win32.h
+++ b/include/grpc/support/atm_win32.h
@@ -93,11 +93,13 @@ static __inline gpr_atm gpr_atm_no_barrier_fetch_add(gpr_atm *p,
static __inline gpr_atm gpr_atm_full_fetch_add(gpr_atm *p, gpr_atm delta) {
/* Use a CAS operation to get pointer-sized fetch and add */
gpr_atm old;
+#ifdef GPR_ARCH_64
do {
old = *p;
-#ifdef GPR_ARCH_64
} while (old != (gpr_atm)InterlockedCompareExchange64(p, old + delta, old));
#else
+ do {
+ old = *p;
} while (old != (gpr_atm)InterlockedCompareExchange(p, old + delta, old));
#endif
return old;
diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h
index 27efa29448..0a651757bc 100644
--- a/include/grpc/support/port_platform.h
+++ b/include/grpc/support/port_platform.h
@@ -147,16 +147,18 @@
#include <stdint.h>
/* Cache line alignment */
-#ifndef GPR_CACHELINE_SIZE
+#ifndef GPR_CACHELINE_SIZE_LOG
#if defined(__i386__) || defined(__x86_64__)
-#define GPR_CACHELINE_SIZE 64
+#define GPR_CACHELINE_SIZE_LOG 6
#endif
-#ifndef GPR_CACHELINE_SIZE
+#ifndef GPR_CACHELINE_SIZE_LOG
/* A reasonable default guess. Note that overestimates tend to waste more
space, while underestimates tend to waste more time. */
-#define GPR_CACHELINE_SIZE 64
-#endif /* GPR_CACHELINE_SIZE */
-#endif /* GPR_CACHELINE_SIZE */
+#define GPR_CACHELINE_SIZE_LOG 6
+#endif /* GPR_CACHELINE_SIZE_LOG */
+#endif /* GPR_CACHELINE_SIZE_LOG */
+
+#define GPR_CACHELINE_SIZE (1 << GPR_CACHELINE_SIZE_LOG)
/* scrub GCC_ATOMIC if it's not available on this compiler */
#if defined(GPR_GCC_ATOMIC) && !defined(__ATOMIC_RELAXED)
diff --git a/include/grpc/support/slice.h b/include/grpc/support/slice.h
index 261e3baabe..8a2129028f 100644
--- a/include/grpc/support/slice.h
+++ b/include/grpc/support/slice.h
@@ -165,7 +165,9 @@ gpr_slice gpr_slice_split_head(gpr_slice *s, size_t split);
gpr_slice gpr_empty_slice(void);
-/* Returns <0 if a < b, ==0 if a == b, >0 if a > b */
+/* Returns <0 if a < b, ==0 if a == b, >0 if a > b
+ The order is arbitrary, and is not guaranteed to be stable across different
+ versions of the API. */
int gpr_slice_cmp(gpr_slice a, gpr_slice b);
int gpr_slice_str_cmp(gpr_slice a, const char *b);
diff --git a/include/grpc/support/sync.h b/include/grpc/support/sync.h
index 4437375db7..bc99317f3c 100644
--- a/include/grpc/support/sync.h
+++ b/include/grpc/support/sync.h
@@ -206,7 +206,7 @@ void *gpr_event_cancellable_wait(gpr_event *ev, gpr_timespec abs_deadline,
/* --- Reference counting ---
- These calls act on the type gpr_refcount. It requires no desctruction. */
+ These calls act on the type gpr_refcount. It requires no destruction. */
/* Initialize *r to value n. */
void gpr_ref_init(gpr_refcount *r, int n);
diff --git a/include/grpc/support/sync_posix.h b/include/grpc/support/sync_posix.h
index 413226a9e8..8ba2c5b892 100644
--- a/include/grpc/support/sync_posix.h
+++ b/include/grpc/support/sync_posix.h
@@ -36,7 +36,6 @@
#include <grpc/support/sync_generic.h>
-/* Posix variant of gpr_sync_platform.h */
#include <pthread.h>
typedef pthread_mutex_t gpr_mu;
diff --git a/include/grpc/support/sync_win32.h b/include/grpc/support/sync_win32.h
index 5a48b52a2d..13823b8ee3 100644
--- a/include/grpc/support/sync_win32.h
+++ b/include/grpc/support/sync_win32.h
@@ -36,7 +36,6 @@
#include <grpc/support/sync_generic.h>
-/* Win32 variant of gpr_sync_platform.h */
#include <windows.h>
typedef struct {
diff --git a/include/grpc/support/time.h b/include/grpc/support/time.h
index ebc18c91e9..150b7ac8c5 100644
--- a/include/grpc/support/time.h
+++ b/include/grpc/support/time.h
@@ -76,7 +76,7 @@ gpr_timespec gpr_time_min(gpr_timespec a, gpr_timespec b);
gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b);
gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b);
-/* Return a timespec representing a given number of microseconds. LONG_MIN is
+/* Return a timespec representing a given number of time units. LONG_MIN is
interpreted as gpr_inf_past, and LONG_MAX as gpr_inf_future. */
gpr_timespec gpr_time_from_micros(long x);
gpr_timespec gpr_time_from_nanos(long x);
diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc
index f10824e6b0..891032343b 100644
--- a/src/compiler/cpp_generator.cc
+++ b/src/compiler/cpp_generator.cc
@@ -183,34 +183,40 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer,
printer->Print(*vars,
"::grpc::Status $Method$(::grpc::ClientContext* context, "
"const $Request$& request, $Response$* response);\n");
- printer->Print(*vars,
- "::grpc::ClientAsyncResponseReader< $Response$>* "
- "$Method$(::grpc::ClientContext* context, "
- "const $Request$& request, "
- "::grpc::CompletionQueue* cq, void* tag);\n");
+ printer->Print(
+ *vars,
+ "std::unique_ptr< ::grpc::ClientAsyncResponseReader< $Response$>> "
+ "$Method$(::grpc::ClientContext* context, "
+ "const $Request$& request, "
+ "::grpc::CompletionQueue* cq, void* tag);\n");
} else if (ClientOnlyStreaming(method)) {
- printer->Print(*vars,
- "::grpc::ClientWriter< $Request$>* $Method$("
- "::grpc::ClientContext* context, $Response$* response);\n");
- printer->Print(*vars,
- "::grpc::ClientAsyncWriter< $Request$>* $Method$("
- "::grpc::ClientContext* context, $Response$* response, "
- "::grpc::CompletionQueue* cq, void* tag);\n");
+ printer->Print(
+ *vars,
+ "std::unique_ptr< ::grpc::ClientWriter< $Request$>> $Method$("
+ "::grpc::ClientContext* context, $Response$* response);\n");
+ printer->Print(
+ *vars,
+ "std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>> $Method$("
+ "::grpc::ClientContext* context, $Response$* response, "
+ "::grpc::CompletionQueue* cq, void* tag);\n");
} else if (ServerOnlyStreaming(method)) {
printer->Print(
*vars,
- "::grpc::ClientReader< $Response$>* $Method$("
+ "std::unique_ptr< ::grpc::ClientReader< $Response$>> $Method$("
"::grpc::ClientContext* context, const $Request$& request);\n");
- printer->Print(*vars,
- "::grpc::ClientAsyncReader< $Response$>* $Method$("
- "::grpc::ClientContext* context, const $Request$& request, "
- "::grpc::CompletionQueue* cq, void* tag);\n");
+ printer->Print(
+ *vars,
+ "std::unique_ptr< ::grpc::ClientAsyncReader< $Response$>> $Method$("
+ "::grpc::ClientContext* context, const $Request$& request, "
+ "::grpc::CompletionQueue* cq, void* tag);\n");
} else if (BidiStreaming(method)) {
+ printer->Print(
+ *vars,
+ "std::unique_ptr< ::grpc::ClientReaderWriter< $Request$, $Response$>> "
+ "$Method$(::grpc::ClientContext* context);\n");
printer->Print(*vars,
- "::grpc::ClientReaderWriter< $Request$, $Response$>* "
- "$Method$(::grpc::ClientContext* context);\n");
- printer->Print(*vars,
- "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>* "
+ "std::unique_ptr< ::grpc::ClientAsyncReaderWriter< "
+ "$Request$, $Response$>> "
"$Method$(::grpc::ClientContext* context, "
"::grpc::CompletionQueue* cq, void* tag);\n");
}
@@ -309,7 +315,8 @@ void PrintHeaderService(google::protobuf::io::Printer *printer,
printer->Outdent();
printer->Print("};\n");
printer->Print(
- "static Stub* NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& "
+ "static std::unique_ptr<Stub> NewStub(const std::shared_ptr< "
+ "::grpc::ChannelInterface>& "
"channel);\n");
printer->Print("\n");
@@ -380,91 +387,101 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer,
"::grpc::RpcMethod($Service$_method_names[$Idx$]), "
"context, request, response);\n"
"}\n\n");
+ printer->Print(
+ *vars,
+ "std::unique_ptr< ::grpc::ClientAsyncResponseReader< $Response$>> "
+ "$Service$::Stub::$Method$(::grpc::ClientContext* context, "
+ "const $Request$& request, "
+ "::grpc::CompletionQueue* cq, void* tag) {\n");
printer->Print(*vars,
- "::grpc::ClientAsyncResponseReader< $Response$>* "
- "$Service$::Stub::$Method$(::grpc::ClientContext* context, "
- "const $Request$& request, "
- "::grpc::CompletionQueue* cq, void* tag) {\n");
- printer->Print(*vars,
- " return new ::grpc::ClientAsyncResponseReader< $Response$>("
+ " return std::unique_ptr< "
+ "::grpc::ClientAsyncResponseReader< $Response$>>(new "
+ "::grpc::ClientAsyncResponseReader< $Response$>("
"channel(), cq, "
"::grpc::RpcMethod($Service$_method_names[$Idx$]), "
- "context, request, tag);\n"
+ "context, request, tag));\n"
"}\n\n");
} else if (ClientOnlyStreaming(method)) {
- printer->Print(
- *vars,
- "::grpc::ClientWriter< $Request$>* $Service$::Stub::$Method$("
- "::grpc::ClientContext* context, $Response$* response) {\n");
printer->Print(*vars,
- " return new ::grpc::ClientWriter< $Request$>("
+ "std::unique_ptr< ::grpc::ClientWriter< $Request$>> "
+ "$Service$::Stub::$Method$("
+ "::grpc::ClientContext* context, $Response$* response) {\n");
+ printer->Print(*vars,
+ " return std::unique_ptr< ::grpc::ClientWriter< "
+ "$Request$>>(new ::grpc::ClientWriter< $Request$>("
"channel(),"
"::grpc::RpcMethod($Service$_method_names[$Idx$], "
"::grpc::RpcMethod::RpcType::CLIENT_STREAMING), "
- "context, response);\n"
+ "context, response));\n"
"}\n\n");
- printer->Print(
- *vars,
- "::grpc::ClientAsyncWriter< $Request$>* $Service$::Stub::$Method$("
- "::grpc::ClientContext* context, $Response$* response, "
- "::grpc::CompletionQueue* cq, void* tag) {\n");
printer->Print(*vars,
- " return new ::grpc::ClientAsyncWriter< $Request$>("
+ "std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>> "
+ "$Service$::Stub::$Method$("
+ "::grpc::ClientContext* context, $Response$* response, "
+ "::grpc::CompletionQueue* cq, void* tag) {\n");
+ printer->Print(*vars,
+ " return std::unique_ptr< ::grpc::ClientAsyncWriter< "
+ "$Request$>>(new ::grpc::ClientAsyncWriter< $Request$>("
"channel(), cq, "
"::grpc::RpcMethod($Service$_method_names[$Idx$], "
"::grpc::RpcMethod::RpcType::CLIENT_STREAMING), "
- "context, response, tag);\n"
+ "context, response, tag));\n"
"}\n\n");
} else if (ServerOnlyStreaming(method)) {
printer->Print(
*vars,
- "::grpc::ClientReader< $Response$>* $Service$::Stub::$Method$("
+ "std::unique_ptr< ::grpc::ClientReader< $Response$>> "
+ "$Service$::Stub::$Method$("
"::grpc::ClientContext* context, const $Request$& request) {\n");
printer->Print(*vars,
- " return new ::grpc::ClientReader< $Response$>("
+ " return std::unique_ptr< ::grpc::ClientReader< "
+ "$Response$>>(new ::grpc::ClientReader< $Response$>("
"channel(),"
"::grpc::RpcMethod($Service$_method_names[$Idx$], "
"::grpc::RpcMethod::RpcType::SERVER_STREAMING), "
- "context, request);\n"
+ "context, request));\n"
"}\n\n");
- printer->Print(
- *vars,
- "::grpc::ClientAsyncReader< $Response$>* $Service$::Stub::$Method$("
- "::grpc::ClientContext* context, const $Request$& request, "
- "::grpc::CompletionQueue* cq, void* tag) {\n");
printer->Print(*vars,
- " return new ::grpc::ClientAsyncReader< $Response$>("
+ "std::unique_ptr< ::grpc::ClientAsyncReader< $Response$>> "
+ "$Service$::Stub::$Method$("
+ "::grpc::ClientContext* context, const $Request$& request, "
+ "::grpc::CompletionQueue* cq, void* tag) {\n");
+ printer->Print(*vars,
+ " return std::unique_ptr< ::grpc::ClientAsyncReader< "
+ "$Response$>>(new ::grpc::ClientAsyncReader< $Response$>("
"channel(), cq, "
"::grpc::RpcMethod($Service$_method_names[$Idx$], "
"::grpc::RpcMethod::RpcType::SERVER_STREAMING), "
- "context, request, tag);\n"
+ "context, request, tag));\n"
"}\n\n");
} else if (BidiStreaming(method)) {
printer->Print(
*vars,
- "::grpc::ClientReaderWriter< $Request$, $Response$>* "
+ "std::unique_ptr< ::grpc::ClientReaderWriter< $Request$, $Response$>> "
"$Service$::Stub::$Method$(::grpc::ClientContext* context) {\n");
- printer->Print(
- *vars,
- " return new ::grpc::ClientReaderWriter< $Request$, $Response$>("
- "channel(),"
- "::grpc::RpcMethod($Service$_method_names[$Idx$], "
- "::grpc::RpcMethod::RpcType::BIDI_STREAMING), "
- "context);\n"
- "}\n\n");
- printer->Print(
- *vars,
- "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>* "
- "$Service$::Stub::$Method$(::grpc::ClientContext* context, "
- "::grpc::CompletionQueue* cq, void* tag) {\n");
- printer->Print(
- *vars,
- " return new ::grpc::ClientAsyncReaderWriter< $Request$, $Response$>("
- "channel(), cq, "
- "::grpc::RpcMethod($Service$_method_names[$Idx$], "
- "::grpc::RpcMethod::RpcType::BIDI_STREAMING), "
- "context, tag);\n"
- "}\n\n");
+ printer->Print(*vars,
+ " return std::unique_ptr< ::grpc::ClientReaderWriter< "
+ "$Request$, $Response$>>(new ::grpc::ClientReaderWriter< "
+ "$Request$, $Response$>("
+ "channel(),"
+ "::grpc::RpcMethod($Service$_method_names[$Idx$], "
+ "::grpc::RpcMethod::RpcType::BIDI_STREAMING), "
+ "context));\n"
+ "}\n\n");
+ printer->Print(*vars,
+ "std::unique_ptr< ::grpc::ClientAsyncReaderWriter< "
+ "$Request$, $Response$>> "
+ "$Service$::Stub::$Method$(::grpc::ClientContext* context, "
+ "::grpc::CompletionQueue* cq, void* tag) {\n");
+ printer->Print(*vars,
+ " return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< "
+ "$Request$, $Response$>>(new "
+ "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>("
+ "channel(), cq, "
+ "::grpc::RpcMethod($Service$_method_names[$Idx$], "
+ "::grpc::RpcMethod::RpcType::BIDI_STREAMING), "
+ "context, tag));\n"
+ "}\n\n");
}
}
@@ -587,9 +604,9 @@ void PrintSourceService(google::protobuf::io::Printer *printer,
printer->Print(
*vars,
- "$Service$::Stub* $Service$::NewStub("
+ "std::unique_ptr< $Service$::Stub> $Service$::NewStub("
"const std::shared_ptr< ::grpc::ChannelInterface>& channel) {\n"
- " $Service$::Stub* stub = new $Service$::Stub();\n"
+ " std::unique_ptr< $Service$::Stub> stub(new $Service$::Stub());\n"
" stub->set_channel(channel);\n"
" return stub;\n"
"};\n\n");
diff --git a/src/core/compression/message_compress.c b/src/core/compression/message_compress.c
index 9b8100a3d6..7856f40dd1 100644
--- a/src/core/compression/message_compress.c
+++ b/src/core/compression/message_compress.c
@@ -48,7 +48,6 @@ static int zlib_body(z_stream *zs, gpr_slice_buffer *input,
int r;
int flush;
size_t i;
- size_t output_bytes = 0;
gpr_slice outbuf = gpr_slice_malloc(OUTPUT_BLOCK_SIZE);
zs->avail_out = GPR_SLICE_LENGTH(outbuf);
@@ -60,7 +59,6 @@ static int zlib_body(z_stream *zs, gpr_slice_buffer *input,
zs->next_in = GPR_SLICE_START_PTR(input->slices[i]);
do {
if (zs->avail_out == 0) {
- output_bytes += GPR_SLICE_LENGTH(outbuf);
gpr_slice_buffer_add_indexed(output, outbuf);
outbuf = gpr_slice_malloc(OUTPUT_BLOCK_SIZE);
zs->avail_out = GPR_SLICE_LENGTH(outbuf);
@@ -80,7 +78,6 @@ static int zlib_body(z_stream *zs, gpr_slice_buffer *input,
GPR_ASSERT(outbuf.refcount);
outbuf.data.refcounted.length -= zs->avail_out;
- output_bytes += GPR_SLICE_LENGTH(outbuf);
gpr_slice_buffer_add_indexed(output, outbuf);
return 1;
diff --git a/src/core/debug/trace.c b/src/core/debug/trace.c
index 92acbe924d..b8eb755bff 100644
--- a/src/core/debug/trace.c
+++ b/src/core/debug/trace.c
@@ -81,6 +81,8 @@ static void parse(const char *s) {
grpc_trace_bits |= GRPC_TRACE_TCP;
} else if (0 == strcmp(s, "secure_endpoint")) {
grpc_trace_bits |= GRPC_TRACE_SECURE_ENDPOINT;
+ } else if (0 == strcmp(s, "http")) {
+ grpc_trace_bits |= GRPC_TRACE_HTTP;
} else if (0 == strcmp(s, "all")) {
grpc_trace_bits = -1;
} else {
diff --git a/src/core/debug/trace.h b/src/core/debug/trace.h
index 167ef3c6ea..bf9b8a3642 100644
--- a/src/core/debug/trace.h
+++ b/src/core/debug/trace.h
@@ -45,7 +45,8 @@ typedef enum {
GRPC_TRACE_SURFACE = 1 << 0,
GRPC_TRACE_CHANNEL = 1 << 1,
GRPC_TRACE_TCP = 1 << 2,
- GRPC_TRACE_SECURE_ENDPOINT = 1 << 3
+ GRPC_TRACE_SECURE_ENDPOINT = 1 << 3,
+ GRPC_TRACE_HTTP = 1 << 4
} grpc_trace_bit_value;
#if GRPC_ENABLE_TRACING
diff --git a/src/core/iomgr/resolve_address_posix.c b/src/core/iomgr/resolve_address_posix.c
index edf40b5ad1..989b968ae2 100644
--- a/src/core/iomgr/resolve_address_posix.c
+++ b/src/core/iomgr/resolve_address_posix.c
@@ -66,7 +66,6 @@ grpc_resolved_addresses *grpc_blocking_resolve_address(
int s;
size_t i;
grpc_resolved_addresses *addrs = NULL;
- const gpr_timespec start_time = gpr_now();
struct sockaddr_un *un;
if (name[0] == 'u' && name[1] == 'n' && name[2] == 'i' && name[3] == 'x' &&
@@ -121,22 +120,6 @@ grpc_resolved_addresses *grpc_blocking_resolve_address(
i++;
}
- /* Temporary logging, to help identify flakiness in dualstack_socket_test. */
- {
- const gpr_timespec delay = gpr_time_sub(gpr_now(), start_time);
- const int delay_ms =
- delay.tv_sec * GPR_MS_PER_SEC + delay.tv_nsec / GPR_NS_PER_MS;
- gpr_log(GPR_INFO, "logspam: getaddrinfo(%s, %s) resolved %d addrs in %dms:",
- host, port, addrs->naddrs, delay_ms);
- for (i = 0; i < addrs->naddrs; i++) {
- char *buf;
- grpc_sockaddr_to_string(&buf, (struct sockaddr *)&addrs->addrs[i].addr,
- 0);
- gpr_log(GPR_INFO, "logspam: [%d] %s", i, buf);
- gpr_free(buf);
- }
- }
-
done:
gpr_free(host);
gpr_free(port);
diff --git a/src/core/security/security_context.c b/src/core/security/security_context.c
index 9dce5af740..3629f0499d 100644
--- a/src/core/security/security_context.c
+++ b/src/core/security/security_context.c
@@ -44,7 +44,9 @@
#include "src/core/support/string.h"
#include "src/core/surface/lame_client.h"
#include "src/core/transport/chttp2/alpn.h"
+
#include <grpc/support/alloc.h>
+#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/slice_buffer.h>
#include "src/core/tsi/fake_transport_security.h"
@@ -443,6 +445,7 @@ grpc_security_status grpc_ssl_channel_security_context_create(
size_t i;
const unsigned char *pem_root_certs;
size_t pem_root_certs_size;
+ char *port;
for (i = 0; i < num_alpn_protocols; i++) {
alpn_protocol_strings[i] =
@@ -468,9 +471,8 @@ grpc_security_status grpc_ssl_channel_security_context_create(
c->base.base.url_scheme = GRPC_SSL_URL_SCHEME;
c->base.request_metadata_creds = grpc_credentials_ref(request_metadata_creds);
c->base.check_call_host = ssl_channel_check_call_host;
- if (target_name != NULL) {
- c->target_name = gpr_strdup(target_name);
- }
+ gpr_split_host_port(target_name, &c->target_name, &port);
+ gpr_free(port);
if (overridden_target_name != NULL) {
c->overridden_target_name = gpr_strdup(overridden_target_name);
}
diff --git a/src/core/statistics/census_init.c b/src/core/statistics/census_init.c
index 820d75f795..e6306f5e6f 100644
--- a/src/core/statistics/census_init.c
+++ b/src/core/statistics/census_init.c
@@ -38,13 +38,11 @@
#include "src/core/statistics/census_tracing.h"
void census_init(void) {
- gpr_log(GPR_INFO, "Initialize census library.");
census_tracing_init();
census_stats_store_init();
}
void census_shutdown(void) {
- gpr_log(GPR_INFO, "Shutdown census library.");
census_stats_store_shutdown();
census_tracing_shutdown();
}
diff --git a/src/core/statistics/census_log.c b/src/core/statistics/census_log.c
index 24e46876d2..ec56ce38df 100644
--- a/src/core/statistics/census_log.c
+++ b/src/core/statistics/census_log.c
@@ -475,11 +475,11 @@ void census_log_initialize(size_t size_in_mb, int discard_old_records) {
g_log.block_being_read = NULL;
gpr_atm_rel_store(&g_log.is_full, 0);
g_log.core_local_blocks = (cl_core_local_block*)gpr_malloc_aligned(
- g_log.num_cores * sizeof(cl_core_local_block), GPR_CACHELINE_SIZE);
+ g_log.num_cores * sizeof(cl_core_local_block), GPR_CACHELINE_SIZE_LOG);
memset(g_log.core_local_blocks, 0,
g_log.num_cores * sizeof(cl_core_local_block));
g_log.blocks = (cl_block*)gpr_malloc_aligned(
- g_log.num_blocks * sizeof(cl_block), GPR_CACHELINE_SIZE);
+ g_log.num_blocks * sizeof(cl_block), GPR_CACHELINE_SIZE_LOG);
memset(g_log.blocks, 0, g_log.num_blocks * sizeof(cl_block));
g_log.buffer = gpr_malloc(g_log.num_blocks * CENSUS_LOG_MAX_RECORD_SIZE);
memset(g_log.buffer, 0, g_log.num_blocks * CENSUS_LOG_MAX_RECORD_SIZE);
diff --git a/src/core/statistics/census_rpc_stats.c b/src/core/statistics/census_rpc_stats.c
index 388ce4fe2c..0491c91947 100644
--- a/src/core/statistics/census_rpc_stats.c
+++ b/src/core/statistics/census_rpc_stats.c
@@ -222,7 +222,6 @@ void census_get_server_stats(census_aggregated_rpc_stats* data) {
}
void census_stats_store_init(void) {
- gpr_log(GPR_INFO, "Initialize census stats store.");
init_mutex_once();
gpr_mu_lock(&g_mu);
if (g_client_stats_store == NULL && g_server_stats_store == NULL) {
@@ -235,7 +234,6 @@ void census_stats_store_init(void) {
}
void census_stats_store_shutdown(void) {
- gpr_log(GPR_INFO, "Shutdown census stats store.");
init_mutex_once();
gpr_mu_lock(&g_mu);
if (g_client_stats_store != NULL) {
diff --git a/src/core/statistics/census_tracing.c b/src/core/statistics/census_tracing.c
index adfcbecb4c..05e72b99c0 100644
--- a/src/core/statistics/census_tracing.c
+++ b/src/core/statistics/census_tracing.c
@@ -154,7 +154,6 @@ void census_tracing_end_op(census_op_id op_id) {
}
void census_tracing_init(void) {
- gpr_log(GPR_INFO, "Initialize census trace store.");
init_mutex_once();
gpr_mu_lock(&g_mu);
if (g_trace_store == NULL) {
@@ -167,7 +166,6 @@ void census_tracing_init(void) {
}
void census_tracing_shutdown(void) {
- gpr_log(GPR_INFO, "Shutdown census trace store.");
gpr_mu_lock(&g_mu);
if (g_trace_store != NULL) {
census_ht_destroy(g_trace_store);
diff --git a/src/core/support/alloc.c b/src/core/support/alloc.c
index 44f343b4f4..a19a0141d4 100644
--- a/src/core/support/alloc.c
+++ b/src/core/support/alloc.c
@@ -54,7 +54,8 @@ void *gpr_realloc(void *p, size_t size) {
return p;
}
-void *gpr_malloc_aligned(size_t size, size_t alignment) {
+void *gpr_malloc_aligned(size_t size, size_t alignment_log) {
+ size_t alignment = 1 << alignment_log;
size_t extra = alignment - 1 + sizeof(void *);
void *p = gpr_malloc(size + extra);
void **ret = (void **)(((gpr_uintptr)p + extra) & ~(alignment - 1));
diff --git a/src/core/support/cpu_linux.c b/src/core/support/cpu_linux.c
index ef6bf9ca09..37e840d4cf 100644
--- a/src/core/support/cpu_linux.c
+++ b/src/core/support/cpu_linux.c
@@ -39,25 +39,28 @@
#ifdef GPR_CPU_LINUX
-#include <grpc/support/cpu.h>
-
#include <sched.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
+#include <grpc/support/cpu.h>
#include <grpc/support/log.h>
+#include <grpc/support/sync.h>
-unsigned gpr_cpu_num_cores(void) {
- static int ncpus = 0;
- /* FIXME: !threadsafe */
- if (ncpus == 0) {
- ncpus = sysconf(_SC_NPROCESSORS_ONLN);
- if (ncpus < 1) {
- gpr_log(GPR_ERROR, "Cannot determine number of CPUs: assuming 1");
- ncpus = 1;
- }
+static int ncpus = 0;
+
+static void init_num_cpus() {
+ ncpus = sysconf(_SC_NPROCESSORS_ONLN);
+ if (ncpus < 1) {
+ gpr_log(GPR_ERROR, "Cannot determine number of CPUs: assuming 1");
+ ncpus = 1;
}
+}
+
+unsigned gpr_cpu_num_cores(void) {
+ static gpr_once once = GPR_ONCE_INIT;
+ gpr_once_init(&once, init_num_cpus);
return ncpus;
}
diff --git a/src/core/support/cpu_posix.c b/src/core/support/cpu_posix.c
index 91ce80c364..33c7b90b0b 100644
--- a/src/core/support/cpu_posix.c
+++ b/src/core/support/cpu_posix.c
@@ -43,15 +43,19 @@
static __thread char magic_thread_local;
-unsigned gpr_cpu_num_cores(void) {
- static int ncpus = 0;
- if (ncpus == 0) {
- ncpus = sysconf(_SC_NPROCESSORS_ONLN);
- if (ncpus < 1) {
- gpr_log(GPR_ERROR, "Cannot determine number of CPUs: assuming 1");
- ncpus = 1;
- }
+static int ncpus = 0;
+
+static void init_ncpus() {
+ ncpus = sysconf(_SC_NPROCESSORS_ONLN);
+ if (ncpus < 1) {
+ gpr_log(GPR_ERROR, "Cannot determine number of CPUs: assuming 1");
+ ncpus = 1;
}
+}
+
+unsigned gpr_cpu_num_cores(void) {
+ static gpr_once once = GPR_ONCE_INIT;
+ gpr_once_init(&once, init_num_cpus);
return ncpus;
}
diff --git a/src/core/support/log_win32.c b/src/core/support/log_win32.c
index cff130ae18..720dc141f5 100644
--- a/src/core/support/log_win32.c
+++ b/src/core/support/log_win32.c
@@ -90,7 +90,7 @@ void gpr_default_log(gpr_log_func_args *args) {
strcpy(time_buffer, "error:strftime");
}
- fprintf(stderr, "%s%s.%09u %5u %s:%d: %s\n",
+ fprintf(stderr, "%s%s.%09u %5u %s:%d] %s\n",
gpr_log_severity_string(args->severity), time_buffer,
(int)(now.tv_nsec), GetCurrentThreadId(),
args->file, args->line, args->message);
diff --git a/src/core/support/string.c b/src/core/support/string.c
index f3d26b45ac..bfd7ce1590 100644
--- a/src/core/support/string.c
+++ b/src/core/support/string.c
@@ -91,7 +91,6 @@ char *gpr_hexdump(const char *buf, size_t len, gpr_uint32 flags) {
}
if (flags & GPR_HEXDUMP_PLAINTEXT) {
- cur = beg;
if (len) hexout_append(&out, ' ');
hexout_append(&out, '\'');
for (cur = beg; cur != end; ++cur) {
diff --git a/src/core/support/string_posix.c b/src/core/support/string_posix.c
index 8a678b3103..25c333db4e 100644
--- a/src/core/support/string_posix.c
+++ b/src/core/support/string_posix.c
@@ -51,7 +51,7 @@ int gpr_asprintf(char **strp, const char *format, ...) {
va_start(args, format);
ret = vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
- if (!(0 <= ret)) {
+ if (ret < 0) {
*strp = NULL;
return -1;
}
diff --git a/src/core/support/sync.c b/src/core/support/sync.c
index 1a5cf57c4f..ccfe1e25f4 100644
--- a/src/core/support/sync.c
+++ b/src/core/support/sync.c
@@ -41,7 +41,7 @@
Should be a prime. */
enum { event_sync_partitions = 31 };
-/* Event are partitioned by address to avoid lock contention. */
+/* Events are partitioned by address to avoid lock contention. */
static struct sync_array_s {
gpr_mu mu;
gpr_cv cv;
@@ -71,10 +71,10 @@ void gpr_event_set(gpr_event *ev, void *value) {
struct sync_array_s *s = hash(ev);
gpr_mu_lock(&s->mu);
GPR_ASSERT(gpr_atm_acq_load(&ev->state) == 0);
- GPR_ASSERT(value != NULL);
gpr_atm_rel_store(&ev->state, (gpr_atm)value);
gpr_cv_broadcast(&s->cv);
gpr_mu_unlock(&s->mu);
+ GPR_ASSERT(value != NULL);
}
void *gpr_event_get(gpr_event *ev) {
diff --git a/src/core/support/time.c b/src/core/support/time.c
index 67f7665650..7dbf95059f 100644
--- a/src/core/support/time.c
+++ b/src/core/support/time.c
@@ -85,12 +85,12 @@ gpr_timespec gpr_time_from_nanos(long ns) {
} else if (ns == LONG_MIN) {
result = gpr_inf_past;
} else if (ns >= 0) {
- result.tv_sec = ns / 1000000000;
- result.tv_nsec = ns - result.tv_sec * 1000000000;
+ result.tv_sec = ns / GPR_NS_PER_SEC;
+ result.tv_nsec = ns - result.tv_sec * GPR_NS_PER_SEC;
} else {
/* Calculation carefully formulated to avoid any possible under/overflow. */
- result.tv_sec = (-(999999999 - (ns + 1000000000)) / 1000000000) - 1;
- result.tv_nsec = ns - result.tv_sec * 1000000000;
+ result.tv_sec = (-(999999999 - (ns + GPR_NS_PER_SEC)) / GPR_NS_PER_SEC) - 1;
+ result.tv_nsec = ns - result.tv_sec * GPR_NS_PER_SEC;
}
return result;
}
@@ -172,8 +172,8 @@ gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b) {
gpr_timespec sum;
int inc = 0;
sum.tv_nsec = a.tv_nsec + b.tv_nsec;
- if (sum.tv_nsec >= 1000000000) {
- sum.tv_nsec -= 1000000000;
+ if (sum.tv_nsec >= GPR_NS_PER_SEC) {
+ sum.tv_nsec -= GPR_NS_PER_SEC;
inc++;
}
if (a.tv_sec == TYPE_MAX(time_t) || a.tv_sec == TYPE_MIN(time_t)) {
@@ -200,7 +200,7 @@ gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b) {
int dec = 0;
diff.tv_nsec = a.tv_nsec - b.tv_nsec;
if (diff.tv_nsec < 0) {
- diff.tv_nsec += 1000000000;
+ diff.tv_nsec += GPR_NS_PER_SEC;
dec++;
}
if (a.tv_sec == TYPE_MAX(time_t) || a.tv_sec == TYPE_MIN(time_t)) {
diff --git a/src/core/transport/chttp2/frame_settings.c b/src/core/transport/chttp2/frame_settings.c
index 06429e220b..e6c4b7e38f 100644
--- a/src/core/transport/chttp2/frame_settings.c
+++ b/src/core/transport/chttp2/frame_settings.c
@@ -35,6 +35,7 @@
#include <string.h>
+#include "src/core/debug/trace.h"
#include "src/core/transport/chttp2/frame.h"
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
@@ -53,7 +54,8 @@ const grpc_chttp2_setting_parameters
{"MAX_FRAME_SIZE", 16384, 16384, 16777215,
GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE},
{"MAX_HEADER_LIST_SIZE", 0xffffffffu, 0, 0xffffffffu,
- GRPC_CHTTP2_CLAMP_INVALID_VALUE}, };
+ GRPC_CHTTP2_CLAMP_INVALID_VALUE},
+};
static gpr_uint8 *fill_header(gpr_uint8 *out, gpr_uint32 length,
gpr_uint8 flags) {
@@ -155,7 +157,7 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse(
}
return GRPC_CHTTP2_PARSE_OK;
}
- parser->id = ((gpr_uint16) * cur) << 8;
+ parser->id = ((gpr_uint16)*cur) << 8;
cur++;
/* fallthrough */
case GRPC_CHTTP2_SPS_ID1:
@@ -171,7 +173,7 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse(
parser->state = GRPC_CHTTP2_SPS_VAL0;
return GRPC_CHTTP2_PARSE_OK;
}
- parser->value = ((gpr_uint32) * cur) << 24;
+ parser->value = ((gpr_uint32)*cur) << 24;
cur++;
/* fallthrough */
case GRPC_CHTTP2_SPS_VAL1:
@@ -179,7 +181,7 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse(
parser->state = GRPC_CHTTP2_SPS_VAL1;
return GRPC_CHTTP2_PARSE_OK;
}
- parser->value |= ((gpr_uint32) * cur) << 16;
+ parser->value |= ((gpr_uint32)*cur) << 16;
cur++;
/* fallthrough */
case GRPC_CHTTP2_SPS_VAL2:
@@ -187,7 +189,7 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse(
parser->state = GRPC_CHTTP2_SPS_VAL2;
return GRPC_CHTTP2_PARSE_OK;
}
- parser->value |= ((gpr_uint32) * cur) << 8;
+ parser->value |= ((gpr_uint32)*cur) << 8;
cur++;
/* fallthrough */
case GRPC_CHTTP2_SPS_VAL3:
@@ -216,8 +218,10 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse(
}
}
parser->incoming_settings[parser->id] = parser->value;
- gpr_log(GPR_DEBUG, "CHTTP2: got setting %d = %d", parser->id,
- parser->value);
+ if (grpc_trace_bits & GRPC_TRACE_HTTP) {
+ gpr_log(GPR_DEBUG, "CHTTP2: got setting %d = %d", parser->id,
+ parser->value);
+ }
} else {
gpr_log(GPR_ERROR, "CHTTP2: Ignoring unknown setting %d (value %d)",
parser->id, parser->value);
diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c
index ccd8d0c376..e9f1cd7842 100644
--- a/src/core/transport/chttp2_transport.c
+++ b/src/core/transport/chttp2_transport.c
@@ -37,6 +37,7 @@
#include <stdio.h>
#include <string.h>
+#include "src/core/debug/trace.h"
#include "src/core/support/string.h"
#include "src/core/transport/chttp2/frame_data.h"
#include "src/core/transport/chttp2/frame_goaway.h"
@@ -66,6 +67,12 @@
typedef struct transport transport;
typedef struct stream stream;
+#define IF_TRACING(stmt) \
+ if (!(grpc_trace_bits & GRPC_TRACE_HTTP)) \
+ ; \
+ else \
+ stmt
+
/* streams are kept in various linked lists depending on what things need to
happen to them... this enum labels each list */
typedef enum {
@@ -552,7 +559,7 @@ static int init_stream(grpc_transport *gt, grpc_stream *gs,
lock(t);
s->id = 0;
} else {
- s->id = (gpr_uint32)(gpr_uintptr)server_data;
+ s->id = (gpr_uint32)(gpr_uintptr) server_data;
t->incoming_stream = s;
grpc_chttp2_stream_map_add(&t->stream_map, s->id, s);
}
@@ -1206,6 +1213,11 @@ static void on_header(void *tp, grpc_mdelem *md) {
stream *s = t->incoming_stream;
GPR_ASSERT(s);
+
+ IF_TRACING(gpr_log(GPR_INFO, "HTTP:%d:HDR: %s: %s", s->id,
+ grpc_mdstr_as_c_string(md->key),
+ grpc_mdstr_as_c_string(md->value)));
+
stream_list_join(t, s, PENDING_CALLBACKS);
if (md->key == t->str_grpc_timeout) {
gpr_timespec *cached_timeout = grpc_mdelem_get_user_data(md, free_timeout);
@@ -1269,7 +1281,7 @@ static int init_header_frame_parser(transport *t, int is_continuation) {
t->incoming_stream = NULL;
/* if stream is accepted, we set incoming_stream in init_stream */
t->cb->accept_stream(t->cb_user_data, &t->base,
- (void *)(gpr_uintptr)t->incoming_stream_id);
+ (void *)(gpr_uintptr) t->incoming_stream_id);
s = t->incoming_stream;
if (!s) {
gpr_log(GPR_ERROR, "stream not accepted");
@@ -1534,8 +1546,8 @@ static int process_read(transport *t, gpr_slice slice) {
"Connect string mismatch: expected '%c' (%d) got '%c' (%d) "
"at byte %d",
CLIENT_CONNECT_STRING[t->deframe_state],
- (int)(gpr_uint8)CLIENT_CONNECT_STRING[t->deframe_state], *cur,
- (int)*cur, t->deframe_state);
+ (int)(gpr_uint8) CLIENT_CONNECT_STRING[t->deframe_state],
+ *cur, (int)*cur, t->deframe_state);
drop_connection(t);
return 0;
}
@@ -1765,9 +1777,9 @@ static void add_to_pollset(grpc_transport *gt, grpc_pollset *pollset) {
*/
static const grpc_transport_vtable vtable = {
- sizeof(stream), init_stream, send_batch, set_allow_window_updates,
- add_to_pollset, destroy_stream, abort_stream, goaway, close_transport,
- send_ping, destroy_transport};
+ sizeof(stream), init_stream, send_batch, set_allow_window_updates,
+ add_to_pollset, destroy_stream, abort_stream, goaway,
+ close_transport, send_ping, destroy_transport};
void grpc_create_chttp2_transport(grpc_transport_setup_callback setup,
void *arg,
diff --git a/src/core/tsi/ssl_transport_security.c b/src/core/tsi/ssl_transport_security.c
index 567b990610..9ca8e6ddc9 100644
--- a/src/core/tsi/ssl_transport_security.c
+++ b/src/core/tsi/ssl_transport_security.c
@@ -1205,6 +1205,7 @@ tsi_result tsi_create_ssl_client_handshaker_factory(
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Building alpn list failed with error %s.",
tsi_result_to_string(result));
+ free(alpn_protocol_list);
break;
}
ssl_failed = SSL_CTX_set_alpn_protos(ssl_context, alpn_protocol_list,
diff --git a/src/cpp/client/create_channel.cc b/src/cpp/client/create_channel.cc
index acf51cb90b..583e072799 100644
--- a/src/cpp/client/create_channel.cc
+++ b/src/cpp/client/create_channel.cc
@@ -40,8 +40,8 @@
namespace grpc {
class ChannelArguments;
-std::shared_ptr<ChannelInterface> CreateChannel(const grpc::string &target,
- const ChannelArguments &args) {
+std::shared_ptr<ChannelInterface> CreateChannelDeprecated(
+ const grpc::string &target, const ChannelArguments &args) {
return std::shared_ptr<ChannelInterface>(new Channel(target, args));
}
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc
index f565d3aa5d..178fa1a716 100644
--- a/src/cpp/server/server.cc
+++ b/src/cpp/server/server.cc
@@ -265,21 +265,26 @@ bool Server::Start() {
}
void Server::Shutdown() {
- {
- std::unique_lock<std::mutex> lock(mu_);
- if (started_ && !shutdown_) {
- shutdown_ = true;
- grpc_server_shutdown(server_);
- cq_.Shutdown();
+ std::unique_lock<std::mutex> lock(mu_);
+ if (started_ && !shutdown_) {
+ shutdown_ = true;
+ grpc_server_shutdown(server_);
+ cq_.Shutdown();
- // Wait for running callbacks to finish.
- while (num_running_cb_ != 0) {
- callback_cv_.wait(lock);
- }
+ // Wait for running callbacks to finish.
+ while (num_running_cb_ != 0) {
+ callback_cv_.wait(lock);
}
}
}
+void Server::Wait() {
+ std::unique_lock<std::mutex> lock(mu_);
+ while (num_running_cb_ != 0) {
+ callback_cv_.wait(lock);
+ }
+}
+
void Server::PerformOpsOnCall(CallOpBuffer* buf, Call* call) {
static const size_t MAX_OPS = 8;
size_t nops = MAX_OPS;
diff --git a/src/cpp/server/thread_pool.cc b/src/cpp/server/thread_pool.cc
index 1ca98129d3..fa11ddd04c 100644
--- a/src/cpp/server/thread_pool.cc
+++ b/src/cpp/server/thread_pool.cc
@@ -37,11 +37,11 @@ namespace grpc {
ThreadPool::ThreadPool(int num_threads) {
for (int i = 0; i < num_threads; i++) {
- threads_.push_back(std::thread([=]() {
+ threads_.push_back(std::thread([this]() {
for (;;) {
- std::unique_lock<std::mutex> lock(mu_);
// Wait until work is available or we are shutting down.
- auto have_work = [=]() { return shutdown_ || !callbacks_.empty(); };
+ auto have_work = [this]() { return shutdown_ || !callbacks_.empty(); };
+ std::unique_lock<std::mutex> lock(mu_);
if (!have_work()) {
cv_.wait(lock, have_work);
}
diff --git a/src/node/examples/pubsub/pubsub_demo.js b/src/node/examples/pubsub/pubsub_demo.js
index a9b6acbd7e..26301515f0 100644
--- a/src/node/examples/pubsub/pubsub_demo.js
+++ b/src/node/examples/pubsub/pubsub_demo.js
@@ -1,35 +1,41 @@
-// 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.
+/*
+ *
+ * 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.
+ *
+ */
+
+'use strict';
var async = require('async');
var fs = require('fs');
-var GoogleAuth = require('googleauth');
+var GoogleAuth = require('google-auth-library');
var parseArgs = require('minimist');
var strftime = require('strftime');
var _ = require('underscore');
@@ -270,7 +276,9 @@ function main(callback) {
if (require.main === module) {
main(function(err) {
- if (err) throw err;
+ if (err) {
+ throw err;
+ }
});
}
diff --git a/src/node/examples/route_guide_client.js b/src/node/examples/route_guide_client.js
index d4c083a6c5..0b3e9c5819 100644
--- a/src/node/examples/route_guide_client.js
+++ b/src/node/examples/route_guide_client.js
@@ -1,31 +1,37 @@
-// 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.
+/*
+ *
+ * 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.
+ *
+ */
+
+'use strict';
var async = require('async');
var fs = require('fs');
@@ -110,7 +116,9 @@ function runRecordRoute(callback) {
string: 'db_path'
});
fs.readFile(path.resolve(argv.db_path), function(err, data) {
- if (err) callback(err);
+ if (err) {
+ callback(err);
+ }
var feature_list = JSON.parse(data);
var num_points = 10;
diff --git a/src/node/examples/route_guide_server.js b/src/node/examples/route_guide_server.js
index bc9ed25101..9555368422 100644
--- a/src/node/examples/route_guide_server.js
+++ b/src/node/examples/route_guide_server.js
@@ -1,31 +1,37 @@
-// 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.
+/*
+ *
+ * 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.
+ *
+ */
+
+'use strict';
var fs = require('fs');
var parseArgs = require('minimist');
@@ -51,7 +57,7 @@ var COORD_FACTOR = 1e7;
var feature_list = [];
/**
- * Get a feature object at the given point, or creates one if it does not exist.
+ * Get a feature object at the given point.
* @param {point} point The point to check
* @return {feature} The feature object at the point. Note that an empty name
* indicates no feature
@@ -163,7 +169,7 @@ function recordRoute(call, callback) {
}
/* For each point after the first, add the incremental distance from the
* previous point to the total distance value */
- if (previous != null) {
+ if (previous !== null) {
distance += getDistance(previous, point);
}
previous = point;
@@ -173,7 +179,7 @@ function recordRoute(call, callback) {
point_count: point_count,
feature_count: feature_count,
// Cast the distance to an integer
- distance: distance|0,
+ distance: Math.floor(distance),
// End the timer
elapsed_time: process.hrtime(start_time)[0]
});
@@ -240,7 +246,9 @@ if (require.main === module) {
string: 'db_path'
});
fs.readFile(path.resolve(argv.db_path), function(err, data) {
- if (err) throw err;
+ if (err) {
+ throw err;
+ }
feature_list = JSON.parse(data);
routeServer.listen();
});
diff --git a/src/node/ext/credentials.cc b/src/node/ext/credentials.cc
index 4b95c72bf7..3f65d59c76 100644
--- a/src/node/ext/credentials.cc
+++ b/src/node/ext/credentials.cc
@@ -130,7 +130,7 @@ NAN_METHOD(Credentials::New) {
NAN_METHOD(Credentials::CreateDefault) {
NanScope();
- NanReturnValue(WrapStruct(grpc_default_credentials_create()));
+ NanReturnValue(WrapStruct(grpc_google_default_credentials_create()));
}
NAN_METHOD(Credentials::CreateSsl) {
diff --git a/src/node/index.js b/src/node/index.js
index 4b5302e438..ad3dd96af7 100644
--- a/src/node/index.js
+++ b/src/node/index.js
@@ -78,7 +78,7 @@ function load(filename) {
/**
* Get a function that a client can use to update metadata with authentication
* information from a Google Auth credential object, which comes from the
- * googleauth library.
+ * google-auth-library.
* @param {Object} credential The credential object to use
* @return {function(Object, callback)} Metadata updater function
*/
diff --git a/src/node/interop/interop_client.js b/src/node/interop/interop_client.js
index eaf254bcfe..8060baf827 100644
--- a/src/node/interop/interop_client.js
+++ b/src/node/interop/interop_client.js
@@ -37,7 +37,7 @@ var fs = require('fs');
var path = require('path');
var grpc = require('..');
var testProto = grpc.load(__dirname + '/test.proto').grpc.testing;
-var GoogleAuth = require('googleauth');
+var GoogleAuth = require('google-auth-library');
var assert = require('assert');
diff --git a/src/node/interop/messages.proto b/src/node/interop/messages.proto
index 65a8140465..de0b1a2320 100644
--- a/src/node/interop/messages.proto
+++ b/src/node/interop/messages.proto
@@ -49,7 +49,7 @@ enum PayloadType {
// A block of data, to simply increase gRPC message size.
message Payload {
// The type of data in body.
- optional PayloadType type = 1;
+ optional PayloadType type = 1 [default = COMPRESSABLE];
// Primary contents of payload.
optional bytes body = 2;
}
@@ -58,7 +58,7 @@ message Payload {
message SimpleRequest {
// Desired payload type in the response from the server.
// If response_type is RANDOM, server randomly chooses one from other formats.
- optional PayloadType response_type = 1;
+ optional PayloadType response_type = 1 [default = COMPRESSABLE];
// Desired payload size in the response from the server.
// If response_type is COMPRESSABLE, this denotes the size before compression.
@@ -116,7 +116,7 @@ message StreamingOutputCallRequest {
// If response_type is RANDOM, the payload from each response in the stream
// might be of different types. This is to simulate a mixed type of payload
// stream.
- optional PayloadType response_type = 1;
+ optional PayloadType response_type = 1 [default = COMPRESSABLE];
// Configuration for each expected response message.
repeated ResponseParameters response_parameters = 2;
diff --git a/src/node/package.json b/src/node/package.json
index e6ac550554..1c44b106fb 100644
--- a/src/node/package.json
+++ b/src/node/package.json
@@ -16,7 +16,7 @@
},
"devDependencies": {
"async": "^0.9.0",
- "googleauth": "google/google-auth-library-nodejs",
+ "google-auth-library": "^0.9.2",
"minimist": "^1.1.0",
"mocha": "~1.21.0",
"strftime": "^0.8.2"
diff --git a/src/node/src/client.js b/src/node/src/client.js
index aaa7be79c9..54b8dbdc9c 100644
--- a/src/node/src/client.js
+++ b/src/node/src/client.js
@@ -245,7 +245,9 @@ function makeUnaryRequestFunction(method, serialize, deserialize) {
return;
}
if (response.status.code !== grpc.status.OK) {
- callback(response.status);
+ var error = new Error(response.status.details);
+ error.code = response.status.code;
+ callback(error);
return;
}
emitter.emit('status', response.status);
@@ -314,7 +316,9 @@ function makeClientStreamRequestFunction(method, serialize, deserialize) {
return;
}
if (response.status.code !== grpc.status.OK) {
- callback(response.status);
+ var error = new Error(response.status.details);
+ error.code = response.status.code;
+ callback(error);
return;
}
stream.emit('status', response.status);
diff --git a/src/python/src/grpc/_adapter/rear.py b/src/python/src/grpc/_adapter/rear.py
index 3fbcb24094..94ff66ffda 100644
--- a/src/python/src/grpc/_adapter/rear.py
+++ b/src/python/src/grpc/_adapter/rear.py
@@ -170,7 +170,8 @@ class RearLink(ticket_interfaces.RearLink, activated.Activated):
if event.status.code is _low.Code.OK:
category = tickets.Kind.COMPLETION
elif event.status.code is _low.Code.CANCELLED:
- category = tickets.Kind.CANCELLATION
+ # TODO(issue 752): Use a CANCELLATION ticket kind here.
+ category = tickets.Kind.SERVICER_FAILURE
elif event.status.code is _low.Code.EXPIRED:
category = tickets.Kind.EXPIRATION
else:
@@ -382,6 +383,8 @@ class _ActivatedRearLink(ticket_interfaces.RearLink, activated.Activated):
def join_fore_link(self, fore_link):
with self._lock:
self._fore_link = null.NULL_FORE_LINK if fore_link is None else fore_link
+ if self._rear_link is not None:
+ self._rear_link.join_fore_link(self._fore_link)
def _start(self):
with self._lock:
diff --git a/src/ruby/ext/grpc/rb_credentials.c b/src/ruby/ext/grpc/rb_credentials.c
index 778270735b..4ee5d6b51c 100644
--- a/src/ruby/ext/grpc/rb_credentials.c
+++ b/src/ruby/ext/grpc/rb_credentials.c
@@ -125,7 +125,7 @@ static VALUE grpc_rb_credentials_init_copy(VALUE copy, VALUE orig) {
Creates the default credential instances. */
static VALUE grpc_rb_default_credentials_create(VALUE cls) {
grpc_rb_credentials *wrapper = ALLOC(grpc_rb_credentials);
- wrapper->wrapped = grpc_default_credentials_create();
+ wrapper->wrapped = grpc_google_default_credentials_create();
if (wrapper->wrapped == NULL) {
rb_raise(rb_eRuntimeError,
"could not create default credentials, not sure why");
diff --git a/src/ruby/spec/generic/active_call_spec.rb b/src/ruby/spec/generic/active_call_spec.rb
index 84bb7b4f9b..12cb5c1558 100644
--- a/src/ruby/spec/generic/active_call_spec.rb
+++ b/src/ruby/spec/generic/active_call_spec.rb
@@ -67,7 +67,7 @@ describe GRPC::ActiveCall do
end
describe '#multi_req_view' do
- it 'exposes a fixed subset of the ActiveCall methods' do
+ xit 'exposes a fixed subset of the ActiveCall methods' do
want = %w(cancelled, deadline, each_remote_read, shutdown)
v = @client_call.multi_req_view
want.each do |w|
@@ -77,7 +77,7 @@ describe GRPC::ActiveCall do
end
describe '#single_req_view' do
- it 'exposes a fixed subset of the ActiveCall methods' do
+ xit 'exposes a fixed subset of the ActiveCall methods' do
want = %w(cancelled, deadline, shutdown)
v = @client_call.single_req_view
want.each do |w|
diff --git a/templates/Makefile.template b/templates/Makefile.template
index cd7eb23845..8240996cfc 100644
--- a/templates/Makefile.template
+++ b/templates/Makefile.template
@@ -274,7 +274,7 @@ HAS_SYSTEM_ZLIB = false
HAS_SYSTEM_PROTOBUF = false
endif
-HAS_PROTOC = $(shell $(PROTOC_CMD) && echo true || echo false)
+HAS_PROTOC = $(shell $(PROTOC_CMD) > /dev/null && echo true || echo false)
ifeq ($(HAS_PROTOC),true)
HAS_VALID_PROTOC = $(shell $(PROTOC_CHECK_CMD) 2> /dev/null && echo true || echo false)
else
@@ -830,7 +830,7 @@ install-certs: etc/roots.pem
$(Q) $(INSTALL) etc/roots.pem $(prefix)/share/grpc/roots.pem
verify-install:
-ifeq ($(SYSTEM_OK),true)
+ifeq ($(INSTALL_OK),true)
@echo "Your system looks ready to go."
@echo
else
diff --git a/test/core/support/time_test.c b/test/core/support/time_test.c
index 2741e17f95..c1dce777b0 100644
--- a/test/core/support/time_test.c
+++ b/test/core/support/time_test.c
@@ -81,7 +81,7 @@ static void ts_to_s(gpr_timespec t,
void *arg) {
if (t.tv_sec < 0 && t.tv_nsec != 0) {
t.tv_sec++;
- t.tv_nsec = 1000000000 - t.tv_nsec;
+ t.tv_nsec = GPR_NS_PER_SEC - t.tv_nsec;
}
i_to_s(t.tv_sec, 10, 0, writer, arg);
(*writer)(arg, ".", 1);
@@ -127,15 +127,15 @@ static void test_values(void) {
/* Test possible overflow in conversion of -ve values. */
x = gpr_time_from_micros(-(LONG_MAX - 999997));
GPR_ASSERT(x.tv_sec < 0);
- GPR_ASSERT(x.tv_nsec >= 0 && x.tv_nsec < 1000000000);
+ GPR_ASSERT(x.tv_nsec >= 0 && x.tv_nsec < GPR_NS_PER_SEC);
x = gpr_time_from_nanos(-(LONG_MAX - 999999997));
GPR_ASSERT(x.tv_sec < 0);
- GPR_ASSERT(x.tv_nsec >= 0 && x.tv_nsec < 1000000000);
+ GPR_ASSERT(x.tv_nsec >= 0 && x.tv_nsec < GPR_NS_PER_SEC);
x = gpr_time_from_millis(-(LONG_MAX - 997));
GPR_ASSERT(x.tv_sec < 0);
- GPR_ASSERT(x.tv_nsec >= 0 && x.tv_nsec < 1000000000);
+ GPR_ASSERT(x.tv_nsec >= 0 && x.tv_nsec < GPR_NS_PER_SEC);
/* Test general -ve values. */
for (i = -1; i > -1000 * 1000 * 1000; i *= 7) {
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc
index 248e054e49..9e25a5308d 100644
--- a/test/cpp/end2end/async_end2end_test.cc
+++ b/test/cpp/end2end/async_end2end_test.cc
@@ -105,8 +105,8 @@ class AsyncEnd2endTest : public ::testing::Test {
void ResetStub() {
std::shared_ptr<ChannelInterface> channel =
- CreateChannel(server_address_.str(), ChannelArguments());
- stub_.reset(grpc::cpp::test::util::TestService::NewStub(channel));
+ CreateChannelDeprecated(server_address_.str(), ChannelArguments());
+ stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel));
}
void server_ok(int i) {
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc
index d4ca3ef49e..45f12a9e9d 100644
--- a/test/cpp/end2end/end2end_test.cc
+++ b/test/cpp/end2end/end2end_test.cc
@@ -161,8 +161,8 @@ class End2endTest : public ::testing::Test {
void ResetStub() {
std::shared_ptr<ChannelInterface> channel =
- CreateChannel(server_address_.str(), ChannelArguments());
- stub_.reset(grpc::cpp::test::util::TestService::NewStub(channel));
+ CreateChannelDeprecated(server_address_.str(), ChannelArguments());
+ stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel));
}
std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_;
@@ -292,15 +292,13 @@ TEST_F(End2endTest, RequestStreamOneRequest) {
EchoResponse response;
ClientContext context;
- ClientWriter<EchoRequest>* stream = stub_->RequestStream(&context, &response);
+ auto stream = stub_->RequestStream(&context, &response);
request.set_message("hello");
EXPECT_TRUE(stream->Write(request));
stream->WritesDone();
Status s = stream->Finish();
EXPECT_EQ(response.message(), request.message());
EXPECT_TRUE(s.IsOk());
-
- delete stream;
}
TEST_F(End2endTest, RequestStreamTwoRequests) {
@@ -309,7 +307,7 @@ TEST_F(End2endTest, RequestStreamTwoRequests) {
EchoResponse response;
ClientContext context;
- ClientWriter<EchoRequest>* stream = stub_->RequestStream(&context, &response);
+ auto stream = stub_->RequestStream(&context, &response);
request.set_message("hello");
EXPECT_TRUE(stream->Write(request));
EXPECT_TRUE(stream->Write(request));
@@ -317,8 +315,6 @@ TEST_F(End2endTest, RequestStreamTwoRequests) {
Status s = stream->Finish();
EXPECT_EQ(response.message(), "hellohello");
EXPECT_TRUE(s.IsOk());
-
- delete stream;
}
TEST_F(End2endTest, ResponseStream) {
@@ -328,8 +324,7 @@ TEST_F(End2endTest, ResponseStream) {
ClientContext context;
request.set_message("hello");
- ClientReader<EchoResponse>* stream =
- stub_->ResponseStream(&context, request);
+ auto stream = stub_->ResponseStream(&context, request);
EXPECT_TRUE(stream->Read(&response));
EXPECT_EQ(response.message(), request.message() + "0");
EXPECT_TRUE(stream->Read(&response));
@@ -340,8 +335,6 @@ TEST_F(End2endTest, ResponseStream) {
Status s = stream->Finish();
EXPECT_TRUE(s.IsOk());
-
- delete stream;
}
TEST_F(End2endTest, BidiStream) {
@@ -351,8 +344,7 @@ TEST_F(End2endTest, BidiStream) {
ClientContext context;
grpc::string msg("hello");
- ClientReaderWriter<EchoRequest, EchoResponse>* stream =
- stub_->BidiStream(&context);
+ auto stream = stub_->BidiStream(&context);
request.set_message(msg + "0");
EXPECT_TRUE(stream->Write(request));
@@ -374,15 +366,13 @@ TEST_F(End2endTest, BidiStream) {
Status s = stream->Finish();
EXPECT_TRUE(s.IsOk());
-
- delete stream;
}
// Talk to the two services with the same name but different package names.
// The two stubs are created on the same channel.
TEST_F(End2endTest, DiffPackageServices) {
std::shared_ptr<ChannelInterface> channel =
- CreateChannel(server_address_.str(), ChannelArguments());
+ CreateChannelDeprecated(server_address_.str(), ChannelArguments());
EchoRequest request;
EchoResponse response;
@@ -426,14 +416,11 @@ TEST_F(End2endTest, BadCredentials) {
EXPECT_EQ("Rpc sent on a lame channel.", s.details());
ClientContext context2;
- ClientReaderWriter<EchoRequest, EchoResponse>* stream =
- stub->BidiStream(&context2);
+ auto stream = stub->BidiStream(&context2);
s = stream->Finish();
EXPECT_FALSE(s.IsOk());
EXPECT_EQ(StatusCode::UNKNOWN, s.code());
EXPECT_EQ("Rpc sent on a lame channel.", s.details());
-
- delete stream;
}
} // namespace testing
diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc
index 99b3c2ecd4..745496f463 100644
--- a/test/cpp/util/create_test_channel.cc
+++ b/test/cpp/util/create_test_channel.cc
@@ -79,7 +79,7 @@ std::shared_ptr<ChannelInterface> CreateTestChannel(
}
return CreateChannel(connect_to, channel_creds, channel_args);
} else {
- return CreateChannel(server, channel_args);
+ return CreateChannelDeprecated(server, channel_args);
}
}
diff --git a/tools/dockerfile/grpc_build_deb/Dockerfile b/tools/dockerfile/grpc_build_deb/Dockerfile
index ad26fb35d0..6cba74e4c6 100644
--- a/tools/dockerfile/grpc_build_deb/Dockerfile
+++ b/tools/dockerfile/grpc_build_deb/Dockerfile
@@ -1,3 +1,32 @@
+# 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.
+
# Dockerfile to build Debian packages for gRPC C core.
FROM grpc/base
diff --git a/tools/dockerfile/grpc_ruby_deb/Dockerfile b/tools/dockerfile/grpc_ruby_deb/Dockerfile
index 25ea2c54bd..679fa51f5d 100644
--- a/tools/dockerfile/grpc_ruby_deb/Dockerfile
+++ b/tools/dockerfile/grpc_ruby_deb/Dockerfile
@@ -1,3 +1,32 @@
+# 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.
+
# Dockerfile for gRPC Ruby, but using Debian packages for gRPC C core.
FROM grpc/ruby_base
diff --git a/tools/gce_setup/cloud_prod_runner.sh b/tools/gce_setup/cloud_prod_runner.sh
index 52e9b5e2a3..4732f952c2 100755
--- a/tools/gce_setup/cloud_prod_runner.sh
+++ b/tools/gce_setup/cloud_prod_runner.sh
@@ -32,6 +32,7 @@
main() {
source grpc_docker.sh
test_cases=(large_unary empty_unary ping_pong client_streaming server_streaming service_account_creds compute_engine_creds)
+ auth_test_cases=(service_account_creds compute_engine_creds)
clients=(cxx java go ruby node)
for test_case in "${test_cases[@]}"
do
@@ -45,6 +46,18 @@ main() {
fi
done
done
+ for test_case in "${auth_test_cases[@]}"
+ do
+ for client in "${clients[@]}"
+ do
+ if grpc_cloud_prod_auth_test $test_case grpc-docker-testclients $client
+ then
+ echo "$test_case $client $server passed" >> /tmp/cloud_prod_result.txt
+ else
+ echo "$test_case $client $server failed" >> /tmp/cloud_prod_result.txt
+ fi
+ done
+ done
gsutil cp /tmp/cloud_prod_result.txt gs://stoked-keyword-656-output/cloud_prod_result.txt
rm /tmp/cloud_prod_result.txt
}
diff --git a/tools/gce_setup/grpc_docker.sh b/tools/gce_setup/grpc_docker.sh
index bbc138c6be..231625efb3 100755
--- a/tools/gce_setup/grpc_docker.sh
+++ b/tools/gce_setup/grpc_docker.sh
@@ -350,7 +350,7 @@ grpc_interop_test_flags() {
echo "$FUNCNAME: missing arg: test_case" 1>&2
return 1
}
- echo "--server_host=$server_ip --server_port=$port --test_case=$test_case"
+ echo "--server_host_override=foo.test.google.fr --server_host=$server_ip --server_port=$port --test_case=$test_case"
}
# checks the positional args and assigns them to variables visible in the caller
@@ -503,7 +503,7 @@ grpc_cloud_prod_auth_test_args() {
[[ -n $1 ]] && { # client_type
case $1 in
- cxx|go|java|nodejs|php|python|ruby)
+ cxx|go|java|node|php|python|ruby)
grpc_gen_test_cmd+="_gen_$1_cmd"
declare -F $grpc_gen_test_cmd >> /dev/null || {
echo "-f: test_func for $1 => $grpc_gen_test_cmd is not defined" 1>&2
@@ -673,7 +673,7 @@ _grpc_launch_servers_args() {
[[ -n $1 ]] && {
servers="$@"
} || {
- servers="cxx java go node ruby"
+ servers="cxx java go node ruby python"
echo "$FUNCNAME: no servers specified, will launch defaults '$servers'"
}
}
@@ -795,16 +795,7 @@ grpc_interop_test() {
echo " $ssh_cmd"
echo "on $host"
[[ $dry_run == 1 ]] && return 0 # don't run the command on a dry run
- gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" &
- PID=$!
- sleep 10
- echo "pid is $PID"
- if ps -p $PID
- then
- kill $PID
- return 1
- fi
-
+ gcloud compute $project_opt ssh $zone_opt $host --command "$cmd"
}
# Runs a test command on a docker instance.
@@ -850,16 +841,7 @@ grpc_cloud_prod_test() {
echo " $ssh_cmd"
echo "on $host"
[[ $dry_run == 1 ]] && return 0 # don't run the command on a dry run
- gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" &
- PID=$!
- sleep 10
- echo "pid is $PID"
- if ps -p $PID
- then
- kill $PID
- return 1
- fi
-
+ gcloud compute $project_opt ssh $zone_opt $host --command "$cmd"
}
# Runs a test command on a docker instance.
@@ -945,7 +927,7 @@ grpc_cloud_prod_auth_service_account_creds_gen_go_cmd() {
local test_script="cd src/google.golang.org/grpc/interop/client"
local test_script+=" && go run client.go --use_tls=true"
local gfe_flags=" --tls_ca_file=\"\" --tls_server_name=\"\" --server_port=443 --server_host=grpc-test.sandbox.google.com"
- local added_gfe_flags=$(_grpc_svc_acc_test_flags)
+ local added_gfe_flags=$(_grpc_svc_acc_test_flags)
local the_cmd="$cmd_prefix '$test_script $gfe_flags $added_gfe_flags $@'"
echo $the_cmd
}
@@ -960,7 +942,7 @@ grpc_cloud_prod_auth_compute_engine_creds_gen_go_cmd() {
local test_script="cd src/google.golang.org/grpc/interop/client"
local test_script+=" && go run client.go --use_tls=true"
local gfe_flags=" --tls_ca_file=\"\" --tls_server_name=\"\" --server_port=443 --server_host=grpc-test.sandbox.google.com"
- local added_gfe_flags=$(_grpc_gce_test_flags)
+ local added_gfe_flags=$(_grpc_gce_test_flags)
local the_cmd="$cmd_prefix '$test_script $gfe_flags $added_gfe_flags $@'"
echo $the_cmd
}
@@ -1085,7 +1067,8 @@ grpc_interop_gen_node_cmd() {
# flags= .... # generic flags to include the command
# cmd=$($grpc_gen_test_cmd $flags)
grpc_cloud_prod_gen_node_cmd() {
- local cmd_prefix="sudo docker run grpc/node";
+ local env_flag="-e SSL_CERT_FILE=/cacerts/roots.pem "
+ local cmd_prefix="sudo docker run $env_flag grpc/node";
local test_script="/usr/bin/nodejs /var/local/git/grpc/src/node/interop/interop_client.js --use_tls=true";
local gfe_flags=$(_grpc_prod_gfe_flags);
local the_cmd="$cmd_prefix $test_script $gfe_flags $@";
@@ -1098,12 +1081,12 @@ grpc_cloud_prod_gen_node_cmd() {
# flags= .... # generic flags to include the command
# cmd=$($grpc_gen_test_cmd $flags)
grpc_cloud_prod_auth_service_account_creds_gen_node_cmd() {
- local cmd_prefix="sudo docker run grpc/node";
+ local env_flag="-e SSL_CERT_FILE=/cacerts/roots.pem "
+ env_flag+="-e GOOGLE_APPLICATION_CREDENTIALS=/service_account/stubbyCloudTestingTest-7dd63462c60c.json "
+ local cmd_prefix="sudo docker run $env_flag grpc/node";
local test_script="/usr/bin/nodejs /var/local/git/grpc/src/node/interop/interop_client.js --use_tls=true";
local gfe_flags=$(_grpc_prod_gfe_flags);
- local env_prefix="SSL_CERT_FILE=/cacerts/roots.pem"
- env_prefix+=" GOOGLE_APPLICATION_CREDENTIALS=/service_account/stubbyCloudTestingTest-7dd63462c60c.json"
- local the_cmd="$env_prefix $cmd_prefix $test_script $gfe_flags $@";
+ local the_cmd="$cmd_prefix $test_script $gfe_flags $@";
echo $the_cmd
}
diff --git a/tools/run_tests/jobset.py b/tools/run_tests/jobset.py
index df83b30516..569cb5bac2 100755
--- a/tools/run_tests/jobset.py
+++ b/tools/run_tests/jobset.py
@@ -33,6 +33,7 @@ import hashlib
import multiprocessing
import os
import random
+import signal
import subprocess
import sys
import tempfile
@@ -42,6 +43,12 @@ import time
_DEFAULT_MAX_JOBS = 16 * multiprocessing.cpu_count()
+# setup a signal handler so that signal.pause registers 'something'
+# when a child finishes
+# not using futures and threading to avoid a dependency on subprocess32
+signal.signal(signal.SIGCHLD, lambda unused_signum, unused_frame: None)
+
+
def shuffle_iteratable(it):
"""Return an iterable that randomly walks it"""
# take a random sampling from the passed in iterable
@@ -94,16 +101,19 @@ _TAG_COLOR = {
def message(tag, message, explanatory_text=None, do_newline=False):
- sys.stdout.write('%s%s%s\x1b[%d;%dm%s\x1b[0m: %s%s' % (
- _BEGINNING_OF_LINE,
- _CLEAR_LINE,
- '\n%s' % explanatory_text if explanatory_text is not None else '',
- _COLORS[_TAG_COLOR[tag]][1],
- _COLORS[_TAG_COLOR[tag]][0],
- tag,
- message,
- '\n' if do_newline or explanatory_text is not None else ''))
- sys.stdout.flush()
+ try:
+ sys.stdout.write('%s%s%s\x1b[%d;%dm%s\x1b[0m: %s%s' % (
+ _BEGINNING_OF_LINE,
+ _CLEAR_LINE,
+ '\n%s' % explanatory_text if explanatory_text is not None else '',
+ _COLORS[_TAG_COLOR[tag]][1],
+ _COLORS[_TAG_COLOR[tag]][0],
+ tag,
+ message,
+ '\n' if do_newline or explanatory_text is not None else ''))
+ sys.stdout.flush()
+ except:
+ pass
def which(filename):
@@ -232,7 +242,7 @@ class Jobset(object):
if dead: return
message('WAITING', '%d jobs running, %d complete, %d failed' % (
len(self._running), self._completed, self._failures))
- time.sleep(0.1)
+ signal.pause()
def cancelled(self):
"""Poll for cancellation."""
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index 64478b3753..7732466d6e 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -36,6 +36,7 @@ import itertools
import json
import multiprocessing
import os
+import re
import sys
import time
@@ -168,6 +169,7 @@ argp.add_argument('-c', '--config',
nargs='+',
default=_DEFAULT)
argp.add_argument('-n', '--runs_per_test', default=1, type=int)
+argp.add_argument('-r', '--regex', default='.*', type=str)
argp.add_argument('-j', '--jobs', default=1000, type=int)
argp.add_argument('-f', '--forever',
default=False,
@@ -205,7 +207,8 @@ one_run = set(
spec
for config in run_configs
for language in args.language
- for spec in _LANGUAGES[language].test_specs(config))
+ for spec in _LANGUAGES[language].test_specs(config)
+ if re.search(args.regex, spec.shortname))
runs_per_test = args.runs_per_test
forever = args.forever