From d03b00acd71847fa2db1c5308c87d3b57c781bf9 Mon Sep 17 00:00:00 2001 From: Moritz Pflanzer Date: Mon, 17 Jul 2017 13:50:12 +0100 Subject: COMPMID-415: Fix dataset modes Change-Id: I266e8a22890c914edb3335104f073e79d2bf0ad9 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/80766 Tested-by: Kaizen Reviewed-by: Anthony Barbier --- framework/Framework.h | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'framework/Framework.h') diff --git a/framework/Framework.h b/framework/Framework.h index fbb6b9c04c..a7d8a15541 100644 --- a/framework/Framework.h +++ b/framework/Framework.h @@ -24,6 +24,7 @@ #ifndef ARM_COMPUTE_TEST_FRAMEWORK #define ARM_COMPUTE_TEST_FRAMEWORK +#include "DatasetModes.h" #include "Profiler.h" #include "TestCase.h" #include "TestCaseFactory.h" @@ -60,12 +61,13 @@ class Framework final public: /** Type of a test identifier. * - * A test can be identified either via its id or via its name. + * A test can be identified either via its id or via its name. Additionally + * each test is tagged with the data set mode in which it will be used. * * @note The mapping between test id and test name is not guaranteed to be * stable. It is subject to change as new test are added. */ - using TestId = std::pair; + using TestId = std::tuple; /** Access to the singleton. * @@ -83,10 +85,11 @@ public: * * @param[in] instruments Instrument types that will be used for benchmarking. * @param[in] num_iterations Number of iterations per test. + * @param[in] mode Dataset mode. * @param[in] name_filter Regular expression to filter tests by name. Only matching tests will be executed. * @param[in] id_filter Regular expression to filter tests by id. Only matching tests will be executed. */ - void init(const std::vector &instruments, int num_iterations, const std::string &name_filter, const std::string &id_filter); + void init(const std::vector &instruments, int num_iterations, DatasetMode mode, const std::string &name_filter, const std::string &id_filter); /** Add a new test suite. * @@ -109,18 +112,20 @@ public: /** Add a test case to the framework. * * @param[in] test_name Name of the new test case. + * @param[in] mode Mode in which to include the test. */ template - void add_test_case(std::string test_name); + void add_test_case(std::string test_name, DatasetMode mode); /** Add a data test case to the framework. * * @param[in] test_name Name of the new test case. + * @param[in] mode Mode in which to include the test. * @param[in] description Description of @p data. * @param[in] data Data that will be used as input to the test. */ template - void add_data_test_case(std::string test_name, std::string description, D &&data); + void add_data_test_case(std::string test_name, DatasetMode mode, std::string description, D &&data); /** Tell the framework that execution of a test starts. * @@ -255,21 +260,22 @@ private: InstrumentType _instruments{ InstrumentType::NONE }; std::regex _test_name_filter{ ".*" }; std::regex _test_id_filter{ ".*" }; + DatasetMode _dataset_mode{ DatasetMode::ALL }; }; template -inline void Framework::add_test_case(std::string test_name) +inline void Framework::add_test_case(std::string test_name, DatasetMode mode) { - _test_factories.emplace_back(support::cpp14::make_unique>(current_suite_name(), std::move(test_name))); + _test_factories.emplace_back(support::cpp14::make_unique>(current_suite_name(), std::move(test_name), mode)); } template -inline void Framework::add_data_test_case(std::string test_name, std::string description, D &&data) +inline void Framework::add_data_test_case(std::string test_name, DatasetMode mode, std::string description, D &&data) { // WORKAROUND for GCC 4.9 // The function should get *it which is tuple but that seems to trigger a // bug in the compiler. - auto tmp = std::unique_ptr())>>(new DataTestCaseFactory())>(current_suite_name(), std::move(test_name), + auto tmp = std::unique_ptr())>>(new DataTestCaseFactory())>(current_suite_name(), std::move(test_name), mode, std::move(description), *data)); _test_factories.emplace_back(std::move(tmp)); } -- cgit v1.2.1