142 also_run_disabled_tests_ = GTEST_FLAG_GET(also_run_disabled_tests);
143 break_on_failure_ = GTEST_FLAG_GET(break_on_failure);
144 catch_exceptions_ = GTEST_FLAG_GET(catch_exceptions);
145 color_ = GTEST_FLAG_GET(color);
146 death_test_style_ = GTEST_FLAG_GET(death_test_style);
147 death_test_use_fork_ = GTEST_FLAG_GET(death_test_use_fork);
148 fail_fast_ = GTEST_FLAG_GET(fail_fast);
149 filter_ = GTEST_FLAG_GET(filter);
150 internal_run_death_test_ = GTEST_FLAG_GET(internal_run_death_test);
151 list_tests_ = GTEST_FLAG_GET(list_tests);
152 output_ = GTEST_FLAG_GET(output);
153 brief_ = GTEST_FLAG_GET(brief);
154 print_time_ = GTEST_FLAG_GET(print_time);
155 print_utf8_ = GTEST_FLAG_GET(print_utf8);
156 random_seed_ = GTEST_FLAG_GET(random_seed);
157 repeat_ = GTEST_FLAG_GET(repeat);
158 recreate_environments_when_repeating_ =
159 GTEST_FLAG_GET(recreate_environments_when_repeating);
160 shuffle_ = GTEST_FLAG_GET(shuffle);
161 stack_trace_depth_ = GTEST_FLAG_GET(stack_trace_depth);
162 stream_result_to_ = GTEST_FLAG_GET(stream_result_to);
163 throw_on_failure_ = GTEST_FLAG_GET(throw_on_failure);
168 GTEST_FLAG_SET(also_run_disabled_tests, also_run_disabled_tests_);
169 GTEST_FLAG_SET(break_on_failure, break_on_failure_);
170 GTEST_FLAG_SET(catch_exceptions, catch_exceptions_);
171 GTEST_FLAG_SET(color, color_);
172 GTEST_FLAG_SET(death_test_style, death_test_style_);
173 GTEST_FLAG_SET(death_test_use_fork, death_test_use_fork_);
174 GTEST_FLAG_SET(filter, filter_);
175 GTEST_FLAG_SET(fail_fast, fail_fast_);
176 GTEST_FLAG_SET(internal_run_death_test, internal_run_death_test_);
177 GTEST_FLAG_SET(list_tests, list_tests_);
178 GTEST_FLAG_SET(output, output_);
179 GTEST_FLAG_SET(brief, brief_);
180 GTEST_FLAG_SET(print_time, print_time_);
181 GTEST_FLAG_SET(print_utf8, print_utf8_);
182 GTEST_FLAG_SET(random_seed, random_seed_);
183 GTEST_FLAG_SET(repeat, repeat_);
184 GTEST_FLAG_SET(recreate_environments_when_repeating,
185 recreate_environments_when_repeating_);
186 GTEST_FLAG_SET(shuffle, shuffle_);
187 GTEST_FLAG_SET(stack_trace_depth, stack_trace_depth_);
188 GTEST_FLAG_SET(stream_result_to, stream_result_to_);
189 GTEST_FLAG_SET(throw_on_failure, throw_on_failure_);
194 bool also_run_disabled_tests_;
195 bool break_on_failure_;
196 bool catch_exceptions_;
198 std::string death_test_style_;
199 bool death_test_use_fork_;
202 std::string internal_run_death_test_;
208 int32_t random_seed_;
210 bool recreate_environments_when_repeating_;
212 int32_t stack_trace_depth_;
213 std::string stream_result_to_;
214 bool throw_on_failure_;
215} GTEST_ATTRIBUTE_UNUSED_;
517 TestPartResultReporterInterface* GetGlobalTestPartResultReporter();
520 void SetGlobalTestPartResultReporter(
521 TestPartResultReporterInterface* reporter);
524 TestPartResultReporterInterface* GetTestPartResultReporterForCurrentThread();
527 void SetTestPartResultReporterForCurrentThread(
528 TestPartResultReporterInterface* reporter);
531 int successful_test_suite_count()
const;
534 int failed_test_suite_count()
const;
537 int total_test_suite_count()
const;
541 int test_suite_to_run_count()
const;
544 int successful_test_count()
const;
547 int skipped_test_count()
const;
550 int failed_test_count()
const;
553 int reportable_disabled_test_count()
const;
556 int disabled_test_count()
const;
559 int reportable_test_count()
const;
562 int total_test_count()
const;
565 int test_to_run_count()
const;
569 TimeInMillis start_timestamp()
const {
return start_timestamp_; }
572 TimeInMillis elapsed_time()
const {
return elapsed_time_; }
576 bool Passed()
const {
return !Failed(); }
580 bool Failed()
const {
581 return failed_test_suite_count() > 0 || ad_hoc_test_result()->Failed();
586 const TestSuite* GetTestSuite(
int i)
const {
587 const int index = GetElementOr(test_suite_indices_, i, -1);
588 return index < 0 ? nullptr : test_suites_[static_cast<size_t>(i)];
592#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
593 const TestCase* GetTestCase(
int i)
const {
return GetTestSuite(i); }
599 const int index = GetElementOr(test_suite_indices_, i, -1);
600 return index < 0 ? nullptr : test_suites_[static_cast<size_t>(index)];
611 const TestResult* ad_hoc_test_result()
const {
return &ad_hoc_test_result_; }
635 std::string CurrentOsStackTraceExceptTop(
int skip_count)
636 GTEST_NO_INLINE_ GTEST_NO_TAIL_CALL_;
648 TestSuite* GetTestSuite(
const char* test_suite_name,
const char* type_param,
649 internal::SetUpTestSuiteFunc set_up_tc,
650 internal::TearDownTestSuiteFunc tear_down_tc);
653#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
654 TestCase* GetTestCase(
const char* test_case_name,
const char* type_param,
655 internal::SetUpTestSuiteFunc set_up_tc,
656 internal::TearDownTestSuiteFunc tear_down_tc) {
657 return GetTestSuite(test_case_name, type_param, set_up_tc, tear_down_tc);
668 void AddTestInfo(internal::SetUpTestSuiteFunc set_up_tc,
669 internal::TearDownTestSuiteFunc tear_down_tc,
671#if GTEST_HAS_DEATH_TEST
679 if (original_working_dir_.IsEmpty()) {
680 original_working_dir_.Set(FilePath::GetCurrentDir());
681 GTEST_CHECK_(!original_working_dir_.IsEmpty())
682 <<
"Failed to get the current working directory.";
686 GetTestSuite(test_info->test_suite_name(), test_info->type_param(),
687 set_up_tc, tear_down_tc)
688 ->AddTestInfo(test_info);
694 return parameterized_test_registry_;
697 std::set<std::string>* ignored_parameterized_test_suites() {
698 return &ignored_parameterized_test_suites_;
704 type_parameterized_test_registry() {
705 return type_parameterized_test_registry_;
709 void set_current_test_suite(
TestSuite* a_current_test_suite) {
710 current_test_suite_ = a_current_test_suite;
716 void set_current_test_info(
TestInfo* a_current_test_info) {
717 current_test_info_ = a_current_test_info;
726 void RegisterParameterizedTests();
735 void ClearNonAdHocTestResult() {
736 ForEach(test_suites_, TestSuite::ClearTestSuiteResult);
740 void ClearAdHocTestResult() { ad_hoc_test_result_.Clear(); }
748 enum ReactionToSharding { HONOR_SHARDING_PROTOCOL, IGNORE_SHARDING_PROTOCOL };
756 int FilterTests(ReactionToSharding shard_tests);
759 void ListTestsMatchingFilter();
761 const TestSuite* current_test_suite()
const {
return current_test_suite_; }
762 TestInfo* current_test_info() {
return current_test_info_; }
763 const TestInfo* current_test_info()
const {
return current_test_info_; }
767 std::vector<Environment*>& environments() {
return environments_; }
770 std::vector<TraceInfo>& gtest_trace_stack() {
771 return *(gtest_trace_stack_.pointer());
773 const std::vector<TraceInfo>& gtest_trace_stack()
const {
774 return gtest_trace_stack_.get();
777#if GTEST_HAS_DEATH_TEST
778 void InitDeathTestSubprocessControlInfo() {
779 internal_run_death_test_flag_.reset(ParseInternalRunDeathTestFlag());
785 const InternalRunDeathTestFlag* internal_run_death_test_flag()
const {
786 return internal_run_death_test_flag_.get();
790 internal::DeathTestFactory* death_test_factory() {
791 return death_test_factory_.get();
794 void SuppressTestEventsIfInSubprocess();
796 friend class ReplaceDeathTestFactory;
801 void ConfigureXmlOutput();
803#if GTEST_CAN_STREAM_RESULTS_
806 void ConfigureStreamingOutput();
814 void PostFlagParsingInit();
817 int random_seed()
const {
return random_seed_; }
827 void UnshuffleTests();
831 bool catch_exceptions()
const {
return catch_exceptions_; }
834 friend class ::testing::UnitTest;
838 void set_catch_exceptions(
bool value) { catch_exceptions_ = value; }
845 internal::FilePath original_working_dir_;
850 default_per_thread_test_part_result_reporter_;
853 TestPartResultReporterInterface* global_test_part_result_reporter_;
860 per_thread_test_part_result_reporter_;
864 std::vector<Environment*> environments_;
868 std::vector<TestSuite*> test_suites_;
874 std::vector<int> test_suite_indices_;
880 type_parameterized_test_registry_;
884 std::set<std::string> ignored_parameterized_test_suites_;
887 bool parameterized_tests_registered_;
890 int last_death_test_suite_;
925 bool post_flag_parse_init_performed_;
935 TimeInMillis start_timestamp_;
938 TimeInMillis elapsed_time_;
940#if GTEST_HAS_DEATH_TEST
943 std::unique_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_;
944 std::unique_ptr<internal::DeathTestFactory> death_test_factory_;
952 bool catch_exceptions_;