| 594 | } |
| 595 | |
| 596 | bool Framework::run() |
| 597 | { |
| 598 | // Clear old test results |
| 599 | _test_results.clear(); |
| 600 | |
| 601 | if (_log_level >= LogLevel::TESTS) |
| 602 | { |
| 603 | func_on_all_printers([](Printer *p) { p->print_run_header(); }); |
| 604 | } |
| 605 | |
| 606 | const std::chrono::time_point<std::chrono::high_resolution_clock> start = std::chrono::high_resolution_clock::now(); |
| 607 | |
| 608 | int id = 0; |
| 609 | int id_run_test = 0; |
| 610 | ARM_COMPUTE_UNUSED(id_run_test); // Not used if ARM_COMPUTE_CL is not defined |
| 611 | |
| 612 | for (auto &test_factory : _test_factories) |
| 613 | { |
| 614 | const std::string test_case_name = test_factory->name(); |
| 615 | const TestInfo test_info{id, test_case_name, test_factory->mode(), test_factory->status()}; |
| 616 | |
| 617 | if (_test_filter->is_selected(test_info)) |
| 618 | { |
| 619 | #ifdef ARM_COMPUTE_CL |
| 620 | // Every 100 tests, reset the OpenCL context to release the allocated memory |
| 621 | if (opencl_is_available() && (id_run_test % 100) == 0) |
| 622 | { |
| 623 | auto ctx_properties = CLScheduler::get().context().getInfo<CL_CONTEXT_PROPERTIES>(nullptr); |
| 624 | auto queue_properties = CLScheduler::get().queue().getInfo<CL_QUEUE_PROPERTIES>(nullptr); |
| 625 | |
| 626 | cl::Context new_ctx = cl::Context(CL_DEVICE_TYPE_DEFAULT, ctx_properties.data()); |
| 627 | cl::CommandQueue new_queue = |
| 628 | cl::CommandQueue(new_ctx, CLKernelLibrary::get().get_device(), queue_properties); |
| 629 | |
| 630 | CLKernelLibrary::get().clear_programs_cache(); |
| 631 | CLScheduler::get().set_context(new_ctx); |
| 632 | CLScheduler::get().set_queue(new_queue); |
| 633 | } |
| 634 | #endif // ARM_COMPUTE_CL |
| 635 | TestResult::Status result = run_test(test_info, *test_factory); |
| 636 | if ((_print_rerun_cmd) && (result == TestResult::Status::CRASHED || result == TestResult::Status::FAILED)) |
| 637 | { |
| 638 | std::cout << "Rerun command: ./arm_compute_validation --filter='^" << test_info.name |
| 639 | << "$' --seed=" << _seed << std::endl; |
| 640 | } |
| 641 | ++id_run_test; |
| 642 | |
| 643 | // Run test delay |
| 644 | sleep_in_seconds(_cooldown_sec); |
| 645 | } |
| 646 | |
| 647 | ++id; |
| 648 | } |
| 649 | |
| 650 | const std::chrono::time_point<std::chrono::high_resolution_clock> end = std::chrono::high_resolution_clock::now(); |
| 651 | |
| 652 | if (_log_level >= LogLevel::TESTS) |
| 653 | { |
no test coverage detected