MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / RunAllTests

Method RunAllTests

rtpose_wrapper/src/gtest/gtest-all.cpp:5448–5578  ·  view source on GitHub ↗

Runs all tests in this UnitTest object, prints the result, and returns true if all tests are successful. If any exception is thrown during a test, the test is considered to be failed, but the rest of the tests will still be run. When parameterized tests are enabled, it expands and registers parameterized tests first in RegisterParameterizedTests(). All other functions called from RunAllTests() m

Source from the content-addressed store, hash-verified

5446// All other functions called from RunAllTests() may safely assume that
5447// parameterized tests are ready to be counted and run.
5448bool UnitTestImpl::RunAllTests() {
5449 // Makes sure InitGoogleTest() was called.
5450 if (!GTestIsInitialized()) {
5451 printf("%s",
5452 "\nThis test program did NOT call ::testing::InitGoogleTest "
5453 "before calling RUN_ALL_TESTS(). Please fix it.\n");
5454 return false;
5455 }
5456
5457 // Do not run any test if the --help flag was specified.
5458 if (g_help_flag)
5459 return true;
5460
5461 // Repeats the call to the post-flag parsing initialization in case the
5462 // user didn't call InitGoogleTest.
5463 PostFlagParsingInit();
5464
5465 // Even if sharding is not on, test runners may want to use the
5466 // GTEST_SHARD_STATUS_FILE to query whether the test supports the sharding
5467 // protocol.
5468 internal::WriteToShardStatusFileIfNeeded();
5469
5470 // True iff we are in a subprocess for running a thread-safe-style
5471 // death test.
5472 bool in_subprocess_for_death_test = false;
5473
5474#if GTEST_HAS_DEATH_TEST
5475 in_subprocess_for_death_test = (internal_run_death_test_flag_.get() != NULL);
5476#endif // GTEST_HAS_DEATH_TEST
5477
5478 const bool should_shard = ShouldShard(kTestTotalShards, kTestShardIndex,
5479 in_subprocess_for_death_test);
5480
5481 // Compares the full test names with the filter to decide which
5482 // tests to run.
5483 const bool has_tests_to_run = FilterTests(should_shard
5484 ? HONOR_SHARDING_PROTOCOL
5485 : IGNORE_SHARDING_PROTOCOL) > 0;
5486
5487 // Lists the tests and exits if the --gtest_list_tests flag was specified.
5488 if (GTEST_FLAG(list_tests)) {
5489 // This must be called *after* FilterTests() has been called.
5490 ListTestsMatchingFilter();
5491 return true;
5492 }
5493
5494 random_seed_ = GTEST_FLAG(shuffle) ?
5495 GetRandomSeedFromFlag(GTEST_FLAG(random_seed)) : 0;
5496
5497 // True iff at least one test has failed.
5498 bool failed = false;
5499
5500 TestEventListener* repeater = listeners()->repeater();
5501
5502 repeater->OnTestProgramStart(*parent_);
5503
5504 // How many times to repeat the tests? We don't want to repeat them
5505 // when we are inside the subprocess of a death test.

Callers

nothing calls this directly

Calls 15

GTestIsInitializedFunction · 0.85
ShouldShardFunction · 0.85
GetRandomSeedFromFlagFunction · 0.85
listenersFunction · 0.85
ClearNonAdHocTestResultFunction · 0.85
GetTimeInMillisFunction · 0.85
randomFunction · 0.85
ForEachFunction · 0.85
GetMutableTestCaseFunction · 0.85
GetNextRandomSeedFunction · 0.85
repeaterMethod · 0.80

Tested by

no test coverage detected