| 369 | } |
| 370 | |
| 371 | TestResult::Status Framework::run_test(const TestInfo &info, TestCaseFactory &test_factory) |
| 372 | { |
| 373 | if (test_factory.status() == TestCaseFactory::Status::DISABLED) |
| 374 | { |
| 375 | log_test_skipped(info); |
| 376 | set_test_result(info, TestResult(TestResult::Status::DISABLED)); |
| 377 | return TestResult::Status::DISABLED; |
| 378 | } |
| 379 | |
| 380 | log_test_start(info); |
| 381 | |
| 382 | Profiler profiler = get_profiler(); |
| 383 | TestResult result(TestResult::Status::NOT_RUN); |
| 384 | |
| 385 | _current_test_info = &info; |
| 386 | _current_test_result = &result; |
| 387 | |
| 388 | if (_log_level >= LogLevel::ERRORS) |
| 389 | { |
| 390 | func_on_all_printers([](Printer *p) { p->print_errors_header(); }); |
| 391 | } |
| 392 | |
| 393 | const bool is_expected_failure = info.status == TestCaseFactory::Status::EXPECTED_FAILURE; |
| 394 | |
| 395 | try |
| 396 | { |
| 397 | std::unique_ptr<TestCase> test_case = test_factory.make(); |
| 398 | |
| 399 | try |
| 400 | { |
| 401 | profiler.test_start(); |
| 402 | |
| 403 | test_case->do_setup(); |
| 404 | |
| 405 | for (int i = 0; i < _num_iterations; ++i) |
| 406 | { |
| 407 | //Start the profiler if: |
| 408 | //- there is only one iteration |
| 409 | //- it's not the first iteration of a multi-iterations run. |
| 410 | // |
| 411 | //Reason: if the CLTuner is enabled then the first run will be really messy |
| 412 | //as each kernel will be executed several times, messing up the instruments like OpenCL timers. |
| 413 | if (_num_iterations == 1 || i != 0) |
| 414 | { |
| 415 | profiler.start(); |
| 416 | } |
| 417 | if (_prepare_function != nullptr) |
| 418 | { |
| 419 | _prepare_function(); |
| 420 | } |
| 421 | test_case->do_run(); |
| 422 | test_case->do_sync(); |
| 423 | if (_num_iterations == 1 || i != 0) |
| 424 | { |
| 425 | profiler.stop(_print_iterations ? i : -1); |
| 426 | } |
| 427 | } |
| 428 |
nothing calls this directly
no test coverage detected