23.11
|
Main framework class. More...
#include <Framework.h>
Public Member Functions | |
std::set< InstrumentsDescription > | available_instruments () const |
Supported instrument types for benchmarking. More... | |
void | init (const FrameworkConfig &config) |
Init the framework. More... | |
void | push_suite (std::string name) |
Add a new test suite. More... | |
void | pop_suite () |
Remove innermost test suite. More... | |
template<typename T > | |
void | add_test_case (std::string test_name, DatasetMode mode, TestCaseFactory::Status status) |
Add a test case to the framework. More... | |
template<typename T , typename D > | |
void | add_data_test_case (std::string test_name, DatasetMode mode, TestCaseFactory::Status status, std::string description, D &&data) |
Add a data test case to the framework. More... | |
void | add_test_info (std::string info) |
Add info string for the next expectation/assertion. More... | |
void | clear_test_info () |
Clear the collected test info. More... | |
bool | has_test_info () const |
Check if any info has been registered. More... | |
void | print_test_info (std::ostream &os) const |
Print test info. More... | |
void | log_test_start (const TestInfo &info) |
Tell the framework that execution of a test starts. More... | |
void | log_test_skipped (const TestInfo &info) |
Tell the framework that a test case is skipped. More... | |
void | log_test_end (const TestInfo &info) |
Tell the framework that a test case finished. More... | |
void | log_failed_expectation (const TestError &error) |
Tell the framework that the currently running test case failed a non-fatal expectation. More... | |
void | log_info (const std::string &info) |
Print the debug information that has already been logged. More... | |
int | num_iterations () const |
Number of iterations per test case. More... | |
void | set_num_iterations (int num_iterations) |
Set number of iterations per test case. More... | |
bool | throw_errors () const |
Should errors be caught or thrown by the framework. More... | |
void | set_throw_errors (bool throw_errors) |
Set whether errors are caught or thrown by the framework. More... | |
bool | stop_on_error () const |
Indicates if test execution is stopped after the first failed test. More... | |
void | set_stop_on_error (bool stop_on_error) |
Set whether to stop execution after the first failed test. More... | |
bool | error_on_missing_assets () const |
Indicates if a test should be marked as failed when its assets are missing. More... | |
void | set_error_on_missing_assets (bool error_on_missing_assets) |
Set whether a test should be considered as failed if its assets cannot be found. More... | |
bool | run () |
Run all enabled test cases. More... | |
void | set_test_result (TestInfo info, TestResult result) |
Set the result for an executed test case. More... | |
void | print_test_results (Printer &printer) const |
Use the specified printer to output test results from the last run. More... | |
Profiler | get_profiler () const |
Factory method to obtain a configured profiler. More... | |
void | add_printer (Printer *printer) |
Set the printer used for the output of test results. More... | |
std::vector< TestInfo > | test_infos () const |
List of TestInfo's. More... | |
LogLevel | log_level () const |
Get the current logging level. More... | |
void | set_instruments_info (InstrumentsInfo instr_info) |
Sets instruments info. More... | |
bool | configure_only () const |
Get the configure only flag. More... | |
bool | new_fixture_call () const |
Return whether the new fixture has been called. More... | |
void | set_new_fixture_call (bool val) |
Set the new fixture call flag. More... | |
Static Public Member Functions | |
static Framework & | get () |
Access to the singleton. More... | |
Main framework class.
Keeps track of the global state, owns all test cases and collects results.
Definition at line 97 of file Framework.h.
|
inline |
Add a data test case to the framework.
[in] | test_name | Name of the new test case. |
[in] | mode | Mode in which to include the test. |
[in] | status | Status of the test case. |
[in] | description | Description of data . |
[in] | data | Data that will be used as input to the test. |
Definition at line 382 of file Framework.h.
References clang_tidy_rules::mode.
Referenced by TestCaseRegistrar< T >::TestCaseRegistrar().
void add_printer | ( | Printer * | printer | ) |
Set the printer used for the output of test results.
[in] | printer | Pointer to a printer. |
Definition at line 678 of file Framework.cpp.
Referenced by main().
|
inline |
Add a test case to the framework.
[in] | test_name | Name of the new test case. |
[in] | mode | Mode in which to include the test. |
[in] | status | Status of the test case. |
Definition at line 376 of file Framework.h.
References clang_tidy_rules::mode.
Referenced by TestCaseRegistrar< T >::TestCaseRegistrar().
void add_test_info | ( | std::string | info | ) |
Add info string for the next expectation/assertion.
[in] | info | Info string. |
Definition at line 158 of file Framework.cpp.
References arm_compute::test::validation::info.
std::set< InstrumentsDescription > available_instruments | ( | ) | const |
Supported instrument types for benchmarking.
Definition at line 100 of file Framework.cpp.
Referenced by CommonOptions::CommonOptions().
void clear_test_info | ( | ) |
Clear the collected test info.
Definition at line 163 of file Framework.cpp.
Referenced by arm_compute::test::framework::ARM_COMPUTE_PRINT_INFO().
bool configure_only | ( | ) | const |
Get the configure only flag.
Definition at line 715 of file Framework.cpp.
bool error_on_missing_assets | ( | ) | const |
Indicates if a test should be marked as failed when its assets are missing.
Definition at line 292 of file Framework.cpp.
|
static |
Access to the singleton.
Definition at line 124 of file Framework.cpp.
Referenced by arm_compute::test::framework::ARM_COMPUTE_PRINT_INFO(), CommonOptions::CommonOptions(), main(), arm_compute::utils::run_example(), TestCaseRegistrar< T >::TestCaseRegistrar(), TestSuiteRegistrar::TestSuiteRegistrar(), arm_compute::test::validation::validate(), arm_compute::test::validation::validate_min_max_loc(), arm_compute::test::validation::validate_wrap(), and CLAccessor::~CLAccessor().
Profiler get_profiler | ( | ) | const |
Factory method to obtain a configured profiler.
The profiler enables all instruments that have been passed to the init method.
Definition at line 649 of file Framework.cpp.
References Profiler::add(), is_selected, and type.
Referenced by main().
bool has_test_info | ( | ) | const |
Check if any info has been registered.
Definition at line 168 of file Framework.cpp.
void init | ( | const FrameworkConfig & | config | ) |
Init the framework.
[in] | config | Framework configuration meta-data. |
Definition at line 130 of file Framework.cpp.
References FrameworkConfig::configure_only, FrameworkConfig::cooldown_sec, arm_compute::mlgo::parser::end(), FrameworkConfig::id_filter, FrameworkConfig::instruments, FrameworkConfig::log_level, FrameworkConfig::mode, FrameworkConfig::name_filter, FrameworkConfig::num_iterations, FrameworkConfig::print_rerun_cmd, and FrameworkConfig::seed.
Referenced by main().
void log_failed_expectation | ( | const TestError & | error | ) |
Tell the framework that the currently running test case failed a non-fatal expectation.
[in] | error | Description of the error. |
Definition at line 228 of file Framework.cpp.
References ARM_COMPUTE_ERROR_ON, TestError::level(), and Printer::print_error().
void log_info | ( | const std::string & | info | ) |
Print the debug information that has already been logged.
[in] | info | Description of the log info. |
Definition at line 246 of file Framework.cpp.
References arm_compute::test::validation::info, and Printer::print_info().
Referenced by arm_compute::test::framework::ARM_COMPUTE_PRINT_INFO().
LogLevel log_level | ( | ) | const |
Get the current logging level.
Definition at line 704 of file Framework.cpp.
void log_test_end | ( | const TestInfo & | info | ) |
Tell the framework that a test case finished.
[in] | info | Test info. |
Definition at line 208 of file Framework.cpp.
References arm_compute::test::validation::info, Printer::print_measurements(), Printer::print_profiler_header(), and Printer::print_test_footer().
void log_test_skipped | ( | const TestInfo & | info | ) |
Tell the framework that a test case is skipped.
[in] | info | Test info. |
Definition at line 203 of file Framework.cpp.
References arm_compute::test::validation::info.
void log_test_start | ( | const TestInfo & | info | ) |
Tell the framework that execution of a test starts.
[in] | info | Test info. |
Definition at line 192 of file Framework.cpp.
References arm_compute::test::validation::info, and Printer::print_test_header().
bool new_fixture_call | ( | ) | const |
Return whether the new fixture has been called.
Definition at line 720 of file Framework.cpp.
int num_iterations | ( | ) | const |
Number of iterations per test case.
Definition at line 257 of file Framework.cpp.
void pop_suite | ( | ) |
Remove innermost test suite.
Definition at line 153 of file Framework.cpp.
Referenced by TestSuiteRegistrar::TestSuiteRegistrar().
void print_test_info | ( | std::ostream & | os | ) | const |
Print test info.
[out] | os | Output stream. |
Definition at line 173 of file Framework.cpp.
References caffe_mnist_image_extractor::str.
Referenced by arm_compute::test::framework::ARM_COMPUTE_PRINT_INFO().
void print_test_results | ( | Printer & | printer | ) | const |
Use the specified printer to output test results from the last run.
This method can be used if the test results need to be obtained using a different printer than the one managed by the framework.
[in] | printer | Printer used to output results. |
Definition at line 634 of file Framework.cpp.
References Printer::print_measurements(), Printer::print_profiler_header(), Printer::print_run_footer(), Printer::print_run_header(), Printer::print_test_footer(), and Printer::print_test_header().
void push_suite | ( | std::string | name | ) |
Add a new test suite.
[in] | name | Name of the added test suite. |
Definition at line 148 of file Framework.cpp.
References name.
Referenced by TestSuiteRegistrar::TestSuiteRegistrar().
bool run | ( | ) |
Run all enabled test cases.
Definition at line 546 of file Framework.cpp.
References ARM_COMPUTE_UNUSED, CLKernelLibrary::clear_programs_cache(), CLScheduler::context(), arm_compute::mlgo::parser::end(), CLKernelLibrary::get(), CLScheduler::get(), TestCaseFactory::mode(), TestCaseFactory::name(), arm_compute::opencl_is_available(), Printer::print_run_footer(), Printer::print_run_header(), CLScheduler::queue(), CLScheduler::set_context(), CLScheduler::set_queue(), arm_compute::test::sleep_in_seconds(), and TestCaseFactory::status().
Referenced by main().
void set_error_on_missing_assets | ( | bool | error_on_missing_assets | ) |
Set whether a test should be considered as failed if its assets cannot be found.
[in] | error_on_missing_assets | True if a test should be marked as failed when its assets are missing. |
Definition at line 287 of file Framework.cpp.
Referenced by main().
void set_instruments_info | ( | InstrumentsInfo | instr_info | ) |
Sets instruments info.
[in] | instr_info | Instruments info to set |
Definition at line 709 of file Framework.cpp.
References ARM_COMPUTE_ERROR_ON, and arm_compute::test::framework::instruments_info.
Referenced by main().
void set_new_fixture_call | ( | bool | val | ) |
Set the new fixture call flag.
[in] | val | Value to set for the flag |
Definition at line 725 of file Framework.cpp.
void set_num_iterations | ( | int | num_iterations | ) |
Set number of iterations per test case.
[in] | num_iterations | Number of iterations per test case. |
Definition at line 262 of file Framework.cpp.
void set_stop_on_error | ( | bool | stop_on_error | ) |
Set whether to stop execution after the first failed test.
[in] | stop_on_error | True if execution is going to be stopped after first failed test. |
Definition at line 277 of file Framework.cpp.
Referenced by main().
void set_test_result | ( | TestInfo | info, |
TestResult | result | ||
) |
Set the result for an executed test case.
[in] | info | Test info. |
[in] | result | Execution result. |
Definition at line 629 of file Framework.cpp.
References arm_compute::test::validation::info.
void set_throw_errors | ( | bool | throw_errors | ) |
Set whether errors are caught or thrown by the framework.
[in] | throw_errors | True if errors should be thrown. |
Definition at line 267 of file Framework.cpp.
Referenced by main().
bool stop_on_error | ( | ) | const |
Indicates if test execution is stopped after the first failed test.
Definition at line 282 of file Framework.cpp.
std::vector< TestInfo > test_infos | ( | ) | const |
List of TestInfo's.
Definition at line 683 of file Framework.cpp.
References TestInfo::name.
Referenced by main().
bool throw_errors | ( | ) | const |
Should errors be caught or thrown by the framework.
Definition at line 272 of file Framework.cpp.