aboutsummaryrefslogtreecommitdiff
path: root/framework/Framework.h
diff options
context:
space:
mode:
authorMoritz Pflanzer <moritz.pflanzer@arm.com>2017-07-17 13:50:12 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-09-17 14:16:42 +0100
commitd03b00acd71847fa2db1c5308c87d3b57c781bf9 (patch)
tree7c58283ca1a067428ccafd0f310c8c0e89800306 /framework/Framework.h
parentee493ae23b8cd6de5a6c578cea34bccb478d2f64 (diff)
downloadComputeLibrary-d03b00acd71847fa2db1c5308c87d3b57c781bf9.tar.gz
COMPMID-415: Fix dataset modes
Change-Id: I266e8a22890c914edb3335104f073e79d2bf0ad9 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/80766 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'framework/Framework.h')
-rw-r--r--framework/Framework.h24
1 files changed, 15 insertions, 9 deletions
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<int, std::string>;
+ using TestId = std::tuple<int, std::string, DatasetMode>;
/** 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<InstrumentType> &instruments, int num_iterations, const std::string &name_filter, const std::string &id_filter);
+ void init(const std::vector<InstrumentType> &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 <typename T>
- 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 <typename T, typename D>
- 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 <typename T>
-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<SimpleTestCaseFactory<T>>(current_suite_name(), std::move(test_name)));
+ _test_factories.emplace_back(support::cpp14::make_unique<SimpleTestCaseFactory<T>>(current_suite_name(), std::move(test_name), mode));
}
template <typename T, typename D>
-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<DataTestCaseFactory<T, decltype(*std::declval<D>())>>(new DataTestCaseFactory<T, decltype(*std::declval<D>())>(current_suite_name(), std::move(test_name),
+ auto tmp = std::unique_ptr<DataTestCaseFactory<T, decltype(*std::declval<D>())>>(new DataTestCaseFactory<T, decltype(*std::declval<D>())>(current_suite_name(), std::move(test_name), mode,
std::move(description), *data));
_test_factories.emplace_back(std::move(tmp));
}