MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / runTestsSerial

Function runTestsSerial

Source/Falcor/Testing/UnitTest.cpp:377–497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

375}
376
377inline int32_t runTestsSerial(const RunOptions& options)
378{
379 // Abort on Ctrl-C.
380 std::atomic<bool> abort{false};
381 setKeyboardInterruptHandler(
382 [&abort]()
383 {
384 reportLine("\nDetected Ctrl-C, aborting ...\n");
385 abort = true;
386 }
387 );
388
389 auto startTime = std::chrono::steady_clock::now();
390
391 DevicePool devicePool(options.deviceDesc);
392
393 // Gather tests.
394 std::vector<Test> tests = enumerateTests();
395 tests = filterTests(tests, options.testSuiteFilter, options.testCaseFilter, options.tagFilter, options.deviceDesc.type);
396
397 // Split tests into suites.
398 std::map<std::string, std::vector<Test>> suites;
399 for (const auto& test : tests)
400 suites[test.suiteName].push_back(test);
401
402 std::map<std::string, std::vector<Test>> failedTests;
403 std::vector<std::pair<Test, TestResult>> report;
404
405 size_t suiteCount = suites.size();
406 size_t testCount = tests.size();
407 int32_t failureCount = 0;
408 reportLine(
409 "[==========] Running {} test{} from {} test suite{}.", testCount, plural(testCount, "s"), suiteCount, plural(suiteCount, "s")
410 );
411 for (const auto& [suiteName, suiteTests] : suites)
412 {
413 if (abort)
414 break;
415
416 reportLine("[----------] {} test{} from {}", suiteTests.size(), plural(suiteTests.size(), "s"), suiteName);
417 uint64_t suiteMS = 0;
418 for (const auto& test : suiteTests)
419 {
420 if (abort)
421 break;
422
423 bool success = true;
424 for (uint32_t repeatIndex = 0; repeatIndex < options.repeat; ++repeatIndex)
425 {
426 if (abort)
427 break;
428
429 std::string repeats;
430 if (options.repeat > 1)
431 repeats = fmt::format("[{}/{}]", repeatIndex + 1, options.repeat);
432 reportLine("[ RUN ] {}:{}{}", suiteName, test.name, repeats);
433 TestResult result = runTest(test, devicePool);
434 report.emplace_back(test, result);

Callers 1

runTestsFunction · 0.85

Calls 11

reportLineFunction · 0.85
enumerateTestsFunction · 0.85
filterTestsFunction · 0.85
pluralFunction · 0.85
writeXmlReportFunction · 0.85
countMethod · 0.80
runTestFunction · 0.70
push_backMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected