diff options
Diffstat (limited to 'test/core')
-rw-r--r-- | test/core/channel/BUILD | 9 | ||||
-rw-r--r-- | test/core/channel/channelz_test.cc | 57 | ||||
-rw-r--r-- | test/core/end2end/fuzzers/api_fuzzer.cc | 1 | ||||
-rw-r--r-- | test/core/end2end/tests/simple_request.cc | 7 | ||||
-rw-r--r-- | test/core/surface/public_headers_must_be_c89.c | 1 |
5 files changed, 75 insertions, 0 deletions
diff --git a/test/core/channel/BUILD b/test/core/channel/BUILD index c554b20148..c336688209 100644 --- a/test/core/channel/BUILD +++ b/test/core/channel/BUILD @@ -84,8 +84,13 @@ grpc_cc_test( ) grpc_cc_test( +<<<<<<< HEAD name = "channelz_registry_test", srcs = ["channelz_registry_test.cc"], +======= + name = "channelz_test", + srcs = ["channelz_test.cc"], +>>>>>>> Add channelz test language = "C++", deps = [ "//:gpr", @@ -93,6 +98,10 @@ grpc_cc_test( "//:grpc++", "//test/core/util:gpr_test_util", "//test/core/util:grpc_test_util", +<<<<<<< HEAD +======= + "//test/cpp/util:channel_trace_proto_helper", +>>>>>>> Add channelz test ], external_deps = [ "gtest", diff --git a/test/core/channel/channelz_test.cc b/test/core/channel/channelz_test.cc new file mode 100644 index 0000000000..503bb9065b --- /dev/null +++ b/test/core/channel/channelz_test.cc @@ -0,0 +1,57 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include <stdlib.h> +#include <string.h> + +#include <gtest/gtest.h> + +#include <grpc/support/alloc.h> +#include <grpc/support/log.h> + +#include "src/core/lib/channel/channel_trace.h" +#include "src/core/lib/channel/channelz_registry.h" +#include "src/core/lib/gpr/useful.h" +#include "src/core/lib/iomgr/exec_ctx.h" +#include "src/core/lib/json/json.h" + +#include "test/core/util/test_config.h" +#include "test/cpp/util/channel_trace_proto_helper.h" + +// remove me +#include <grpc/support/string_util.h> +#include <stdlib.h> +#include <string.h> + +namespace grpc_core { +namespace testing { +namespace {} // anonymous namespace + +TEST(ChannelzTest, Channel) {} + +} // namespace testing +} // namespace grpc_core + +int main(int argc, char** argv) { + grpc_test_init(argc, argv); + grpc_init(); + ::testing::InitGoogleTest(&argc, argv); + int ret = RUN_ALL_TESTS(); + grpc_shutdown(); + return ret; +} diff --git a/test/core/end2end/fuzzers/api_fuzzer.cc b/test/core/end2end/fuzzers/api_fuzzer.cc index 36f257d6da..ba9c04fd0e 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.cc +++ b/test/core/end2end/fuzzers/api_fuzzer.cc @@ -1048,6 +1048,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { op->reserved = nullptr; op->flags = grpc_fuzzer_get_next_uint32(&inp); } + if (g_channel == nullptr) ok = false; if (ok) { validator* v = make_finished_batch_validator(g_active_call, has_ops); g_active_call->pending_ops++; diff --git a/test/core/end2end/tests/simple_request.cc b/test/core/end2end/tests/simple_request.cc index 941d9ae319..6e36e54cd3 100644 --- a/test/core/end2end/tests/simple_request.cc +++ b/test/core/end2end/tests/simple_request.cc @@ -21,6 +21,9 @@ #include <stdio.h> #include <string.h> +#include "src/core/ext/filters/client_channel/client_channel.h" +#include "src/core/lib/surface/channel.h" + #include <grpc/byte_buffer.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> @@ -198,6 +201,10 @@ static void simple_request_body(grpc_end2end_test_config config, CQ_EXPECT_COMPLETION(cqv, tag(1), 1); cq_verify(cqv); + char* json = grpc_channel_render_channelz(f.client); + gpr_log(GPR_ERROR, "%s", json); + gpr_free(json); + GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); // the following sanity check makes sure that the requested error string is diff --git a/test/core/surface/public_headers_must_be_c89.c b/test/core/surface/public_headers_must_be_c89.c index 52a1b03998..bc9c2f2a13 100644 --- a/test/core/surface/public_headers_must_be_c89.c +++ b/test/core/surface/public_headers_must_be_c89.c @@ -108,6 +108,7 @@ int main(int argc, char **argv) { printf("%lx", (unsigned long) grpc_channel_destroy); printf("%lx", (unsigned long) grpc_channel_get_trace); printf("%lx", (unsigned long) grpc_channel_get_uuid); + printf("%lx", (unsigned long) grpc_channelz_get_channel); printf("%lx", (unsigned long) grpc_call_cancel); printf("%lx", (unsigned long) grpc_call_cancel_with_status); printf("%lx", (unsigned long) grpc_call_ref); |