Created new flag for machine result feature

This commit is contained in:
RedMarcher 2024-11-21 20:37:03 +00:00
parent 35d0c36560
commit f6f673710b
3 changed files with 25 additions and 11 deletions

View File

@ -152,6 +152,10 @@ GTEST_DECLARE_int32_(stack_trace_depth);
// non-zero code otherwise. For use with an external test framework.
GTEST_DECLARE_bool_(throw_on_failure);
// When this flag is set, results are streamed to stdout
// without pretty-print formatting
GTEST_DECLARE_bool_(machine_results);
// When this flag is set with a "host:port" string, on supported
// platforms test results are streamed to the specified port on
// the specified host machine.

View File

@ -162,8 +162,9 @@ class GTestFlagSaver {
GTEST_FLAG_GET(recreate_environments_when_repeating);
shuffle_ = GTEST_FLAG_GET(shuffle);
stack_trace_depth_ = GTEST_FLAG_GET(stack_trace_depth);
stream_result_to_ = GTEST_FLAG_GET(stream_result_to);
throw_on_failure_ = GTEST_FLAG_GET(throw_on_failure);
machine_results_ = GTEST_FLAG_GET(machine_results);
stream_result_to_ = GTEST_FLAG_GET(stream_result_to);
}
// The d'tor is not virtual. DO NOT INHERIT FROM THIS CLASS.
@ -188,8 +189,9 @@ class GTestFlagSaver {
recreate_environments_when_repeating_);
GTEST_FLAG_SET(shuffle, shuffle_);
GTEST_FLAG_SET(stack_trace_depth, stack_trace_depth_);
GTEST_FLAG_SET(stream_result_to, stream_result_to_);
GTEST_FLAG_SET(throw_on_failure, throw_on_failure_);
GTEST_FLAG_SET(machine_results, machine_results_);
GTEST_FLAG_SET(stream_result_to, stream_result_to_);
}
private:
@ -213,8 +215,9 @@ class GTestFlagSaver {
bool recreate_environments_when_repeating_;
bool shuffle_;
int32_t stack_trace_depth_;
std::string stream_result_to_;
bool throw_on_failure_;
bool machine_results_;
std::string stream_result_to_;
};
// Converts a Unicode code point to a narrow string in UTF-8 encoding.

View File

@ -374,13 +374,6 @@ GTEST_DEFINE_int32_(
"The maximum number of stack frames to print when an "
"assertion fails. The valid range is 0 through 100, inclusive.");
GTEST_DEFINE_string_(
stream_result_to,
testing::internal::StringFromGTestEnv("stream_result_to", ""),
"This flag specifies the host name and the port number on which to stream "
"test results. Example: \"localhost:555\". The flag is effective only on "
"Linux and macOS.");
GTEST_DEFINE_bool_(
throw_on_failure,
testing::internal::BoolFromGTestEnv("throw_on_failure", false),
@ -388,6 +381,19 @@ GTEST_DEFINE_bool_(
"if exceptions are enabled or exit the program with a non-zero code "
"otherwise. For use with an external test framework.");
GTEST_DEFINE_bool_(
machine_results,
testing::internal::BoolFromGTestEnv("machine_results", false),
"When this flag is specified, results are streamed to stdout "
"without pretty-printing. Uses the same format as stream_result_to");
GTEST_DEFINE_string_(
stream_result_to,
testing::internal::StringFromGTestEnv("stream_result_to", ""),
"This flag specifies the host name and the port number on which to stream "
"test results. Example: \"localhost:555\". The flag is effective only on "
"Linux and macOS.");
#if GTEST_USE_OWN_FLAGFILE_FLAG_
GTEST_DEFINE_string_(
flagfile, testing::internal::StringFromGTestEnv("flagfile", ""),
@ -6667,8 +6673,9 @@ static bool ParseGoogleTestFlag(const char* const arg) {
GTEST_INTERNAL_PARSE_FLAG(recreate_environments_when_repeating);
GTEST_INTERNAL_PARSE_FLAG(shuffle);
GTEST_INTERNAL_PARSE_FLAG(stack_trace_depth);
GTEST_INTERNAL_PARSE_FLAG(stream_result_to);
GTEST_INTERNAL_PARSE_FLAG(throw_on_failure);
GTEST_INTERNAL_PARSE_FLAG(machine_results);
GTEST_INTERNAL_PARSE_FLAG(stream_result_to);
return false;
}