mirror of https://github.com/grpc/grpc.git
commit
4d34729a4e
123 changed files with 3983 additions and 1588 deletions
@ -0,0 +1,62 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2016, Google Inc. |
||||
* All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are |
||||
* met: |
||||
* |
||||
* * Redistributions of source code must retain the above copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* * Redistributions in binary form must reproduce the above |
||||
* copyright notice, this list of conditions and the following disclaimer |
||||
* in the documentation and/or other materials provided with the |
||||
* distribution. |
||||
* * Neither the name of Google Inc. nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
*/ |
||||
|
||||
#ifndef GRPCXX_EXT_HEALTH_CHECK_SERVICE_SERVER_BUILDER_OPTION_H |
||||
#define GRPCXX_EXT_HEALTH_CHECK_SERVICE_SERVER_BUILDER_OPTION_H |
||||
|
||||
#include <memory> |
||||
|
||||
#include <grpc++/health_check_service_interface.h> |
||||
#include <grpc++/impl/server_builder_option.h> |
||||
#include <grpc++/support/config.h> |
||||
|
||||
namespace grpc { |
||||
|
||||
class HealthCheckServiceServerBuilderOption : public ServerBuilderOption { |
||||
public: |
||||
// The ownership of hc will be taken and transferred to the grpc server.
|
||||
// To explicitly disable default service, pass in a nullptr.
|
||||
explicit HealthCheckServiceServerBuilderOption( |
||||
std::unique_ptr<HealthCheckServiceInterface> hc); |
||||
~HealthCheckServiceServerBuilderOption() override {} |
||||
void UpdateArguments(ChannelArguments* args) override; |
||||
void UpdatePlugins( |
||||
std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins) override; |
||||
|
||||
private: |
||||
std::unique_ptr<HealthCheckServiceInterface> hc_; |
||||
}; |
||||
|
||||
} // namespace grpc
|
||||
|
||||
#endif // GRPCXX_EXT_HEALTH_CHECK_SERVICE_SERVER_BUILDER_OPTION_H
|
@ -0,0 +1,166 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2016, Google Inc. |
||||
* All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are |
||||
* met: |
||||
* |
||||
* * Redistributions of source code must retain the above copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* * Redistributions in binary form must reproduce the above |
||||
* copyright notice, this list of conditions and the following disclaimer |
||||
* in the documentation and/or other materials provided with the |
||||
* distribution. |
||||
* * Neither the name of Google Inc. nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
*/ |
||||
|
||||
#include <memory> |
||||
#include <mutex> |
||||
|
||||
#include <grpc++/impl/codegen/method_handler_impl.h> |
||||
#include <grpc/support/alloc.h> |
||||
#include <grpc/support/log.h> |
||||
|
||||
#include "src/cpp/server/health/default_health_check_service.h" |
||||
#include "src/cpp/server/health/health.pb.h" |
||||
#include "third_party/nanopb/pb_decode.h" |
||||
#include "third_party/nanopb/pb_encode.h" |
||||
|
||||
namespace grpc { |
||||
namespace { |
||||
const char kHealthCheckMethodName[] = "/grpc.health.v1.Health/Check"; |
||||
} // namespace
|
||||
|
||||
DefaultHealthCheckService::HealthCheckServiceImpl::HealthCheckServiceImpl( |
||||
DefaultHealthCheckService* service) |
||||
: service_(service), method_(nullptr) { |
||||
MethodHandler* handler = |
||||
new RpcMethodHandler<HealthCheckServiceImpl, ByteBuffer, ByteBuffer>( |
||||
std::mem_fn(&HealthCheckServiceImpl::Check), this); |
||||
method_ = new RpcServiceMethod(kHealthCheckMethodName, RpcMethod::NORMAL_RPC, |
||||
handler); |
||||
AddMethod(method_); |
||||
} |
||||
|
||||
Status DefaultHealthCheckService::HealthCheckServiceImpl::Check( |
||||
ServerContext* context, const ByteBuffer* request, ByteBuffer* response) { |
||||
// Decode request.
|
||||
std::vector<Slice> slices; |
||||
request->Dump(&slices); |
||||
uint8_t* request_bytes = nullptr; |
||||
bool request_bytes_owned = false; |
||||
size_t request_size = 0; |
||||
grpc_health_v1_HealthCheckRequest request_struct; |
||||
if (slices.empty()) { |
||||
request_struct.has_service = false; |
||||
} else if (slices.size() == 1) { |
||||
request_bytes = const_cast<uint8_t*>(slices[0].begin()); |
||||
request_size = slices[0].size(); |
||||
} else { |
||||
request_bytes_owned = true; |
||||
request_bytes = static_cast<uint8_t*>(gpr_malloc(request->Length())); |
||||
uint8_t* copy_to = request_bytes; |
||||
for (size_t i = 0; i < slices.size(); i++) { |
||||
memcpy(copy_to, slices[i].begin(), slices[i].size()); |
||||
copy_to += slices[i].size(); |
||||
} |
||||
} |
||||
|
||||
if (request_bytes != nullptr) { |
||||
pb_istream_t istream = pb_istream_from_buffer(request_bytes, request_size); |
||||
bool decode_status = pb_decode( |
||||
&istream, grpc_health_v1_HealthCheckRequest_fields, &request_struct); |
||||
if (request_bytes_owned) { |
||||
gpr_free(request_bytes); |
||||
} |
||||
if (!decode_status) { |
||||
return Status(StatusCode::INVALID_ARGUMENT, ""); |
||||
} |
||||
} |
||||
|
||||
// Check status from the associated default health checking service.
|
||||
DefaultHealthCheckService::ServingStatus serving_status = |
||||
service_->GetServingStatus( |
||||
request_struct.has_service ? request_struct.service : ""); |
||||
if (serving_status == DefaultHealthCheckService::NOT_FOUND) { |
||||
return Status(StatusCode::NOT_FOUND, ""); |
||||
} |
||||
|
||||
// Encode response
|
||||
grpc_health_v1_HealthCheckResponse response_struct; |
||||
response_struct.has_status = true; |
||||
response_struct.status = |
||||
serving_status == DefaultHealthCheckService::SERVING |
||||
? grpc_health_v1_HealthCheckResponse_ServingStatus_SERVING |
||||
: grpc_health_v1_HealthCheckResponse_ServingStatus_NOT_SERVING; |
||||
pb_ostream_t ostream; |
||||
memset(&ostream, 0, sizeof(ostream)); |
||||
pb_encode(&ostream, grpc_health_v1_HealthCheckResponse_fields, |
||||
&response_struct); |
||||
grpc_slice response_slice = grpc_slice_malloc(ostream.bytes_written); |
||||
ostream = pb_ostream_from_buffer(GRPC_SLICE_START_PTR(response_slice), |
||||
GRPC_SLICE_LENGTH(response_slice)); |
||||
bool encode_status = pb_encode( |
||||
&ostream, grpc_health_v1_HealthCheckResponse_fields, &response_struct); |
||||
if (!encode_status) { |
||||
return Status(StatusCode::INTERNAL, "Failed to encode response."); |
||||
} |
||||
Slice encoded_response(response_slice, Slice::STEAL_REF); |
||||
ByteBuffer response_buffer(&encoded_response, 1); |
||||
response->Swap(&response_buffer); |
||||
return Status::OK; |
||||
} |
||||
|
||||
DefaultHealthCheckService::DefaultHealthCheckService() { |
||||
services_map_.emplace("", true); |
||||
} |
||||
|
||||
void DefaultHealthCheckService::SetServingStatus( |
||||
const grpc::string& service_name, bool serving) { |
||||
std::lock_guard<std::mutex> lock(mu_); |
||||
services_map_[service_name] = serving; |
||||
} |
||||
|
||||
void DefaultHealthCheckService::SetServingStatus(bool serving) { |
||||
std::lock_guard<std::mutex> lock(mu_); |
||||
for (auto iter = services_map_.begin(); iter != services_map_.end(); ++iter) { |
||||
iter->second = serving; |
||||
} |
||||
} |
||||
|
||||
DefaultHealthCheckService::ServingStatus |
||||
DefaultHealthCheckService::GetServingStatus( |
||||
const grpc::string& service_name) const { |
||||
std::lock_guard<std::mutex> lock(mu_); |
||||
const auto& iter = services_map_.find(service_name); |
||||
if (iter == services_map_.end()) { |
||||
return NOT_FOUND; |
||||
} |
||||
return iter->second ? SERVING : NOT_SERVING; |
||||
} |
||||
|
||||
DefaultHealthCheckService::HealthCheckServiceImpl* |
||||
DefaultHealthCheckService::GetHealthCheckService() { |
||||
GPR_ASSERT(impl_ == nullptr); |
||||
impl_.reset(new HealthCheckServiceImpl(this)); |
||||
return impl_.get(); |
||||
} |
||||
|
||||
} // namespace grpc
|
@ -0,0 +1,78 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2016, Google Inc. |
||||
* All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are |
||||
* met: |
||||
* |
||||
* * Redistributions of source code must retain the above copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* * Redistributions in binary form must reproduce the above |
||||
* copyright notice, this list of conditions and the following disclaimer |
||||
* in the documentation and/or other materials provided with the |
||||
* distribution. |
||||
* * Neither the name of Google Inc. nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
*/ |
||||
|
||||
#ifndef GRPC_INTERNAL_CPP_SERVER_DEFAULT_HEALTH_CHECK_SERVICE_H |
||||
#define GRPC_INTERNAL_CPP_SERVER_DEFAULT_HEALTH_CHECK_SERVICE_H |
||||
|
||||
#include <mutex> |
||||
|
||||
#include <grpc++/health_check_service_interface.h> |
||||
#include <grpc++/impl/codegen/service_type.h> |
||||
#include <grpc++/support/byte_buffer.h> |
||||
|
||||
namespace grpc { |
||||
|
||||
// Default implementation of HealthCheckServiceInterface. Server will create and
|
||||
// own it.
|
||||
class DefaultHealthCheckService final : public HealthCheckServiceInterface { |
||||
public: |
||||
// The service impl to register with the server.
|
||||
class HealthCheckServiceImpl : public Service { |
||||
public: |
||||
explicit HealthCheckServiceImpl(DefaultHealthCheckService* service); |
||||
|
||||
Status Check(ServerContext* context, const ByteBuffer* request, |
||||
ByteBuffer* response); |
||||
|
||||
private: |
||||
const DefaultHealthCheckService* const service_; |
||||
RpcServiceMethod* method_; |
||||
}; |
||||
|
||||
DefaultHealthCheckService(); |
||||
void SetServingStatus(const grpc::string& service_name, |
||||
bool serving) override; |
||||
void SetServingStatus(bool serving) override; |
||||
enum ServingStatus { NOT_FOUND, SERVING, NOT_SERVING }; |
||||
ServingStatus GetServingStatus(const grpc::string& service_name) const; |
||||
HealthCheckServiceImpl* GetHealthCheckService(); |
||||
|
||||
private: |
||||
mutable std::mutex mu_; |
||||
std::map<grpc::string, bool> services_map_; |
||||
std::unique_ptr<HealthCheckServiceImpl> impl_; |
||||
}; |
||||
|
||||
} // namespace grpc
|
||||
|
||||
#endif // GRPC_INTERNAL_CPP_SERVER_DEFAULT_HEALTH_CHECK_SERVICE_H
|
@ -0,0 +1,24 @@ |
||||
/* Automatically generated nanopb constant definitions */ |
||||
/* Generated by nanopb-0.3.7-dev */ |
||||
|
||||
#include "src/cpp/server/health/health.pb.h" |
||||
|
||||
/* @@protoc_insertion_point(includes) */ |
||||
#if PB_PROTO_HEADER_VERSION != 30 |
||||
#error Regenerate this file with the current version of nanopb generator. |
||||
#endif |
||||
|
||||
|
||||
|
||||
const pb_field_t grpc_health_v1_HealthCheckRequest_fields[2] = { |
||||
PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, grpc_health_v1_HealthCheckRequest, service, service, 0), |
||||
PB_LAST_FIELD |
||||
}; |
||||
|
||||
const pb_field_t grpc_health_v1_HealthCheckResponse_fields[2] = { |
||||
PB_FIELD( 1, UENUM , OPTIONAL, STATIC , FIRST, grpc_health_v1_HealthCheckResponse, status, status, 0), |
||||
PB_LAST_FIELD |
||||
}; |
||||
|
||||
|
||||
/* @@protoc_insertion_point(eof) */ |
@ -0,0 +1,72 @@ |
||||
/* Automatically generated nanopb header */ |
||||
/* Generated by nanopb-0.3.7-dev */ |
||||
|
||||
#ifndef PB_GRPC_HEALTH_V1_HEALTH_PB_H_INCLUDED |
||||
#define PB_GRPC_HEALTH_V1_HEALTH_PB_H_INCLUDED |
||||
#include "third_party/nanopb/pb.h" |
||||
/* @@protoc_insertion_point(includes) */ |
||||
#if PB_PROTO_HEADER_VERSION != 30 |
||||
#error Regenerate this file with the current version of nanopb generator. |
||||
#endif |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
/* Enum definitions */ |
||||
typedef enum _grpc_health_v1_HealthCheckResponse_ServingStatus { |
||||
grpc_health_v1_HealthCheckResponse_ServingStatus_UNKNOWN = 0, |
||||
grpc_health_v1_HealthCheckResponse_ServingStatus_SERVING = 1, |
||||
grpc_health_v1_HealthCheckResponse_ServingStatus_NOT_SERVING = 2 |
||||
} grpc_health_v1_HealthCheckResponse_ServingStatus; |
||||
#define _grpc_health_v1_HealthCheckResponse_ServingStatus_MIN grpc_health_v1_HealthCheckResponse_ServingStatus_UNKNOWN |
||||
#define _grpc_health_v1_HealthCheckResponse_ServingStatus_MAX grpc_health_v1_HealthCheckResponse_ServingStatus_NOT_SERVING |
||||
#define _grpc_health_v1_HealthCheckResponse_ServingStatus_ARRAYSIZE ((grpc_health_v1_HealthCheckResponse_ServingStatus)(grpc_health_v1_HealthCheckResponse_ServingStatus_NOT_SERVING+1)) |
||||
|
||||
/* Struct definitions */ |
||||
typedef struct _grpc_health_v1_HealthCheckRequest { |
||||
bool has_service; |
||||
char service[200]; |
||||
/* @@protoc_insertion_point(struct:grpc_health_v1_HealthCheckRequest) */ |
||||
} grpc_health_v1_HealthCheckRequest; |
||||
|
||||
typedef struct _grpc_health_v1_HealthCheckResponse { |
||||
bool has_status; |
||||
grpc_health_v1_HealthCheckResponse_ServingStatus status; |
||||
/* @@protoc_insertion_point(struct:grpc_health_v1_HealthCheckResponse) */ |
||||
} grpc_health_v1_HealthCheckResponse; |
||||
|
||||
/* Default values for struct fields */ |
||||
|
||||
/* Initializer values for message structs */ |
||||
#define grpc_health_v1_HealthCheckRequest_init_default {false, ""} |
||||
#define grpc_health_v1_HealthCheckResponse_init_default {false, (grpc_health_v1_HealthCheckResponse_ServingStatus)0} |
||||
#define grpc_health_v1_HealthCheckRequest_init_zero {false, ""} |
||||
#define grpc_health_v1_HealthCheckResponse_init_zero {false, (grpc_health_v1_HealthCheckResponse_ServingStatus)0} |
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */ |
||||
#define grpc_health_v1_HealthCheckRequest_service_tag 1 |
||||
#define grpc_health_v1_HealthCheckResponse_status_tag 1 |
||||
|
||||
/* Struct field encoding specification for nanopb */ |
||||
extern const pb_field_t grpc_health_v1_HealthCheckRequest_fields[2]; |
||||
extern const pb_field_t grpc_health_v1_HealthCheckResponse_fields[2]; |
||||
|
||||
/* Maximum encoded size of messages (where known) */ |
||||
#define grpc_health_v1_HealthCheckRequest_size 203 |
||||
#define grpc_health_v1_HealthCheckResponse_size 2 |
||||
|
||||
/* Message IDs (where set with "msgid" option) */ |
||||
#ifdef PB_MSGID |
||||
|
||||
#define HEALTH_MESSAGES \ |
||||
|
||||
|
||||
#endif |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
/* @@protoc_insertion_point(eof) */ |
||||
|
||||
#endif |
@ -0,0 +1,50 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2016, Google Inc. |
||||
* All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are |
||||
* met: |
||||
* |
||||
* * Redistributions of source code must retain the above copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* * Redistributions in binary form must reproduce the above |
||||
* copyright notice, this list of conditions and the following disclaimer |
||||
* in the documentation and/or other materials provided with the |
||||
* distribution. |
||||
* * Neither the name of Google Inc. nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
*/ |
||||
|
||||
#include <grpc++/ext/health_check_service_server_builder_option.h> |
||||
|
||||
namespace grpc { |
||||
|
||||
HealthCheckServiceServerBuilderOption::HealthCheckServiceServerBuilderOption( |
||||
std::unique_ptr<HealthCheckServiceInterface> hc) |
||||
: hc_(std::move(hc)) {} |
||||
// Hand over hc_ to the server.
|
||||
void HealthCheckServiceServerBuilderOption::UpdateArguments( |
||||
ChannelArguments* args) { |
||||
args->SetPointer(kHealthCheckServiceInterfaceArg, hc_.release()); |
||||
} |
||||
|
||||
void HealthCheckServiceServerBuilderOption::UpdatePlugins( |
||||
std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins) {} |
||||
|
||||
} // namespace grpc
|
@ -0,0 +1 @@ |
||||
grpc.health.v1.HealthCheckRequest.service max_size:200 |
@ -0,0 +1,54 @@ |
||||
# Copyright 2017, 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. |
||||
|
||||
licenses(["notice"]) # 3-clause BSD |
||||
|
||||
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") |
||||
|
||||
grpc_fuzzer( |
||||
name = "uri_fuzzer_test", |
||||
srcs = ["uri_fuzzer_test.c"], |
||||
deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"], |
||||
corpus = "uri_corpus", |
||||
copts = ["-std=c99"], |
||||
) |
||||
|
||||
cc_test( |
||||
name = "lb_policies_test", |
||||
srcs = ["lb_policies_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:cq_verifier"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "set_initial_connect_string_test", |
||||
srcs = ["set_initial_connect_string_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
@ -0,0 +1,51 @@ |
||||
# Copyright 2017, 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. |
||||
|
||||
licenses(["notice"]) # 3-clause BSD |
||||
|
||||
cc_test( |
||||
name = "dns_resolver_connectivity_test", |
||||
srcs = ["dns_resolver_connectivity_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "dns_resolver_test", |
||||
srcs = ["dns_resolver_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "sockaddr_resolver_test", |
||||
srcs = ["sockaddr_resolver_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
@ -0,0 +1,62 @@ |
||||
# Copyright 2017, 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. |
||||
|
||||
licenses(["notice"]) # 3-clause BSD |
||||
|
||||
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") |
||||
|
||||
cc_binary( |
||||
name = "client", |
||||
srcs = ["client.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"], |
||||
testonly = 1, |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_binary( |
||||
name = "server", |
||||
srcs = ["server.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"], |
||||
testonly = 1, |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "fling", |
||||
srcs = ["fling_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"], |
||||
data = [":client", ":server"] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "fling_stream", |
||||
srcs = ["fling_stream_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"], |
||||
data = [":client", ":server"] |
||||
) |
@ -1,118 +0,0 @@ |
||||
/*
|
||||
* |
||||
* 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. |
||||
* |
||||
*/ |
||||
|
||||
#include "src/core/lib/iomgr/iomgr.h" |
||||
#include "src/core/lib/iomgr/closure.h" |
||||
#include "src/core/lib/iomgr/endpoint.h" |
||||
#include "src/core/lib/iomgr/exec_ctx.h" |
||||
#include "src/core/lib/iomgr/executor.h" |
||||
|
||||
/*******************************************************************************
|
||||
* NOTE: If this test fails to compile, then the api changes are likely to cause |
||||
* merge failures downstream. Please pay special attention to reviewing |
||||
* these changes, and solicit help as appropriate when merging downstream. |
||||
* |
||||
* This test is NOT expected to be run directly. |
||||
******************************************************************************/ |
||||
|
||||
static void test_code(void) { |
||||
/* iomgr.h */ |
||||
grpc_iomgr_init(); |
||||
grpc_iomgr_shutdown(NULL); |
||||
|
||||
/* closure.h */ |
||||
grpc_closure closure; |
||||
closure.cb = NULL; |
||||
closure.cb_arg = NULL; |
||||
closure.next_data.scratch = 0; |
||||
|
||||
grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; |
||||
closure_list.head = NULL; |
||||
closure_list.tail = NULL; |
||||
|
||||
grpc_closure_init(&closure, NULL, NULL, grpc_schedule_on_exec_ctx); |
||||
|
||||
grpc_closure_create(NULL, NULL, grpc_schedule_on_exec_ctx); |
||||
|
||||
grpc_closure_list_move(NULL, NULL); |
||||
grpc_closure_list_append(NULL, NULL, GRPC_ERROR_CREATE("Foo")); |
||||
grpc_closure_list_empty(closure_list); |
||||
|
||||
/* exec_ctx.h */ |
||||
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; |
||||
grpc_exec_ctx_flush(&exec_ctx); |
||||
grpc_exec_ctx_finish(&exec_ctx); |
||||
grpc_closure_sched(&exec_ctx, &closure, GRPC_ERROR_CREATE("Foo")); |
||||
grpc_closure_list_sched(&exec_ctx, &closure_list); |
||||
|
||||
/* endpoint.h */ |
||||
grpc_endpoint endpoint; |
||||
grpc_endpoint_vtable vtable = {grpc_endpoint_read, |
||||
grpc_endpoint_write, |
||||
grpc_endpoint_get_workqueue, |
||||
grpc_endpoint_add_to_pollset, |
||||
grpc_endpoint_add_to_pollset_set, |
||||
grpc_endpoint_shutdown, |
||||
grpc_endpoint_destroy, |
||||
grpc_endpoint_get_resource_user, |
||||
grpc_endpoint_get_peer, |
||||
grpc_endpoint_get_fd}; |
||||
endpoint.vtable = &vtable; |
||||
|
||||
grpc_endpoint_read(&exec_ctx, &endpoint, NULL, NULL); |
||||
grpc_endpoint_get_peer(&endpoint); |
||||
grpc_endpoint_write(&exec_ctx, &endpoint, NULL, NULL); |
||||
grpc_endpoint_shutdown(&exec_ctx, &endpoint, GRPC_ERROR_CANCELLED); |
||||
grpc_endpoint_destroy(&exec_ctx, &endpoint); |
||||
grpc_endpoint_add_to_pollset(&exec_ctx, &endpoint, NULL); |
||||
grpc_endpoint_add_to_pollset_set(&exec_ctx, &endpoint, NULL); |
||||
|
||||
/* executor.h */ |
||||
grpc_executor_init(); |
||||
grpc_executor_shutdown(NULL); |
||||
|
||||
/* pollset.h */ |
||||
grpc_pollset_size(); |
||||
grpc_pollset_init(NULL, NULL); |
||||
grpc_pollset_shutdown(NULL, NULL, NULL); |
||||
grpc_pollset_destroy(NULL); |
||||
GRPC_ERROR_UNREF(grpc_pollset_work(NULL, NULL, NULL, |
||||
gpr_now(GPR_CLOCK_REALTIME), |
||||
gpr_now(GPR_CLOCK_MONOTONIC))); |
||||
GRPC_ERROR_UNREF(grpc_pollset_kick(NULL, NULL)); |
||||
} |
||||
|
||||
int main(void) { |
||||
if (false) test_code(); |
||||
return 0; |
||||
} |
@ -1,81 +0,0 @@ |
||||
/*
|
||||
* |
||||
* 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. |
||||
* |
||||
*/ |
||||
|
||||
/*******************************************************************************
|
||||
* NOTE: If this test fails to compile, then the api changes are likely to cause |
||||
* merge failures downstream. Please pay special attention to reviewing |
||||
* these changes, and solicit help as appropriate when merging downstream. |
||||
* |
||||
* This test is NOT expected to be run directly. |
||||
******************************************************************************/ |
||||
|
||||
#include "src/core/lib/transport/transport.h" |
||||
#include "src/core/lib/transport/transport_impl.h" |
||||
|
||||
static void test_code(void) { |
||||
/* transport_impl.h */ |
||||
grpc_transport transport; |
||||
grpc_transport_vtable vtable = {12345, |
||||
grpc_transport_init_stream, |
||||
grpc_transport_set_pollset, |
||||
grpc_transport_perform_stream_op, |
||||
grpc_transport_perform_op, |
||||
grpc_transport_destroy_stream, |
||||
grpc_transport_destroy, |
||||
grpc_transport_get_peer}; |
||||
transport.vtable = &vtable; |
||||
|
||||
/* transport.h */ |
||||
GRPC_STREAM_REF_INIT(NULL, 0, NULL, NULL, "xyz"); |
||||
GPR_ASSERT(0 == grpc_transport_stream_size(NULL)); |
||||
GPR_ASSERT(grpc_transport_init_stream(&transport, NULL, NULL, NULL, NULL)); |
||||
grpc_transport_set_pollset(&transport, NULL, NULL, NULL); |
||||
grpc_transport_destroy_stream(&transport, NULL, NULL); |
||||
grpc_transport_stream_op_finish_with_failure(NULL, NULL); |
||||
grpc_transport_stream_op_add_cancellation(NULL, GRPC_STATUS_UNAVAILABLE); |
||||
grpc_transport_stream_op_add_close(NULL, GRPC_STATUS_UNAVAILABLE, |
||||
grpc_transport_op_string(NULL)); |
||||
grpc_transport_perform_stream_op(&transport, NULL, NULL, NULL); |
||||
grpc_transport_perform_op(&transport, NULL, NULL); |
||||
grpc_transport_ping(&transport, NULL); |
||||
grpc_transport_goaway(&transport, GRPC_STATUS_UNAVAILABLE, |
||||
grpc_slice_malloc(0)); |
||||
grpc_transport_close(&transport); |
||||
grpc_transport_destroy(&transport, NULL); |
||||
GPR_ASSERT("xyz" == grpc_transport_get_peer(&transport, NULL)); |
||||
} |
||||
|
||||
int main(void) { |
||||
if (false) test_code(); |
||||
return 0; |
||||
} |
@ -0,0 +1,181 @@ |
||||
# Copyright 2017, 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. |
||||
|
||||
licenses(["notice"]) # 3-clause BSD |
||||
|
||||
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") |
||||
|
||||
cc_library( |
||||
name = "endpoint_tests", |
||||
srcs = ["endpoint_tests.c"], |
||||
hdrs = ["endpoint_tests.h"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
visibility = ["//test:__subpackages__"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "combiner_test", |
||||
srcs = ["combiner_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "endpoint_pair_test", |
||||
srcs = ["endpoint_pair_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", ":endpoint_tests"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "ev_epoll_linux_test", |
||||
srcs = ["ev_epoll_linux_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "fd_conservation_posix_test", |
||||
srcs = ["fd_conservation_posix_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "fd_posix_test", |
||||
srcs = ["fd_posix_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "load_file_test", |
||||
srcs = ["load_file_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "pollset_set_test", |
||||
srcs = ["pollset_set_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "resolve_address_posix_test", |
||||
srcs = ["resolve_address_posix_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "resolve_address_test", |
||||
srcs = ["resolve_address_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "resource_quota_test", |
||||
srcs = ["resource_quota_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "sockaddr_utils_test", |
||||
srcs = ["sockaddr_utils_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "socket_utils_test", |
||||
srcs = ["socket_utils_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "tcp_client_posix_test", |
||||
srcs = ["tcp_client_posix_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "tcp_posix_test", |
||||
srcs = ["tcp_posix_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", ":endpoint_tests"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "tcp_server_posix_test", |
||||
srcs = ["tcp_server_posix_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "time_averaged_stats_test", |
||||
srcs = ["time_averaged_stats_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "timer_heap_test", |
||||
srcs = ["timer_heap_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "timer_list_test", |
||||
srcs = ["timer_list_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "udp_server_test", |
||||
srcs = ["udp_server_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "wakeup_fd_cv_test", |
||||
srcs = ["wakeup_fd_cv_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
@ -0,0 +1,37 @@ |
||||
# Copyright 2016, Google Inc. |
||||
# All rights reserved. |
||||
# |
||||
# Redistribution and use in source and binary forms, with or without |
||||
# modification, are permitted provided that the following conditions are |
||||
# met: |
||||
# |
||||
# * Redistributions of source code must retain the above copyright |
||||
# notice, this list of conditions and the following disclaimer. |
||||
# * Redistributions in binary form must reproduce the above |
||||
# copyright notice, this list of conditions and the following disclaimer |
||||
# in the documentation and/or other materials provided with the |
||||
# distribution. |
||||
# * Neither the name of Google Inc. nor the names of its |
||||
# contributors may be used to endorse or promote products derived from |
||||
# this software without specific prior written permission. |
||||
# |
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
||||
licenses(["notice"]) # 3-clause BSD |
||||
|
||||
cc_binary( |
||||
name = "low_level_ping_pong", |
||||
srcs = ["low_level_ping_pong.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
@ -0,0 +1,104 @@ |
||||
# Copyright 2017, 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. |
||||
|
||||
licenses(["notice"]) # 3-clause BSD |
||||
|
||||
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") |
||||
|
||||
grpc_fuzzer( |
||||
name = "ssl_server_fuzzer", |
||||
srcs = ["ssl_server_fuzzer.c"], |
||||
deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"], |
||||
corpus = "corpus", |
||||
copts = ["-std=c99"], |
||||
) |
||||
|
||||
cc_library( |
||||
name = "oauth2_utils", |
||||
srcs = ["oauth2_utils.c"], |
||||
hdrs = ["oauth2_utils.h"], |
||||
deps = ["//:grpc"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "auth_context_test", |
||||
srcs = ["auth_context_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "b64_test", |
||||
srcs = ["b64_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "credentials_test", |
||||
srcs = ["credentials_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "secure_endpoint_test", |
||||
srcs = ["secure_endpoint_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/iomgr:endpoint_tests"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "security_connector_test", |
||||
srcs = ["security_connector_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_binary( |
||||
name = "create_jwt", |
||||
srcs = ["create_jwt.c"], |
||||
deps = ["//:grpc", "//:gpr"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_binary( |
||||
name = "fetch_oauth2", |
||||
srcs = ["fetch_oauth2.c"], |
||||
deps = ["//:grpc", "//:gpr", ":oauth2_utils"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_binary( |
||||
name = "verify_jwt", |
||||
srcs = ["verify_jwt.c"], |
||||
deps = ["//:grpc", "//:gpr"], |
||||
copts = ['-std=c99'] |
||||
) |
@ -0,0 +1,54 @@ |
||||
# Copyright 2017, 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. |
||||
|
||||
licenses(["notice"]) # 3-clause BSD |
||||
|
||||
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") |
||||
|
||||
grpc_fuzzer( |
||||
name = "percent_decode_fuzzer", |
||||
srcs = ["percent_decode_fuzzer.c"], |
||||
deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"], |
||||
corpus = "response_corpus", |
||||
copts = ["-std=c99"], |
||||
) |
||||
|
||||
cc_test( |
||||
name = "percent_encoding_test", |
||||
srcs = ["percent_encoding_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "slice_buffer_test", |
||||
srcs = ["slice_string_helpers_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
@ -0,0 +1,72 @@ |
||||
# Copyright 2017, 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. |
||||
|
||||
licenses(["notice"]) # 3-clause BSD |
||||
|
||||
cc_test( |
||||
name = "bdp_estimator_test", |
||||
srcs = ["bdp_estimator_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "connectivity_state_test", |
||||
srcs = ["connectivity_state_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "metadata_test", |
||||
srcs = ["metadata_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "pid_controller_test", |
||||
srcs = ["pid_controller_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "status_conversion_test", |
||||
srcs = ["status_conversion_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
||||
|
||||
cc_test( |
||||
name = "timeout_encoding_test", |
||||
srcs = ["timeout_encoding_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
@ -0,0 +1,37 @@ |
||||
# Copyright 2017, 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. |
||||
|
||||
licenses(["notice"]) # 3-clause BSD |
||||
|
||||
cc_test( |
||||
name = "transport_security_test", |
||||
srcs = ["transport_security_test.c"], |
||||
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], |
||||
copts = ['-std=c99'] |
||||
) |
@ -0,0 +1,36 @@ |
||||
# Copyright 2017, 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. |
||||
|
||||
licenses(["notice"]) # 3-clause BSD |
||||
|
||||
cc_test( |
||||
name = "alarm_cpp_test", |
||||
srcs = ["alarm_cpp_test.cc"], |
||||
deps = ["//:grpc++", "//external:gtest", "//test/core/util:gpr_test_util"], |
||||
) |
@ -0,0 +1,323 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2016, Google Inc. |
||||
* All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are |
||||
* met: |
||||
* |
||||
* * Redistributions of source code must retain the above copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* * Redistributions in binary form must reproduce the above |
||||
* copyright notice, this list of conditions and the following disclaimer |
||||
* in the documentation and/or other materials provided with the |
||||
* distribution. |
||||
* * Neither the name of Google Inc. nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
*/ |
||||
|
||||
#include <memory> |
||||
#include <mutex> |
||||
#include <thread> |
||||
#include <vector> |
||||
|
||||
#include <grpc++/channel.h> |
||||
#include <grpc++/client_context.h> |
||||
#include <grpc++/create_channel.h> |
||||
#include <grpc++/ext/health_check_service_server_builder_option.h> |
||||
#include <grpc++/health_check_service_interface.h> |
||||
#include <grpc++/server.h> |
||||
#include <grpc++/server_builder.h> |
||||
#include <grpc++/server_context.h> |
||||
#include <grpc/grpc.h> |
||||
#include <grpc/support/log.h> |
||||
#include <gtest/gtest.h> |
||||
|
||||
#include "src/proto/grpc/health/v1/health.grpc.pb.h" |
||||
#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" |
||||
#include "src/proto/grpc/testing/echo.grpc.pb.h" |
||||
#include "test/core/util/port.h" |
||||
#include "test/core/util/test_config.h" |
||||
#include "test/cpp/end2end/test_service_impl.h" |
||||
|
||||
using grpc::health::v1::Health; |
||||
using grpc::health::v1::HealthCheckRequest; |
||||
using grpc::health::v1::HealthCheckResponse; |
||||
|
||||
namespace grpc { |
||||
namespace testing { |
||||
namespace { |
||||
|
||||
// A sample sync implementation of the health checking service. This does the
|
||||
// same thing as the default one.
|
||||
class HealthCheckServiceImpl : public ::grpc::health::v1::Health::Service { |
||||
public: |
||||
Status Check(ServerContext* context, const HealthCheckRequest* request, |
||||
HealthCheckResponse* response) override { |
||||
std::lock_guard<std::mutex> lock(mu_); |
||||
auto iter = status_map_.find(request->service()); |
||||
if (iter == status_map_.end()) { |
||||
return Status(StatusCode::NOT_FOUND, ""); |
||||
} |
||||
response->set_status(iter->second); |
||||
return Status::OK; |
||||
} |
||||
|
||||
void SetStatus(const grpc::string& service_name, |
||||
HealthCheckResponse::ServingStatus status) { |
||||
std::lock_guard<std::mutex> lock(mu_); |
||||
status_map_[service_name] = status; |
||||
} |
||||
|
||||
void SetAll(HealthCheckResponse::ServingStatus status) { |
||||
std::lock_guard<std::mutex> lock(mu_); |
||||
for (auto iter = status_map_.begin(); iter != status_map_.end(); ++iter) { |
||||
iter->second = status; |
||||
} |
||||
} |
||||
|
||||
private: |
||||
std::mutex mu_; |
||||
std::map<const grpc::string, HealthCheckResponse::ServingStatus> status_map_; |
||||
}; |
||||
|
||||
// A custom implementation of the health checking service interface. This is
|
||||
// used to test that it prevents the server from creating a default service and
|
||||
// also serves as an example of how to override the default service.
|
||||
class CustomHealthCheckService : public HealthCheckServiceInterface { |
||||
public: |
||||
explicit CustomHealthCheckService(HealthCheckServiceImpl* impl) |
||||
: impl_(impl) { |
||||
impl_->SetStatus("", HealthCheckResponse::SERVING); |
||||
} |
||||
void SetServingStatus(const grpc::string& service_name, |
||||
bool serving) override { |
||||
impl_->SetStatus(service_name, serving ? HealthCheckResponse::SERVING |
||||
: HealthCheckResponse::NOT_SERVING); |
||||
} |
||||
|
||||
void SetServingStatus(bool serving) override { |
||||
impl_->SetAll(serving ? HealthCheckResponse::SERVING |
||||
: HealthCheckResponse::NOT_SERVING); |
||||
} |
||||
|
||||
private: |
||||
HealthCheckServiceImpl* impl_; // not owned
|
||||
}; |
||||
|
||||
void LoopCompletionQueue(ServerCompletionQueue* cq) { |
||||
void* tag; |
||||
bool ok; |
||||
while (cq->Next(&tag, &ok)) { |
||||
abort(); // Nothing should come out of the cq.
|
||||
} |
||||
} |
||||
|
||||
class HealthServiceEnd2endTest : public ::testing::Test { |
||||
protected: |
||||
HealthServiceEnd2endTest() {} |
||||
|
||||
void SetUpServer(bool register_sync_test_service, bool add_async_cq, |
||||
bool explicit_health_service, |
||||
std::unique_ptr<HealthCheckServiceInterface> service) { |
||||
int port = grpc_pick_unused_port_or_die(); |
||||
server_address_ << "localhost:" << port; |
||||
|
||||
bool register_sync_health_service_impl = |
||||
explicit_health_service && service != nullptr; |
||||
|
||||
// Setup server
|
||||
ServerBuilder builder; |
||||
if (explicit_health_service) { |
||||
std::unique_ptr<ServerBuilderOption> option( |
||||
new HealthCheckServiceServerBuilderOption(std::move(service))); |
||||
builder.SetOption(std::move(option)); |
||||
} |
||||
builder.AddListeningPort(server_address_.str(), |
||||
grpc::InsecureServerCredentials()); |
||||
if (register_sync_test_service) { |
||||
// Register a sync service.
|
||||
builder.RegisterService(&echo_test_service_); |
||||
} |
||||
if (register_sync_health_service_impl) { |
||||
builder.RegisterService(&health_check_service_impl_); |
||||
} |
||||
if (add_async_cq) { |
||||
cq_ = builder.AddCompletionQueue(); |
||||
} |
||||
server_ = builder.BuildAndStart(); |
||||
} |
||||
|
||||
void TearDown() override { |
||||
if (server_) { |
||||
server_->Shutdown(); |
||||
if (cq_ != nullptr) { |
||||
cq_->Shutdown(); |
||||
} |
||||
if (cq_thread_.joinable()) { |
||||
cq_thread_.join(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
void ResetStubs() { |
||||
std::shared_ptr<Channel> channel = |
||||
CreateChannel(server_address_.str(), InsecureChannelCredentials()); |
||||
hc_stub_ = grpc::health::v1::Health::NewStub(channel); |
||||
} |
||||
|
||||
// When the expected_status is NOT OK, we do not care about the response.
|
||||
void SendHealthCheckRpc(const grpc::string& service_name, |
||||
const Status& expected_status) { |
||||
EXPECT_FALSE(expected_status.ok()); |
||||
SendHealthCheckRpc(service_name, expected_status, |
||||
HealthCheckResponse::UNKNOWN); |
||||
} |
||||
|
||||
void SendHealthCheckRpc( |
||||
const grpc::string& service_name, const Status& expected_status, |
||||
HealthCheckResponse::ServingStatus expected_serving_status) { |
||||
HealthCheckRequest request; |
||||
request.set_service(service_name); |
||||
HealthCheckResponse response; |
||||
ClientContext context; |
||||
Status s = hc_stub_->Check(&context, request, &response); |
||||
EXPECT_EQ(expected_status.error_code(), s.error_code()); |
||||
if (s.ok()) { |
||||
EXPECT_EQ(expected_serving_status, response.status()); |
||||
} |
||||
} |
||||
|
||||
void VerifyHealthCheckService() { |
||||
HealthCheckServiceInterface* service = server_->GetHealthCheckService(); |
||||
EXPECT_TRUE(service != nullptr); |
||||
const grpc::string kHealthyService("healthy_service"); |
||||
const grpc::string kUnhealthyService("unhealthy_service"); |
||||
const grpc::string kNotRegisteredService("not_registered"); |
||||
service->SetServingStatus(kHealthyService, true); |
||||
service->SetServingStatus(kUnhealthyService, false); |
||||
|
||||
ResetStubs(); |
||||
|
||||
SendHealthCheckRpc("", Status::OK, HealthCheckResponse::SERVING); |
||||
SendHealthCheckRpc(kHealthyService, Status::OK, |
||||
HealthCheckResponse::SERVING); |
||||
SendHealthCheckRpc(kUnhealthyService, Status::OK, |
||||
HealthCheckResponse::NOT_SERVING); |
||||
SendHealthCheckRpc(kNotRegisteredService, |
||||
Status(StatusCode::NOT_FOUND, "")); |
||||
|
||||
service->SetServingStatus(false); |
||||
SendHealthCheckRpc("", Status::OK, HealthCheckResponse::NOT_SERVING); |
||||
SendHealthCheckRpc(kHealthyService, Status::OK, |
||||
HealthCheckResponse::NOT_SERVING); |
||||
SendHealthCheckRpc(kUnhealthyService, Status::OK, |
||||
HealthCheckResponse::NOT_SERVING); |
||||
SendHealthCheckRpc(kNotRegisteredService, |
||||
Status(StatusCode::NOT_FOUND, "")); |
||||
} |
||||
|
||||
TestServiceImpl echo_test_service_; |
||||
HealthCheckServiceImpl health_check_service_impl_; |
||||
std::unique_ptr<Health::Stub> hc_stub_; |
||||
std::unique_ptr<ServerCompletionQueue> cq_; |
||||
std::unique_ptr<Server> server_; |
||||
std::ostringstream server_address_; |
||||
std::thread cq_thread_; |
||||
}; |
||||
|
||||
TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceDisabled) { |
||||
EnableDefaultHealthCheckService(false); |
||||
EXPECT_FALSE(DefaultHealthCheckServiceEnabled()); |
||||
SetUpServer(true, false, false, nullptr); |
||||
HealthCheckServiceInterface* default_service = |
||||
server_->GetHealthCheckService(); |
||||
EXPECT_TRUE(default_service == nullptr); |
||||
|
||||
ResetStubs(); |
||||
|
||||
SendHealthCheckRpc("", Status(StatusCode::UNIMPLEMENTED, "")); |
||||
} |
||||
|
||||
TEST_F(HealthServiceEnd2endTest, DefaultHealthService) { |
||||
EnableDefaultHealthCheckService(true); |
||||
EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); |
||||
SetUpServer(true, false, false, nullptr); |
||||
VerifyHealthCheckService(); |
||||
|
||||
// The default service has a size limit of the service name.
|
||||
const grpc::string kTooLongServiceName(201, 'x'); |
||||
SendHealthCheckRpc(kTooLongServiceName, |
||||
Status(StatusCode::INVALID_ARGUMENT, "")); |
||||
} |
||||
|
||||
// The server has no sync service.
|
||||
TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceAsyncOnly) { |
||||
EnableDefaultHealthCheckService(true); |
||||
EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); |
||||
SetUpServer(false, true, false, nullptr); |
||||
cq_thread_ = std::thread(LoopCompletionQueue, cq_.get()); |
||||
|
||||
HealthCheckServiceInterface* default_service = |
||||
server_->GetHealthCheckService(); |
||||
EXPECT_TRUE(default_service == nullptr); |
||||
|
||||
ResetStubs(); |
||||
|
||||
SendHealthCheckRpc("", Status(StatusCode::UNIMPLEMENTED, "")); |
||||
} |
||||
|
||||
// Provide an empty service to disable the default service.
|
||||
TEST_F(HealthServiceEnd2endTest, ExplicitlyDisableViaOverride) { |
||||
EnableDefaultHealthCheckService(true); |
||||
EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); |
||||
std::unique_ptr<HealthCheckServiceInterface> empty_service; |
||||
SetUpServer(true, false, true, std::move(empty_service)); |
||||
HealthCheckServiceInterface* service = server_->GetHealthCheckService(); |
||||
EXPECT_TRUE(service == nullptr); |
||||
|
||||
ResetStubs(); |
||||
|
||||
SendHealthCheckRpc("", Status(StatusCode::UNIMPLEMENTED, "")); |
||||
} |
||||
|
||||
// Provide an explicit override of health checking service interface.
|
||||
TEST_F(HealthServiceEnd2endTest, ExplicitlyOverride) { |
||||
EnableDefaultHealthCheckService(true); |
||||
EXPECT_TRUE(DefaultHealthCheckServiceEnabled()); |
||||
std::unique_ptr<HealthCheckServiceInterface> override_service( |
||||
new CustomHealthCheckService(&health_check_service_impl_)); |
||||
HealthCheckServiceInterface* underlying_service = override_service.get(); |
||||
SetUpServer(false, false, true, std::move(override_service)); |
||||
HealthCheckServiceInterface* service = server_->GetHealthCheckService(); |
||||
EXPECT_TRUE(service == underlying_service); |
||||
|
||||
ResetStubs(); |
||||
|
||||
VerifyHealthCheckService(); |
||||
} |
||||
|
||||
} // namespace
|
||||
} // namespace testing
|
||||
} // namespace grpc
|
||||
|
||||
int main(int argc, char** argv) { |
||||
grpc_test_init(argc, argv); |
||||
::testing::InitGoogleTest(&argc, argv); |
||||
return RUN_ALL_TESTS(); |
||||
} |
@ -0,0 +1,382 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2017, 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 benchmark exists to ensure that the benchmark integration is
|
||||
* working */ |
||||
|
||||
#include <string.h> |
||||
#include <sstream> |
||||
|
||||
#include <grpc++/support/channel_arguments.h> |
||||
#include <grpc/grpc.h> |
||||
#include <grpc/support/alloc.h> |
||||
#include <grpc/support/string_util.h> |
||||
|
||||
extern "C" { |
||||
#include "src/core/ext/client_channel/client_channel.h" |
||||
#include "src/core/ext/load_reporting/load_reporting_filter.h" |
||||
#include "src/core/lib/channel/channel_stack.h" |
||||
#include "src/core/lib/channel/compress_filter.h" |
||||
#include "src/core/lib/channel/connected_channel.h" |
||||
#include "src/core/lib/channel/deadline_filter.h" |
||||
#include "src/core/lib/channel/http_client_filter.h" |
||||
#include "src/core/lib/channel/http_server_filter.h" |
||||
#include "src/core/lib/channel/message_size_filter.h" |
||||
#include "src/core/lib/transport/transport_impl.h" |
||||
} |
||||
|
||||
#include "third_party/benchmark/include/benchmark/benchmark.h" |
||||
|
||||
static struct Init { |
||||
Init() { grpc_init(); } |
||||
~Init() { grpc_shutdown(); } |
||||
} g_init; |
||||
|
||||
static void BM_InsecureChannelWithDefaults(benchmark::State &state) { |
||||
grpc_channel *channel = |
||||
grpc_insecure_channel_create("localhost:12345", NULL, NULL); |
||||
grpc_completion_queue *cq = grpc_completion_queue_create(NULL); |
||||
grpc_slice method = grpc_slice_from_static_string("/foo/bar"); |
||||
gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); |
||||
while (state.KeepRunning()) { |
||||
grpc_call_destroy(grpc_channel_create_call(channel, NULL, |
||||
GRPC_PROPAGATE_DEFAULTS, cq, |
||||
method, NULL, deadline, NULL)); |
||||
} |
||||
grpc_channel_destroy(channel); |
||||
grpc_completion_queue_destroy(cq); |
||||
} |
||||
BENCHMARK(BM_InsecureChannelWithDefaults); |
||||
|
||||
static void FilterDestroy(grpc_exec_ctx *exec_ctx, void *arg, |
||||
grpc_error *error) { |
||||
gpr_free(arg); |
||||
} |
||||
|
||||
static void DoNothing(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {} |
||||
|
||||
class FakeClientChannelFactory : public grpc_client_channel_factory { |
||||
public: |
||||
FakeClientChannelFactory() { vtable = &vtable_; } |
||||
|
||||
private: |
||||
static void NoRef(grpc_client_channel_factory *factory) {} |
||||
static void NoUnref(grpc_exec_ctx *exec_ctx, |
||||
grpc_client_channel_factory *factory) {} |
||||
static grpc_subchannel *CreateSubchannel(grpc_exec_ctx *exec_ctx, |
||||
grpc_client_channel_factory *factory, |
||||
const grpc_subchannel_args *args) { |
||||
return nullptr; |
||||
} |
||||
static grpc_channel *CreateClientChannel(grpc_exec_ctx *exec_ctx, |
||||
grpc_client_channel_factory *factory, |
||||
const char *target, |
||||
grpc_client_channel_type type, |
||||
const grpc_channel_args *args) { |
||||
return nullptr; |
||||
} |
||||
|
||||
static const grpc_client_channel_factory_vtable vtable_; |
||||
}; |
||||
|
||||
const grpc_client_channel_factory_vtable FakeClientChannelFactory::vtable_ = { |
||||
NoRef, NoUnref, CreateSubchannel, CreateClientChannel}; |
||||
|
||||
static grpc_arg StringArg(const char *key, const char *value) { |
||||
grpc_arg a; |
||||
a.type = GRPC_ARG_STRING; |
||||
a.key = const_cast<char *>(key); |
||||
a.value.string = const_cast<char *>(value); |
||||
return a; |
||||
} |
||||
|
||||
enum FixtureFlags : uint32_t { |
||||
CHECKS_NOT_LAST = 1, |
||||
REQUIRES_TRANSPORT = 2, |
||||
}; |
||||
|
||||
template <const grpc_channel_filter *kFilter, uint32_t kFlags> |
||||
struct Fixture { |
||||
const grpc_channel_filter *filter = kFilter; |
||||
const uint32_t flags = kFlags; |
||||
}; |
||||
|
||||
namespace dummy_filter { |
||||
|
||||
static void StartTransportStreamOp(grpc_exec_ctx *exec_ctx, |
||||
grpc_call_element *elem, |
||||
grpc_transport_stream_op *op) {} |
||||
|
||||
static void StartTransportOp(grpc_exec_ctx *exec_ctx, |
||||
grpc_channel_element *elem, |
||||
grpc_transport_op *op) {} |
||||
|
||||
static grpc_error *InitCallElem(grpc_exec_ctx *exec_ctx, |
||||
grpc_call_element *elem, |
||||
const grpc_call_element_args *args) { |
||||
return GRPC_ERROR_NONE; |
||||
} |
||||
|
||||
static void SetPollsetOrPollsetSet(grpc_exec_ctx *exec_ctx, |
||||
grpc_call_element *elem, |
||||
grpc_polling_entity *pollent) {} |
||||
|
||||
static void DestroyCallElem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, |
||||
const grpc_call_final_info *final_info, |
||||
void *and_free_memory) {} |
||||
|
||||
grpc_error *InitChannelElem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, |
||||
grpc_channel_element_args *args) { |
||||
return GRPC_ERROR_NONE; |
||||
} |
||||
|
||||
void DestroyChannelElem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem) {} |
||||
|
||||
char *GetPeer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { |
||||
return gpr_strdup("peer"); |
||||
} |
||||
|
||||
void GetChannelInfo(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, |
||||
const grpc_channel_info *channel_info) {} |
||||
|
||||
static const grpc_channel_filter dummy_filter = {StartTransportStreamOp, |
||||
StartTransportOp, |
||||
0, |
||||
InitCallElem, |
||||
SetPollsetOrPollsetSet, |
||||
DestroyCallElem, |
||||
0, |
||||
InitChannelElem, |
||||
DestroyChannelElem, |
||||
GetPeer, |
||||
GetChannelInfo, |
||||
"dummy_filter"}; |
||||
|
||||
} // namespace dummy_filter
|
||||
|
||||
namespace dummy_transport { |
||||
|
||||
/* Memory required for a single stream element - this is allocated by upper
|
||||
layers and initialized by the transport */ |
||||
size_t sizeof_stream; /* = sizeof(transport stream) */ |
||||
|
||||
/* name of this transport implementation */ |
||||
const char *name; |
||||
|
||||
/* implementation of grpc_transport_init_stream */ |
||||
int InitStream(grpc_exec_ctx *exec_ctx, grpc_transport *self, |
||||
grpc_stream *stream, grpc_stream_refcount *refcount, |
||||
const void *server_data) { |
||||
return 0; |
||||
} |
||||
|
||||
/* implementation of grpc_transport_set_pollset */ |
||||
void SetPollset(grpc_exec_ctx *exec_ctx, grpc_transport *self, |
||||
grpc_stream *stream, grpc_pollset *pollset) {} |
||||
|
||||
/* implementation of grpc_transport_set_pollset */ |
||||
void SetPollsetSet(grpc_exec_ctx *exec_ctx, grpc_transport *self, |
||||
grpc_stream *stream, grpc_pollset_set *pollset_set) {} |
||||
|
||||
/* implementation of grpc_transport_perform_stream_op */ |
||||
void PerformStreamOp(grpc_exec_ctx *exec_ctx, grpc_transport *self, |
||||
grpc_stream *stream, grpc_transport_stream_op *op) { |
||||
grpc_closure_sched(exec_ctx, op->on_complete, GRPC_ERROR_NONE); |
||||
} |
||||
|
||||
/* implementation of grpc_transport_perform_op */ |
||||
void PerformOp(grpc_exec_ctx *exec_ctx, grpc_transport *self, |
||||
grpc_transport_op *op) {} |
||||
|
||||
/* implementation of grpc_transport_destroy_stream */ |
||||
void DestroyStream(grpc_exec_ctx *exec_ctx, grpc_transport *self, |
||||
grpc_stream *stream, void *and_free_memory) {} |
||||
|
||||
/* implementation of grpc_transport_destroy */ |
||||
void Destroy(grpc_exec_ctx *exec_ctx, grpc_transport *self) {} |
||||
|
||||
/* implementation of grpc_transport_get_peer */ |
||||
char *GetPeer(grpc_exec_ctx *exec_ctx, grpc_transport *self) { |
||||
return gpr_strdup("transport_peer"); |
||||
} |
||||
|
||||
/* implementation of grpc_transport_get_endpoint */ |
||||
grpc_endpoint *GetEndpoint(grpc_exec_ctx *exec_ctx, grpc_transport *self) { |
||||
return nullptr; |
||||
} |
||||
|
||||
static const grpc_transport_vtable dummy_transport_vtable = { |
||||
0, "dummy_http2", InitStream, |
||||
SetPollset, SetPollsetSet, PerformStreamOp, |
||||
PerformOp, DestroyStream, Destroy, |
||||
GetPeer, GetEndpoint}; |
||||
|
||||
static grpc_transport dummy_transport = {&dummy_transport_vtable}; |
||||
|
||||
} // namespace dummy_transport
|
||||
|
||||
class NoOp { |
||||
public: |
||||
class Op { |
||||
public: |
||||
Op(grpc_exec_ctx *exec_ctx, NoOp *p, grpc_call_stack *s) {} |
||||
void Finish(grpc_exec_ctx *exec_ctx) {} |
||||
}; |
||||
}; |
||||
|
||||
class SendEmptyMetadata { |
||||
public: |
||||
SendEmptyMetadata() { |
||||
memset(&op_, 0, sizeof(op_)); |
||||
op_.on_complete = grpc_closure_init(&closure_, DoNothing, nullptr, |
||||
grpc_schedule_on_exec_ctx); |
||||
} |
||||
|
||||
class Op { |
||||
public: |
||||
Op(grpc_exec_ctx *exec_ctx, SendEmptyMetadata *p, grpc_call_stack *s) { |
||||
grpc_metadata_batch_init(&batch_); |
||||
p->op_.send_initial_metadata = &batch_; |
||||
} |
||||
void Finish(grpc_exec_ctx *exec_ctx) { |
||||
grpc_metadata_batch_destroy(exec_ctx, &batch_); |
||||
} |
||||
|
||||
private: |
||||
grpc_metadata_batch batch_; |
||||
}; |
||||
|
||||
private: |
||||
const gpr_timespec deadline_ = gpr_inf_future(GPR_CLOCK_MONOTONIC); |
||||
const gpr_timespec start_time_ = gpr_now(GPR_CLOCK_MONOTONIC); |
||||
const grpc_slice method_ = grpc_slice_from_static_string("/foo/bar"); |
||||
grpc_transport_stream_op op_; |
||||
grpc_closure closure_; |
||||
}; |
||||
|
||||
// Test a filter in isolation. Fixture specifies the filter under test (use the
|
||||
// Fixture<> template to specify this), and TestOp defines some unit of work to
|
||||
// perform on said filter.
|
||||
template <class Fixture, class TestOp> |
||||
static void BM_IsolatedFilter(benchmark::State &state) { |
||||
Fixture fixture; |
||||
std::ostringstream label; |
||||
|
||||
std::vector<grpc_arg> args; |
||||
FakeClientChannelFactory fake_client_channel_factory; |
||||
args.push_back(grpc_client_channel_factory_create_channel_arg( |
||||
&fake_client_channel_factory)); |
||||
args.push_back(StringArg(GRPC_ARG_SERVER_URI, "localhost")); |
||||
|
||||
grpc_channel_args channel_args = {args.size(), &args[0]}; |
||||
|
||||
std::vector<const grpc_channel_filter *> filters; |
||||
if (fixture.filter != nullptr) { |
||||
filters.push_back(fixture.filter); |
||||
} |
||||
if (fixture.flags & CHECKS_NOT_LAST) { |
||||
filters.push_back(&dummy_filter::dummy_filter); |
||||
label << " #has_dummy_filter"; |
||||
} |
||||
|
||||
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; |
||||
size_t channel_size = grpc_channel_stack_size(&filters[0], filters.size()); |
||||
grpc_channel_stack *channel_stack = |
||||
static_cast<grpc_channel_stack *>(gpr_malloc(channel_size)); |
||||
GPR_ASSERT(GRPC_LOG_IF_ERROR( |
||||
"call_stack_init", |
||||
grpc_channel_stack_init(&exec_ctx, 1, FilterDestroy, channel_stack, |
||||
&filters[0], filters.size(), &channel_args, |
||||
fixture.flags & REQUIRES_TRANSPORT |
||||
? &dummy_transport::dummy_transport |
||||
: nullptr, |
||||
"CHANNEL", channel_stack))); |
||||
grpc_exec_ctx_flush(&exec_ctx); |
||||
grpc_call_stack *call_stack = static_cast<grpc_call_stack *>( |
||||
gpr_malloc(channel_stack->call_stack_size)); |
||||
gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); |
||||
gpr_timespec start_time = gpr_now(GPR_CLOCK_MONOTONIC); |
||||
grpc_slice method = grpc_slice_from_static_string("/foo/bar"); |
||||
grpc_call_final_info final_info; |
||||
TestOp test_op_data; |
||||
while (state.KeepRunning()) { |
||||
GRPC_ERROR_UNREF(grpc_call_stack_init(&exec_ctx, channel_stack, 1, |
||||
DoNothing, NULL, NULL, NULL, method, |
||||
start_time, deadline, call_stack)); |
||||
typename TestOp::Op op(&exec_ctx, &test_op_data, call_stack); |
||||
grpc_call_stack_destroy(&exec_ctx, call_stack, &final_info, NULL); |
||||
op.Finish(&exec_ctx); |
||||
grpc_exec_ctx_flush(&exec_ctx); |
||||
} |
||||
grpc_channel_stack_destroy(&exec_ctx, channel_stack); |
||||
grpc_exec_ctx_finish(&exec_ctx); |
||||
gpr_free(channel_stack); |
||||
gpr_free(call_stack); |
||||
|
||||
state.SetLabel(label.str()); |
||||
} |
||||
|
||||
typedef Fixture<nullptr, 0> NoFilter; |
||||
BENCHMARK_TEMPLATE(BM_IsolatedFilter, NoFilter, NoOp); |
||||
typedef Fixture<&dummy_filter::dummy_filter, 0> DummyFilter; |
||||
BENCHMARK_TEMPLATE(BM_IsolatedFilter, DummyFilter, NoOp); |
||||
BENCHMARK_TEMPLATE(BM_IsolatedFilter, DummyFilter, SendEmptyMetadata); |
||||
typedef Fixture<&grpc_client_channel_filter, 0> ClientChannelFilter; |
||||
BENCHMARK_TEMPLATE(BM_IsolatedFilter, ClientChannelFilter, NoOp); |
||||
typedef Fixture<&grpc_compress_filter, CHECKS_NOT_LAST> CompressFilter; |
||||
BENCHMARK_TEMPLATE(BM_IsolatedFilter, CompressFilter, NoOp); |
||||
BENCHMARK_TEMPLATE(BM_IsolatedFilter, CompressFilter, SendEmptyMetadata); |
||||
typedef Fixture<&grpc_client_deadline_filter, CHECKS_NOT_LAST> |
||||
ClientDeadlineFilter; |
||||
BENCHMARK_TEMPLATE(BM_IsolatedFilter, ClientDeadlineFilter, NoOp); |
||||
BENCHMARK_TEMPLATE(BM_IsolatedFilter, ClientDeadlineFilter, SendEmptyMetadata); |
||||
typedef Fixture<&grpc_server_deadline_filter, CHECKS_NOT_LAST> |
||||
ServerDeadlineFilter; |
||||
BENCHMARK_TEMPLATE(BM_IsolatedFilter, ServerDeadlineFilter, NoOp); |
||||
BENCHMARK_TEMPLATE(BM_IsolatedFilter, ServerDeadlineFilter, SendEmptyMetadata); |
||||
typedef Fixture<&grpc_http_client_filter, CHECKS_NOT_LAST | REQUIRES_TRANSPORT> |
||||
HttpClientFilter; |
||||
BENCHMARK_TEMPLATE(BM_IsolatedFilter, HttpClientFilter, NoOp); |
||||
BENCHMARK_TEMPLATE(BM_IsolatedFilter, HttpClientFilter, SendEmptyMetadata); |
||||
typedef Fixture<&grpc_http_server_filter, CHECKS_NOT_LAST> HttpServerFilter; |
||||
BENCHMARK_TEMPLATE(BM_IsolatedFilter, HttpServerFilter, NoOp); |
||||
BENCHMARK_TEMPLATE(BM_IsolatedFilter, HttpServerFilter, SendEmptyMetadata); |
||||
typedef Fixture<&grpc_message_size_filter, CHECKS_NOT_LAST> MessageSizeFilter; |
||||
BENCHMARK_TEMPLATE(BM_IsolatedFilter, MessageSizeFilter, NoOp); |
||||
BENCHMARK_TEMPLATE(BM_IsolatedFilter, MessageSizeFilter, SendEmptyMetadata); |
||||
typedef Fixture<&grpc_load_reporting_filter, CHECKS_NOT_LAST> |
||||
LoadReportingFilter; |
||||
BENCHMARK_TEMPLATE(BM_IsolatedFilter, LoadReportingFilter, NoOp); |
||||
BENCHMARK_TEMPLATE(BM_IsolatedFilter, LoadReportingFilter, SendEmptyMetadata); |
||||
|
||||
BENCHMARK_MAIN(); |
@ -0,0 +1,119 @@ |
||||
/*
|
||||
* |
||||
* 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 benchmark exists to ensure that the benchmark integration is
|
||||
* working */ |
||||
|
||||
#include <grpc++/completion_queue.h> |
||||
#include <grpc++/impl/grpc_library.h> |
||||
#include <grpc/grpc.h> |
||||
|
||||
#include "third_party/benchmark/include/benchmark/benchmark.h" |
||||
|
||||
extern "C" { |
||||
#include "src/core/lib/surface/completion_queue.h" |
||||
} |
||||
|
||||
namespace grpc { |
||||
namespace testing { |
||||
|
||||
static class InitializeStuff { |
||||
public: |
||||
InitializeStuff() { init_lib_.init(); } |
||||
~InitializeStuff() { init_lib_.shutdown(); } |
||||
|
||||
private: |
||||
internal::GrpcLibrary init_lib_; |
||||
internal::GrpcLibraryInitializer init_; |
||||
} initialize_stuff; |
||||
|
||||
static void BM_CreateDestroyCpp(benchmark::State& state) { |
||||
while (state.KeepRunning()) { |
||||
CompletionQueue cq; |
||||
} |
||||
} |
||||
BENCHMARK(BM_CreateDestroyCpp); |
||||
|
||||
static void BM_CreateDestroyCore(benchmark::State& state) { |
||||
while (state.KeepRunning()) { |
||||
grpc_completion_queue_destroy(grpc_completion_queue_create(NULL)); |
||||
} |
||||
} |
||||
BENCHMARK(BM_CreateDestroyCore); |
||||
|
||||
static void DoneWithCompletionOnStack(grpc_exec_ctx* exec_ctx, void* arg, |
||||
grpc_cq_completion* completion) {} |
||||
|
||||
class DummyTag final : public CompletionQueueTag { |
||||
public: |
||||
bool FinalizeResult(void** tag, bool* status) override { return true; } |
||||
}; |
||||
|
||||
static void BM_Pass1Cpp(benchmark::State& state) { |
||||
CompletionQueue cq; |
||||
grpc_completion_queue* c_cq = cq.cq(); |
||||
while (state.KeepRunning()) { |
||||
grpc_cq_completion completion; |
||||
DummyTag dummy_tag; |
||||
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; |
||||
grpc_cq_begin_op(c_cq, &dummy_tag); |
||||
grpc_cq_end_op(&exec_ctx, c_cq, &dummy_tag, GRPC_ERROR_NONE, |
||||
DoneWithCompletionOnStack, NULL, &completion); |
||||
grpc_exec_ctx_finish(&exec_ctx); |
||||
void* tag; |
||||
bool ok; |
||||
cq.Next(&tag, &ok); |
||||
} |
||||
} |
||||
BENCHMARK(BM_Pass1Cpp); |
||||
|
||||
static void BM_Pass1Core(benchmark::State& state) { |
||||
grpc_completion_queue* cq = grpc_completion_queue_create(NULL); |
||||
gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); |
||||
while (state.KeepRunning()) { |
||||
grpc_cq_completion completion; |
||||
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; |
||||
grpc_cq_begin_op(cq, NULL); |
||||
grpc_cq_end_op(&exec_ctx, cq, NULL, GRPC_ERROR_NONE, |
||||
DoneWithCompletionOnStack, NULL, &completion); |
||||
grpc_exec_ctx_finish(&exec_ctx); |
||||
grpc_completion_queue_next(cq, deadline, NULL); |
||||
} |
||||
grpc_completion_queue_destroy(cq); |
||||
} |
||||
BENCHMARK(BM_Pass1Core); |
||||
|
||||
} // namespace testing
|
||||
} // namespace grpc
|
||||
|
||||
BENCHMARK_MAIN(); |
@ -0,0 +1,70 @@ |
||||
# Copyright 2017, 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. |
||||
|
||||
licenses(["notice"]) # 3-clause BSD |
||||
|
||||
cc_library( |
||||
name = "test_config", |
||||
srcs = [ |
||||
"test_config_cc.cc", |
||||
], |
||||
hdrs = [ |
||||
"test_config.h", |
||||
], |
||||
visibility = ["//test:__subpackages__"], |
||||
deps = [ |
||||
"//:gpr", |
||||
"//external:gflags", |
||||
], |
||||
) |
||||
|
||||
cc_library( |
||||
name = "test_util", |
||||
srcs = [ |
||||
# "test/cpp/end2end/test_service_impl.cc", |
||||
"byte_buffer_proto_helper.cc", |
||||
"create_test_channel.cc", |
||||
"string_ref_helper.cc", |
||||
"subprocess.cc", |
||||
"test_credentials_provider.cc", |
||||
], |
||||
hdrs = [ |
||||
"byte_buffer_proto_helper.h", |
||||
"create_test_channel.h", |
||||
"string_ref_helper.h", |
||||
"subprocess.h", |
||||
"test_credentials_provider.h", |
||||
], |
||||
visibility = ["//test:__subpackages__"], |
||||
deps = [ |
||||
"//:grpc++", |
||||
"//test/core/end2end:ssl_test_data", |
||||
"//test/core/util:gpr_test_util", |
||||
], |
||||
) |
@ -1 +1 @@ |
||||
Subproject commit f8a0efe03aa69b3336d8e228b37d4ccb17324b88 |
||||
Subproject commit 30dbc81fb5ffdc98ea9b14b1918bfe4e8779b26e |
@ -0,0 +1,14 @@ |
||||
cc_library( |
||||
name = "gtest", |
||||
srcs = [ |
||||
"src/gtest-all.cc", |
||||
], |
||||
hdrs = glob(["include/**/*.h", "src/*.cc", "src/*.h"]), |
||||
includes = [ |
||||
"include", "." |
||||
], |
||||
linkstatic = 1, |
||||
visibility = [ |
||||
"//visibility:public", |
||||
], |
||||
) |
@ -0,0 +1,40 @@ |
||||
# Copyright 2017, 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. |
||||
|
||||
# Config file for the internal CI (in protobuf text format) |
||||
|
||||
# Location of the continuous shell script in repository. |
||||
build_file: "grpc/tools/internal_ci/linux/grpc_interop_badserver_python.sh" |
||||
# grpc_interop tests can take 6+ hours to complete. |
||||
timeout_mins: 480 |
||||
action { |
||||
define_artifacts { |
||||
regex: "**/report.xml" |
||||
} |
||||
} |
@ -0,0 +1,41 @@ |
||||
#!/usr/bin/env bash |
||||
# Copyright 2017, 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. |
||||
|
||||
set -ex |
||||
|
||||
export LANG=en_US.UTF-8 |
||||
|
||||
# Enter the gRPC repo root |
||||
cd $(dirname $0)/../../.. |
||||
|
||||
git submodule update --init |
||||
|
||||
tools/run_tests/run_interop_tests.py -l python --use_docker --http2_badserver_interop $@ |
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue