[grpc][Gpr_To_Absl_Logging] Deleting multiple instances of gpr_set_log_function (#36833)

Deleting multiple instances of gpr_set_log_function .
This function will be deleted soon.
https://github.com/grpc/proposal/pull/425

Closes #36833

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36833 from tanvi-jagtap:remove_gpr_log_partial_code 17517efee4
PiperOrigin-RevId: 641268299
pull/36576/head^2
Tanvi Jagtap 6 months ago committed by Copybara-Service
parent bc6a1c6922
commit 1dbfd4c9f2
  1. 43
      CMakeLists.txt
  2. 11
      build_autogenerated.yaml
  3. 1
      grpc.def
  4. 3
      include/grpc/support/log.h
  5. 5
      src/core/util/log.cc
  6. 2
      src/ruby/ext/grpc/rb_grpc_imports.generated.c
  7. 3
      src/ruby/ext/grpc/rb_grpc_imports.generated.h
  8. 3
      test/core/call/yodel/fuzzer_main.cc
  9. 3
      test/core/end2end/end2end_test_fuzzer.cc
  10. 4
      test/core/end2end/fuzzers/api_fuzzer.cc
  11. 4
      test/core/end2end/fuzzers/client_fuzzer.cc
  12. 4
      test/core/end2end/fuzzers/server_fuzzer.cc
  13. 5
      test/core/ext/filters/event_engine_client_channel_resolver/resolver_fuzzer.cc
  14. 7
      test/core/nanopb/fuzzer_response.cc
  15. 7
      test/core/nanopb/fuzzer_serverlist.cc
  16. 6
      test/core/resource_quota/memory_quota_fuzzer.cc
  17. 4
      test/core/security/alts_credentials_fuzzer.cc
  18. 6
      test/core/security/ssl_server_fuzzer.cc
  19. 6
      test/core/transport/binder/end2end/fuzzers/client_fuzzer.cc
  20. 6
      test/core/transport/binder/end2end/fuzzers/server_fuzzer.cc
  21. 6
      test/core/transport/chttp2/hpack_parser_fuzzer_test.cc
  22. 6
      test/core/transport/chttp2/hpack_sync_fuzzer.cc
  23. 17
      test/core/util/BUILD
  24. 99
      test/core/util/log_test.cc
  25. 2
      test/cpp/interop/BUILD
  26. 5
      test/cpp/interop/metrics_client.cc
  27. 58
      test/cpp/interop/stress_test.cc
  28. 24
      tools/run_tests/generated/tests.json

43
CMakeLists.txt generated

@ -1212,7 +1212,6 @@ if(gRPC_BUILD_TESTS)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_cxx lock_free_event_test)
endif()
add_dependencies(buildtests_cxx log_test)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_cxx log_too_many_open_files_test)
endif()
@ -19643,48 +19642,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_POSIX)
endif()
endif()
if(gRPC_BUILD_TESTS)
add_executable(log_test
test/core/util/log_test.cc
)
if(WIN32 AND MSVC)
if(BUILD_SHARED_LIBS)
target_compile_definitions(log_test
PRIVATE
"GPR_DLL_IMPORTS"
"GRPC_DLL_IMPORTS"
)
endif()
endif()
target_compile_features(log_test PUBLIC cxx_std_14)
target_include_directories(log_test
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include
${_gRPC_ADDRESS_SORTING_INCLUDE_DIR}
${_gRPC_RE2_INCLUDE_DIR}
${_gRPC_SSL_INCLUDE_DIR}
${_gRPC_UPB_GENERATED_DIR}
${_gRPC_UPB_GRPC_GENERATED_DIR}
${_gRPC_UPB_INCLUDE_DIR}
${_gRPC_XXHASH_INCLUDE_DIR}
${_gRPC_ZLIB_INCLUDE_DIR}
third_party/googletest/googletest/include
third_party/googletest/googletest
third_party/googletest/googlemock/include
third_party/googletest/googlemock
${_gRPC_PROTO_GENS_DIR}
)
target_link_libraries(log_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
grpc_test_util
)
endif()
if(gRPC_BUILD_TESTS)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)

@ -13615,17 +13615,6 @@ targets:
- linux
- posix
uses_polling: false
- name: log_test
gtest: true
build: test
language: c++
headers: []
src:
- test/core/util/log_test.cc
deps:
- gtest
- grpc_test_util
uses_polling: false
- name: log_too_many_open_files_test
gtest: true
build: test

1
grpc.def generated

@ -236,6 +236,7 @@ EXPORTS
gpr_log_message
gpr_set_log_verbosity
gpr_log_verbosity_init
gpr_disable_all_logs
gpr_set_log_function
gpr_assertion_failed
gpr_format_message

@ -69,6 +69,8 @@ GPRAPI void gpr_set_log_verbosity(gpr_log_severity min_severity_to_print);
GPRAPI void gpr_log_verbosity_init(void);
GPRAPI void gpr_disable_all_logs(void);
/** Log overrides: applications can use this API to intercept logging calls
and use their own implementations */
@ -82,6 +84,7 @@ struct gpr_log_func_args {
typedef struct gpr_log_func_args gpr_log_func_args;
typedef void (*gpr_log_func)(gpr_log_func_args* args);
GPRAPI void gpr_set_log_function(gpr_log_func func);
GPRAPI void gpr_assertion_failed(const char* filename, int line,

@ -187,3 +187,8 @@ void gpr_log_verbosity_init() {
void gpr_set_log_function(gpr_log_func f) {
gpr_atm_no_barrier_store(&g_log_func, (gpr_atm)(f ? f : gpr_default_log));
}
void gpr_disable_all_logs() {
absl::SetMinLogLevel(absl::LogSeverityAtLeast::kInfinity);
absl::SetVLogLevel("*grpc*/*", -1);
}

@ -259,6 +259,7 @@ gpr_should_log_type gpr_should_log_import;
gpr_log_message_type gpr_log_message_import;
gpr_set_log_verbosity_type gpr_set_log_verbosity_import;
gpr_log_verbosity_init_type gpr_log_verbosity_init_import;
gpr_disable_all_logs_type gpr_disable_all_logs_import;
gpr_set_log_function_type gpr_set_log_function_import;
gpr_assertion_failed_type gpr_assertion_failed_import;
gpr_format_message_type gpr_format_message_import;
@ -549,6 +550,7 @@ void grpc_rb_load_imports(HMODULE library) {
gpr_log_message_import = (gpr_log_message_type) GetProcAddress(library, "gpr_log_message");
gpr_set_log_verbosity_import = (gpr_set_log_verbosity_type) GetProcAddress(library, "gpr_set_log_verbosity");
gpr_log_verbosity_init_import = (gpr_log_verbosity_init_type) GetProcAddress(library, "gpr_log_verbosity_init");
gpr_disable_all_logs_import = (gpr_disable_all_logs_type) GetProcAddress(library, "gpr_disable_all_logs");
gpr_set_log_function_import = (gpr_set_log_function_type) GetProcAddress(library, "gpr_set_log_function");
gpr_assertion_failed_import = (gpr_assertion_failed_type) GetProcAddress(library, "gpr_assertion_failed");
gpr_format_message_import = (gpr_format_message_type) GetProcAddress(library, "gpr_format_message");

@ -753,6 +753,9 @@ extern gpr_set_log_verbosity_type gpr_set_log_verbosity_import;
typedef void(*gpr_log_verbosity_init_type)(void);
extern gpr_log_verbosity_init_type gpr_log_verbosity_init_import;
#define gpr_log_verbosity_init gpr_log_verbosity_init_import
typedef void(*gpr_disable_all_logs_type)(void);
extern gpr_disable_all_logs_type gpr_disable_all_logs_import;
#define gpr_disable_all_logs gpr_disable_all_logs_import
typedef void(*gpr_set_log_function_type)(gpr_log_func func);
extern gpr_set_log_function_type gpr_set_log_function_import;
#define gpr_set_log_function gpr_set_log_function_import

@ -33,7 +33,6 @@
#include "test/core/test_util/proto_bit_gen.h"
bool squelch = true;
static void dont_log(gpr_log_func_args* /*args*/) {}
DEFINE_PROTO_FUZZER(const transport_test_suite::Msg& msg) {
static const grpc_core::NoDestruct<
@ -43,7 +42,7 @@ DEFINE_PROTO_FUZZER(const transport_test_suite::Msg& msg) {
const int test_id = msg.test_id() % tests->size();
if (squelch && !grpc_core::GetEnv("GRPC_TRACE_FUZZER").has_value()) {
gpr_set_log_function(dont_log);
gpr_disable_all_logs();
}
grpc_core::ConfigVars::Overrides overrides =

@ -48,7 +48,6 @@ using ::grpc_event_engine::experimental::FuzzingEventEngine;
using ::grpc_event_engine::experimental::GetDefaultEventEngine;
bool squelch = true;
static void dont_log(gpr_log_func_args* /*args*/) {}
namespace grpc_core {
@ -92,7 +91,7 @@ void RunEnd2endFuzzer(const core_end2end_test_fuzzer::Msg& msg) {
const int test_id = msg.test_id() % tests.size();
if (squelch && !GetEnv("GRPC_TRACE_FUZZER").has_value()) {
gpr_set_log_function(dont_log);
gpr_disable_all_logs();
}
// TODO(ctiller): make this per fixture?

@ -78,8 +78,6 @@
bool squelch = true;
bool leak_check = true;
static void dont_log(gpr_log_func_args* /*args*/) {}
////////////////////////////////////////////////////////////////////////////////
// dns resolution
@ -506,7 +504,7 @@ using grpc_core::testing::ApiFuzzer;
DEFINE_PROTO_FUZZER(const api_fuzzer::Msg& msg) {
if (squelch && !grpc_core::GetEnv("GRPC_TRACE_FUZZER").has_value()) {
gpr_set_log_function(dont_log);
gpr_disable_all_logs();
}
grpc_core::ApplyFuzzConfigVars(msg.config_vars());
grpc_core::TestOnlyReloadExperimentsFromConfigVariables();

@ -49,8 +49,6 @@ bool leak_check = true;
static void discard_write(grpc_slice /*slice*/) {}
static void dont_log(gpr_log_func_args* /*args*/) {}
namespace grpc_core {
namespace testing {
@ -101,7 +99,7 @@ class ClientFuzzer final : public BasicFuzzer {
DEFINE_PROTO_FUZZER(const fuzzer_input::Msg& msg) {
if (squelch && !grpc_core::GetEnv("GRPC_TRACE_FUZZER").has_value()) {
gpr_set_log_function(dont_log);
gpr_disable_all_logs();
}
if (msg.network_input().size() != 1) return;
grpc_core::ApplyFuzzConfigVars(msg.config_vars());

@ -35,8 +35,6 @@
bool squelch = true;
bool leak_check = true;
static void dont_log(gpr_log_func_args* /*args*/) {}
namespace grpc_core {
namespace testing {
@ -97,7 +95,7 @@ void RunServerFuzzer(
absl::FunctionRef<void(grpc_server*, int, const ChannelArgs&)>
server_setup) {
if (squelch && !GetEnv("GRPC_TRACE_FUZZER").has_value()) {
gpr_set_log_function(dont_log);
gpr_disable_all_logs();
}
static const int once = []() {
ForceEnableExperiment("event_engine_client", true);

@ -50,7 +50,6 @@
#include "test/core/test_util/fuzzing_channel_args.h"
bool squelch = true;
static void dont_log(gpr_log_func_args* /*args*/) {}
namespace {
@ -254,7 +253,9 @@ grpc_core::ResolverArgs ConstructResolverArgs(
} // namespace
DEFINE_PROTO_FUZZER(const event_engine_client_channel_resolver::Msg& msg) {
if (squelch) gpr_set_log_function(dont_log);
if (squelch) {
gpr_disable_all_logs();
}
bool done_resolving = false;
grpc_core::ApplyFuzzConfigVars(msg.config_vars());
grpc_core::TestOnlyReloadExperimentsFromConfigVariables();

@ -25,12 +25,13 @@
bool squelch = true;
bool leak_check = true;
static void dont_log(gpr_log_func_args* /*args*/) {}
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* /*data*/,
size_t /*size*/) {
grpc_init();
if (squelch) gpr_set_log_function(dont_log);
if (squelch) {
gpr_disable_all_logs();
}
// TODO(veblush): Convert this to upb.
//
// grpc_slice slice = grpc_slice_from_copied_buffer((const char*)data, size);

@ -25,12 +25,13 @@
bool squelch = true;
bool leak_check = true;
static void dont_log(gpr_log_func_args* /*args*/) {}
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* /*data*/,
size_t /*size*/) {
grpc_init();
if (squelch) gpr_set_log_function(dont_log);
if (squelch) {
gpr_disable_all_logs();
}
// TODO(veblush): Convert this to upb.
//
// grpc_slice slice = grpc_slice_from_copied_buffer((const char*)data, size);

@ -187,10 +187,10 @@ class Fuzzer {
} // namespace testing
} // namespace grpc_core
static void dont_log(gpr_log_func_args* /*args*/) {}
DEFINE_PROTO_FUZZER(const memory_quota_fuzzer::Msg& msg) {
if (squelch) gpr_set_log_function(dont_log);
if (squelch) {
gpr_disable_all_logs();
}
grpc_core::ApplyFuzzConfigVars(msg.config_vars());
grpc_core::TestOnlyReloadExperimentsFromConfigVariables();
gpr_log_verbosity_init();

@ -42,8 +42,6 @@ using grpc_core::testing::input_stream;
bool squelch = true;
bool leak_check = true;
static void dont_log(gpr_log_func_args* /*args*/) {}
// Add a random number of target service accounts to client options.
static void read_target_service_accounts(
input_stream* inp, grpc_alts_credentials_options* options) {
@ -65,7 +63,7 @@ static void read_target_service_accounts(
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (squelch && !grpc_core::GetEnv("GRPC_TRACE_FUZZER").has_value()) {
gpr_set_log_function(dont_log);
gpr_disable_all_logs();
}
input_stream inp = {data, data + size};
grpc_init();

@ -43,8 +43,6 @@ bool squelch = true;
// Turning this on will fail the leak check.
bool leak_check = false;
static void dont_log(gpr_log_func_args* /*args*/) {}
struct handshake_state {
grpc_core::Notification done_signal;
};
@ -60,7 +58,9 @@ static void on_handshake_done(void* arg, grpc_error_handle error) {
}
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (squelch) gpr_set_log_function(dont_log);
if (squelch) {
gpr_disable_all_logs();
}
grpc_init();
{
grpc_core::ExecCtx exec_ctx;

@ -35,10 +35,10 @@ bool leak_check = true;
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void dont_log(gpr_log_func_args*) {}
DEFINE_PROTO_FUZZER(const binder_transport_fuzzer::Input& input) {
if (squelch) gpr_set_log_function(dont_log);
if (squelch) {
gpr_disable_all_logs();
}
grpc_init();
{
// Copied and modified from grpc/test/core/end2end/fuzzers/client_fuzzer.cc

@ -30,10 +30,10 @@ bool leak_check = true;
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void dont_log(gpr_log_func_args* /*args*/) {}
DEFINE_PROTO_FUZZER(const binder_transport_fuzzer::Input& input) {
if (squelch) gpr_set_log_function(dont_log);
if (squelch) {
gpr_disable_all_logs();
}
grpc_init();
{
// Copied and modified from grpc/test/core/end2end/fuzzers/server_fuzzer.cc

@ -50,10 +50,10 @@
bool squelch = true;
bool leak_check = true;
static void dont_log(gpr_log_func_args* /*args*/) {}
DEFINE_PROTO_FUZZER(const hpack_parser_fuzzer::Msg& msg) {
if (squelch) gpr_set_log_function(dont_log);
if (squelch) {
gpr_disable_all_logs();
}
grpc_core::ProtoBitGen proto_bit_src(msg.random_numbers());
grpc_core::ApplyFuzzConfigVars(msg.config_vars());
grpc_core::TestOnlyReloadExperimentsFromConfigVariables();

@ -52,8 +52,6 @@
bool squelch = true;
bool leak_check = true;
static void dont_log(gpr_log_func_args* /*args*/) {}
namespace grpc_core {
namespace {
@ -170,7 +168,9 @@ void FuzzOneInput(const hpack_sync_fuzzer::Msg& msg) {
} // namespace grpc_core
DEFINE_PROTO_FUZZER(const hpack_sync_fuzzer::Msg& msg) {
if (squelch) gpr_set_log_function(dont_log);
if (squelch) {
gpr_disable_all_logs();
}
grpc_core::ApplyFuzzConfigVars(msg.config_vars());
grpc_core::TestOnlyReloadExperimentsFromConfigVariables();
grpc_core::FuzzOneInput(msg);

@ -60,23 +60,6 @@ grpc_cc_test(
],
)
grpc_cc_test(
name = "log_test",
srcs = ["log_test.cc"],
external_deps = [
"absl/log:check",
"absl/log:log",
"gtest",
],
language = "C++",
uses_event_engine = False,
uses_polling = False,
deps = [
"//:gpr",
"//test/core/test_util:grpc_test_util",
],
)
grpc_cc_test(
name = "spinlock_test",
srcs = ["spinlock_test.cc"],

@ -1,99 +0,0 @@
//
//
// Copyright 2015 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 <string.h>
#include <memory>
#include <gtest/gtest.h>
#include "absl/log/check.h"
#include <grpc/support/log.h>
#include "src/core/lib/gprpp/crash.h"
#include "test/core/test_util/test_config.h"
static bool log_func_reached = false;
static void test_callback(gpr_log_func_args* args) {
CHECK_EQ(strcmp(__FILE__, args->file), 0);
CHECK(args->severity == GPR_LOG_SEVERITY_INFO);
CHECK_EQ(strcmp(args->message, "hello 1 2 3"), 0);
}
static void test_should_log(gpr_log_func_args* /*args*/) {
log_func_reached = true;
}
static void test_should_not_log(gpr_log_func_args* /*args*/) {
grpc_core::Crash("unreachable");
}
#define test_log_function_reached(SEVERITY) \
gpr_set_log_function(test_should_log); \
log_func_reached = false; \
gpr_log_message(SEVERITY, "hello 1 2 3"); \
CHECK(log_func_reached); \
log_func_reached = false; \
gpr_log(SEVERITY, "hello %d %d %d", 1, 2, 3); \
CHECK(log_func_reached); \
gpr_set_log_function(nullptr);
#define test_log_function_unreached(SEVERITY) \
gpr_set_log_function(test_should_not_log); \
gpr_log_message(SEVERITY, "hello 1 2 3"); \
gpr_log(SEVERITY, "hello %d %d %d", 1, 2, 3); \
gpr_set_log_function(nullptr);
TEST(LogTest, Basic) {
// test logging at various verbosity levels
gpr_log(GPR_DEBUG, "%s", "hello world");
gpr_log(GPR_INFO, "%s", "hello world");
gpr_log(GPR_ERROR, "%s", "hello world");
// should succeed
CHECK(1);
gpr_set_log_function(test_callback);
gpr_log_message(GPR_INFO, "hello 1 2 3");
gpr_log(GPR_INFO, "hello %d %d %d", 1, 2, 3);
gpr_set_log_function(nullptr);
}
TEST(LogTest, LogVerbosity) {
gpr_set_log_verbosity(GPR_LOG_SEVERITY_DEBUG);
test_log_function_reached(GPR_ERROR);
test_log_function_reached(GPR_INFO);
test_log_function_reached(GPR_DEBUG);
gpr_set_log_verbosity(GPR_LOG_SEVERITY_INFO);
test_log_function_reached(GPR_ERROR);
test_log_function_reached(GPR_INFO);
test_log_function_unreached(GPR_DEBUG);
gpr_set_log_verbosity(GPR_LOG_SEVERITY_ERROR);
test_log_function_reached(GPR_ERROR);
test_log_function_unreached(GPR_INFO);
test_log_function_unreached(GPR_DEBUG);
}
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(&argc, argv);
::testing::InitGoogleTest(&argc, argv);
int ret = RUN_ALL_TESTS();
return ret;
}

@ -206,6 +206,8 @@ grpc_cc_binary(
external_deps = [
"absl/flags:flag",
"absl/log:check",
"absl/log:globals",
"absl/log:log",
],
deps = [
":client_helper_lib",

@ -44,9 +44,6 @@ using grpc::testing::EmptyMessage;
using grpc::testing::GaugeResponse;
using grpc::testing::MetricsService;
// Do not log anything
void BlackholeLogger(gpr_log_func_args* /*args*/) {}
// Prints the values of all Gauges (unless total_only is set to 'true' in which
// case this only prints the sum of all gauge values).
bool PrintMetrics(std::unique_ptr<MetricsService::Stub> stub, bool total_only,
@ -93,7 +90,7 @@ int main(int argc, char** argv) {
// The output of metrics client is in some cases programmatically parsed (for
// example by the stress test framework). So, we do not want any of the log
// from the grpc library appearing on stdout.
gpr_set_log_function(BlackholeLogger);
gpr_disable_all_logs();
std::shared_ptr<grpc::Channel> channel(
grpc::CreateChannel(absl::GetFlag(FLAGS_metrics_server_address),

@ -16,6 +16,8 @@
// is % allowed in string
//
#include <limits.h>
#include <memory>
#include <string>
#include <thread>
@ -24,6 +26,7 @@
#include "absl/flags/flag.h"
#include "absl/log/check.h"
#include "absl/log/globals.h"
#include "absl/log/log.h"
#include <grpc/support/time.h>
@ -93,11 +96,14 @@ ABSL_FLAG(std::string, test_cases, "",
" 'large_unary', 10% of the time and 'empty_stream' the remaining"
" 70% of the time");
ABSL_FLAG(int32_t, log_level, GPR_LOG_SEVERITY_INFO,
"Severity level of messages that should be logged. Any messages "
"greater than or equal to the level set here will be logged. "
"The choices are: 0 (GPR_LOG_SEVERITY_DEBUG), 1 "
"(GPR_LOG_SEVERITY_INFO) and 2 (GPR_LOG_SEVERITY_ERROR)");
ABSL_FLAG(
int32_t, absl_min_log_level,
static_cast<int32_t>(absl::LogSeverityAtLeast::kInfo),
"Severity level of messages that should be logged by absl::SetMinLogLevel");
ABSL_FLAG(int32_t, absl_vlog_level, -1,
"Severity level of messages that should be logged. Set using "
"absl::SetVLogLevel");
ABSL_FLAG(bool, do_not_abort_on_transient_failures, true,
"If set to 'true', abort() is not called in case of transient "
@ -123,15 +129,9 @@ using grpc::testing::transport_security;
using grpc::testing::UNKNOWN_TEST;
using grpc::testing::WeightedRandomTestSelector;
static int log_level = GPR_LOG_SEVERITY_DEBUG;
// A simple wrapper to grp_default_log() function. This only logs messages at or
// above the current log level (set in 'log_level' variable)
void TestLogFunction(gpr_log_func_args* args) {
if (args->severity >= log_level) {
gpr_default_log(args);
}
}
static int absl_vlog_level = -1;
static absl::LogSeverityAtLeast absl_min_log_level =
absl::LogSeverityAtLeast::kInfo;
TestCaseType GetTestTypeFromName(const std::string& test_name) {
TestCaseType test_case = UNKNOWN_TEST;
@ -208,7 +208,9 @@ void LogParameterInfo(const std::vector<std::string>& addresses,
<< absl::GetFlag(FLAGS_num_channels_per_server);
LOG(INFO) << "num_stubs_per_channel: "
<< absl::GetFlag(FLAGS_num_stubs_per_channel);
LOG(INFO) << "log_level: " << absl::GetFlag(FLAGS_log_level);
LOG(INFO) << "absl_vlog_level: " << absl::GetFlag(FLAGS_absl_vlog_level);
LOG(INFO) << "absl_min_log_level: "
<< absl::GetFlag(FLAGS_absl_min_log_level);
LOG(INFO) << "do_not_abort_on_transient_failures: "
<< (absl::GetFlag(FLAGS_do_not_abort_on_transient_failures)
? "true"
@ -228,21 +230,23 @@ void LogParameterInfo(const std::vector<std::string>& addresses,
}
}
void SetLogLevels() {
absl_vlog_level = absl::GetFlag(FLAGS_absl_vlog_level);
CHECK_LE(-1, absl_vlog_level);
CHECK_LE(absl_vlog_level, (INT_MAX - 1));
absl::SetVLogLevel("*grpc*/*", absl_vlog_level);
absl_min_log_level = static_cast<absl::LogSeverityAtLeast>(
absl::GetFlag(FLAGS_absl_min_log_level));
CHECK_LE(absl::LogSeverityAtLeast::kInfo, absl_min_log_level);
CHECK_LE(absl_min_log_level, absl::LogSeverityAtLeast::kInfinity);
absl::SetMinLogLevel(absl_min_log_level);
}
int main(int argc, char** argv) {
grpc::testing::InitTest(&argc, &argv, true);
if (absl::GetFlag(FLAGS_log_level) > GPR_LOG_SEVERITY_ERROR ||
absl::GetFlag(FLAGS_log_level) < GPR_LOG_SEVERITY_DEBUG) {
LOG(ERROR) << "log_level should be an integer between "
<< GPR_LOG_SEVERITY_DEBUG << " and " << GPR_LOG_SEVERITY_ERROR;
return 1;
}
// Change the default log function to TestLogFunction which respects the
// log_level setting.
log_level = absl::GetFlag(FLAGS_log_level);
gpr_set_log_function(TestLogFunction);
SetLogLevels();
srand(time(nullptr));
// Parse the server addresses

@ -5657,30 +5657,6 @@
],
"uses_polling": false
},
{
"args": [],
"benchmark": false,
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [],
"flaky": false,
"gtest": true,
"language": "c++",
"name": "log_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
],
"uses_polling": false
},
{
"args": [],
"benchmark": false,

Loading…
Cancel
Save