Merge branch 'mmm-mmm-mmm-mmm' of github.com:ctiller/grpc into mmm-mmm-mmm-mmm

pull/1625/head
Craig Tiller 10 years ago
commit b9b8ea2d73
  1. 4
      src/core/surface/completion_queue.c
  2. 10
      test/cpp/end2end/crash_test.cc
  3. 1
      test/cpp/end2end/crash_test_server.cc
  4. 25
      test/cpp/util/subprocess.cc
  5. 14
      test/cpp/util/subprocess.h

@ -275,14 +275,14 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag,
gpr_mu_unlock(GRPC_POLLSET_MU(&cc->pollset));
memset(&ret, 0, sizeof(ret));
ret.type = GRPC_QUEUE_TIMEOUT;
GRPC_SURFACE_TRACE_RETURNED_EVENT(cc, &ev->base);
GRPC_SURFACE_TRACE_RETURNED_EVENT(cc, &ret);
return ret;
}
}
gpr_mu_unlock(GRPC_POLLSET_MU(&cc->pollset));
ret = ev->base;
gpr_free(ev);
GRPC_SURFACE_TRACE_RETURNED_EVENT(cc, &ev->base);
GRPC_SURFACE_TRACE_RETURNED_EVENT(cc, &ret);
return ret;
}

@ -73,15 +73,17 @@ class CrashTest : public ::testing::Test {
protected:
CrashTest() {}
std::unique_ptr<grpc::cpp::test::util::TestService::Stub> CreateServerAndStub() {
std::unique_ptr<grpc::cpp::test::util::TestService::Stub>
CreateServerAndStub() {
auto port = grpc_pick_unused_port_or_die();
auto addr = (std::ostringstream() << "localhost:" << port).str();
server_.reset(new SubProcess({
(std::ostringstream() << g_root << "/crash_test_server").str(),
(std::ostringstream() << "--address=" << addr).str(),
(std::ostringstream() << g_root << "/crash_test_server").str(),
(std::ostringstream() << "--address=" << addr).str(),
}));
GPR_ASSERT(server_);
return grpc::cpp::test::util::TestService::NewStub(CreateChannel(addr, InsecureCredentials(), ChannelArguments()));
return grpc::cpp::test::util::TestService::NewStub(
CreateChannel(addr, InsecureCredentials(), ChannelArguments()));
}
void KillServer() {

@ -83,7 +83,6 @@ void RunServer() {
std::cout << "Server listening on " << FLAGS_address << std::endl;
server->Wait();
}
}
}

@ -40,27 +40,20 @@
namespace grpc {
static gpr_subprocess *MakeProcess(std::initializer_list<std::string> args) {
std::vector<const char *> vargs;
for (auto it = args.begin(); it != args.end(); ++it) {
vargs.push_back(it->c_str());
}
return gpr_subprocess_create(vargs.size(), &vargs[0]);
std::vector<const char *> vargs;
for (auto it = args.begin(); it != args.end(); ++it) {
vargs.push_back(it->c_str());
}
return gpr_subprocess_create(vargs.size(), &vargs[0]);
}
SubProcess::SubProcess(std::initializer_list<std::string> args)
: subprocess_(MakeProcess(args)) {
}
: subprocess_(MakeProcess(args)) {}
SubProcess::~SubProcess() {
gpr_subprocess_destroy(subprocess_);
}
SubProcess::~SubProcess() { gpr_subprocess_destroy(subprocess_); }
int SubProcess::Join() {
return gpr_subprocess_join(subprocess_);
}
int SubProcess::Join() { return gpr_subprocess_join(subprocess_); }
void SubProcess::Interrupt() {
gpr_subprocess_interrupt(subprocess_);
}
void SubProcess::Interrupt() { gpr_subprocess_interrupt(subprocess_); }
} // namespace grpc

@ -43,17 +43,17 @@ namespace grpc {
class SubProcess {
public:
SubProcess(std::initializer_list<std::string> args);
~SubProcess();
SubProcess(std::initializer_list<std::string> args);
~SubProcess();
int Join();
void Interrupt();
int Join();
void Interrupt();
private:
SubProcess(const SubProcess& other);
SubProcess& operator=(const SubProcess& other);
SubProcess(const SubProcess& other);
SubProcess& operator=(const SubProcess& other);
gpr_subprocess *const subprocess_;
gpr_subprocess* const subprocess_;
};
} // namespace grpc

Loading…
Cancel
Save