MCPcopy Create free account
hub / github.com/apache/singa / RunAllTests

Method RunAllTests

test/gtest/gtest-all.cc:5706–5837  ·  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

5704// All other functions called from RunAllTests() may safely assume that
5705// parameterized tests are ready to be counted and run.
5706bool UnitTestImpl::RunAllTests() {
5707 // Makes sure InitGoogleTest() was called.
5708 if (!GTestIsInitialized()) {
5709 printf("%s",
5710 "\nThis test program did NOT call ::testing::InitGoogleTest "
5711 "before calling RUN_ALL_TESTS(). Please fix it.\n");
5712 return false;
5713 }
5714
5715 // Do not run any test if the --help flag was specified.
5716 if (g_help_flag)
5717 return true;
5718
5719 // Repeats the call to the post-flag parsing initialization in case the
5720 // user didn't call InitGoogleTest.
5721 PostFlagParsingInit();
5722
5723 // Even if sharding is not on, test runners may want to use the
5724 // GTEST_SHARD_STATUS_FILE to query whether the test supports the sharding
5725 // protocol.
5726 internal::WriteToShardStatusFileIfNeeded();
5727
5728 // True iff we are in a subprocess for running a thread-safe-style
5729 // death test.
5730 bool in_subprocess_for_death_test = false;
5731
5732#if GTEST_HAS_DEATH_TEST
5733 in_subprocess_for_death_test = (internal_run_death_test_flag_.get() != NULL);
5734#endif // GTEST_HAS_DEATH_TEST
5735
5736 const bool should_shard = ShouldShard(kTestTotalShards, kTestShardIndex,
5737 in_subprocess_for_death_test);
5738
5739 // Compares the full test names with the filter to decide which
5740 // tests to run.
5741 const bool has_tests_to_run = FilterTests(should_shard
5742 ? HONOR_SHARDING_PROTOCOL
5743 : IGNORE_SHARDING_PROTOCOL) > 0;
5744
5745 // Lists the tests and exits if the --gtest_list_tests flag was specified.
5746 if (GTEST_FLAG(list_tests)) {
5747 // This must be called *after* FilterTests() has been called.
5748 ListTestsMatchingFilter();
5749 return true;
5750 }
5751
5752 random_seed_ = GTEST_FLAG(shuffle) ?
5753 GetRandomSeedFromFlag(GTEST_FLAG(random_seed)) : 0;
5754
5755 // True iff at least one test has failed.
5756 bool failed = false;
5757
5758 TestEventListener* repeater = listeners()->repeater();
5759
5760 start_timestamp_ = GetTimeInMillis();
5761 repeater->OnTestProgramStart(*parent_);
5762
5763 // How many times to repeat the tests? We don't want to repeat them

Callers

nothing calls this directly

Calls 15

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

Tested by

no test coverage detected