diff options
Diffstat (limited to 'tests/framework/Framework.cpp')
-rw-r--r-- | tests/framework/Framework.cpp | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/tests/framework/Framework.cpp b/tests/framework/Framework.cpp index dff280dc8c..bfb955c525 100644 --- a/tests/framework/Framework.cpp +++ b/tests/framework/Framework.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 ARM Limited. + * Copyright (c) 2017-2021, 2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -24,7 +24,6 @@ #include "Framework.h" #include "arm_compute/runtime/Scheduler.h" -#include "support/MemorySupport.h" #include "tests/framework/ParametersLibrary.h" #include "tests/framework/TestFilter.h" @@ -36,6 +35,7 @@ #include <chrono> #include <iostream> +#include <memory> #include <sstream> #include <type_traits> @@ -94,7 +94,7 @@ Framework::Framework() Instrument::make_instrument<OpenCLMemoryUsage, ScaleFactor::SCALE_1M>); #endif /* ARM_COMPUTE_CL */ - instruments_info = support::cpp14::make_unique<InstrumentsInfo>(); + instruments_info = std::make_unique<InstrumentsInfo>(); } std::set<InstrumentsDescription> Framework::available_instruments() const @@ -130,9 +130,12 @@ Framework &Framework::get() void Framework::init(const FrameworkConfig &config) { _test_filter.reset(new TestFilter(config.mode, config.name_filter, config.id_filter)); - _num_iterations = config.num_iterations; - _log_level = config.log_level; - _cooldown_sec = config.cooldown_sec; + _num_iterations = config.num_iterations; + _log_level = config.log_level; + _cooldown_sec = config.cooldown_sec; + _configure_only = config.configure_only; + _print_rerun_cmd = config.print_rerun_cmd; + _seed = config.seed; _instruments = std::set<framework::InstrumentsDescription>(std::begin(config.instruments), std::end(config.instruments)); } @@ -208,6 +211,7 @@ void Framework::log_test_end(const TestInfo &info) { func_on_all_printers([&](Printer * p) { + p->print_profiler_header(_test_results.at(info).header_data); p->print_measurements(_test_results.at(info).measurements); }); } @@ -290,13 +294,13 @@ bool Framework::error_on_missing_assets() const return _error_on_missing_assets; } -void Framework::run_test(const TestInfo &info, TestCaseFactory &test_factory) +TestResult::Status Framework::run_test(const TestInfo &info, TestCaseFactory &test_factory) { if(test_factory.status() == TestCaseFactory::Status::DISABLED) { log_test_skipped(info); set_test_result(info, TestResult(TestResult::Status::DISABLED)); - return; + return TestResult::Status::DISABLED; } log_test_start(info); @@ -527,14 +531,16 @@ void Framework::run_test(const TestInfo &info, TestCaseFactory &test_factory) { if(_stop_on_error) { - throw std::runtime_error("Abort on first error."); + throw std::runtime_error("Abandon on first error."); } } + result.header_data = profiler.header(); result.measurements = profiler.measurements(); set_test_result(info, result); log_test_end(info); + return result.status; } bool Framework::run() @@ -554,6 +560,7 @@ bool Framework::run() int id = 0; int id_run_test = 0; + ARM_COMPUTE_UNUSED(id_run_test); // Not used if ARM_COMPUTE_CL is not defined for(auto &test_factory : _test_factories) { @@ -577,9 +584,11 @@ bool Framework::run() CLScheduler::get().set_queue(new_queue); } #endif // ARM_COMPUTE_CL - - run_test(test_info, *test_factory); - + TestResult::Status result = run_test(test_info, *test_factory); + if((_print_rerun_cmd) && (result == TestResult::Status::CRASHED || result == TestResult::Status::FAILED)) + { + std::cout << "Rerun command: ./arm_compute_validation --filter='^" << test_info.name << "$' --seed=" << _seed << std::endl; + } ++id_run_test; // Run test delay @@ -629,6 +638,7 @@ void Framework::print_test_results(Printer &printer) const for(const auto &test : _test_results) { printer.print_test_header(test.first); + printer.print_profiler_header(test.second.header_data); printer.print_measurements(test.second.measurements); printer.print_test_footer(); } @@ -678,7 +688,7 @@ std::vector<TestInfo> Framework::test_infos() const for(const auto &factory : _test_factories) { - TestInfo test_info{ id, factory->name(), factory->mode(), factory->status() }; + const TestInfo test_info{ id, factory->name(), factory->mode(), factory->status() }; if(_test_filter->is_selected(test_info)) { @@ -701,6 +711,21 @@ void Framework::set_instruments_info(InstrumentsInfo instr_info) ARM_COMPUTE_ERROR_ON(instruments_info == nullptr); *instruments_info = instr_info; } + +bool Framework::configure_only() const +{ + return _configure_only; +} + +bool Framework::new_fixture_call() const +{ + return _new_fixture_call; +} + +void Framework::set_new_fixture_call(bool val) +{ + _new_fixture_call = val; +} } // namespace framework } // namespace test } // namespace arm_compute |