MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / OnTestIterationStart

Method OnTestIterationStart

3rd/googletest-1.13.0/googletest/src/gtest.cc:3380–3413  ·  view source on GitHub ↗

Fired before each iteration of tests starts.

Source from the content-addressed store, hash-verified

3378
3379// Fired before each iteration of tests starts.
3380void PrettyUnitTestResultPrinter::OnTestIterationStart(
3381 const UnitTest& unit_test, int iteration) {
3382 if (GTEST_FLAG_GET(repeat) != 1)
3383 printf("\nRepeating all tests (iteration %d) . . .\n\n", iteration + 1);
3384
3385 std::string f = GTEST_FLAG_GET(filter);
3386 const char* const filter = f.c_str();
3387
3388 // Prints the filter if it's not *. This reminds the user that some
3389 // tests may be skipped.
3390 if (!String::CStringEquals(filter, kUniversalFilter)) {
3391 ColoredPrintf(GTestColor::kYellow, "Note: %s filter = %s\n", GTEST_NAME_,
3392 filter);
3393 }
3394
3395 if (internal::ShouldShard(kTestTotalShards, kTestShardIndex, false)) {
3396 const int32_t shard_index = Int32FromEnvOrDie(kTestShardIndex, -1);
3397 ColoredPrintf(GTestColor::kYellow, "Note: This is test shard %d of %s.\n",
3398 static_cast<int>(shard_index) + 1,
3399 internal::posix::GetEnv(kTestTotalShards));
3400 }
3401
3402 if (GTEST_FLAG_GET(shuffle)) {
3403 ColoredPrintf(GTestColor::kYellow,
3404 "Note: Randomizing tests' orders with a seed of %d .\n",
3405 unit_test.random_seed());
3406 }
3407
3408 ColoredPrintf(GTestColor::kGreen, "[==========] ");
3409 printf("Running %s from %s.\n",
3410 FormatTestCount(unit_test.test_to_run_count()).c_str(),
3411 FormatTestSuiteCount(unit_test.test_suite_to_run_count()).c_str());
3412 fflush(stdout);
3413}
3414
3415void PrettyUnitTestResultPrinter::OnEnvironmentsSetUpStart(
3416 const UnitTest& /*unit_test*/) {

Callers 1

RunAllTestsMethod · 0.45

Calls 10

ColoredPrintfFunction · 0.85
ShouldShardFunction · 0.85
Int32FromEnvOrDieFunction · 0.85
GetEnvFunction · 0.85
FormatTestCountFunction · 0.85
FormatTestSuiteCountFunction · 0.85
random_seedMethod · 0.80
test_to_run_countMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected