aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Pflanzer <moritz.pflanzer@arm.com>2017-07-20 15:11:33 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-09-17 14:16:42 +0100
commit81527bff7d6fc337fb9edec23c0b63a96b500bd4 (patch)
tree98e5f21555c188e30c1266fa845c84d256cd499c
parentd929b9c49a13eb9c05bb4fab608459669eeeeb9e (diff)
downloadComputeLibrary-81527bff7d6fc337fb9edec23c0b63a96b500bd4.tar.gz
COMPMID-415: Don't use regex for filter by test id
Change-Id: I9c20e0656f5262d22efeace155c49765627df2b4 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/81191 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
-rw-r--r--framework/Framework.cpp6
-rw-r--r--framework/Framework.h6
-rw-r--r--tests/benchmark_new/main.cpp4
3 files changed, 8 insertions, 8 deletions
diff --git a/framework/Framework.cpp b/framework/Framework.cpp
index e3ada039ae..343168426c 100644
--- a/framework/Framework.cpp
+++ b/framework/Framework.cpp
@@ -97,10 +97,10 @@ Framework &Framework::get()
return instance;
}
-void Framework::init(const std::vector<InstrumentType> &instruments, int num_iterations, DatasetMode mode, const std::string &name_filter, const std::string &id_filter)
+void Framework::init(const std::vector<InstrumentType> &instruments, int num_iterations, DatasetMode mode, const std::string &name_filter, int64_t id_filter)
{
_test_name_filter = std::regex{ name_filter };
- _test_id_filter = std::regex{ id_filter };
+ _test_id_filter = id_filter;
_num_iterations = num_iterations;
_dataset_mode = mode;
@@ -191,7 +191,7 @@ bool Framework::is_enabled(const TestId &id) const
return false;
}
- if(!std::regex_search(support::cpp11::to_string(test_id), _test_id_filter))
+ if(_test_id_filter > -1 && _test_id_filter != test_id)
{
return false;
}
diff --git a/framework/Framework.h b/framework/Framework.h
index 2fb81ee40f..bdaf806e21 100644
--- a/framework/Framework.h
+++ b/framework/Framework.h
@@ -87,9 +87,9 @@ public:
* @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.
+ * @param[in] id_filter Test id. Only this test will be executed.
*/
- void init(const std::vector<InstrumentType> &instruments, int num_iterations, DatasetMode mode, 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, int64_t id_filter);
/** Add a new test suite.
*
@@ -259,7 +259,7 @@ private:
InstrumentType _instruments{ InstrumentType::NONE };
std::regex _test_name_filter{ ".*" };
- std::regex _test_id_filter{ ".*" };
+ int64_t _test_id_filter{ -1 };
DatasetMode _dataset_mode{ DatasetMode::ALL };
TestResult *_current_test_result{ nullptr };
};
diff --git a/tests/benchmark_new/main.cpp b/tests/benchmark_new/main.cpp
index 29f5a6e419..95c2d949cf 100644
--- a/tests/benchmark_new/main.cpp
+++ b/tests/benchmark_new/main.cpp
@@ -102,8 +102,8 @@ int main(int argc, char **argv)
log_format->set_help("Output format for measurements and failures");
auto filter = parser.add_option<framework::SimpleOption<std::string>>("filter", ".*");
filter->set_help("Regular expression to select test cases");
- auto filter_id = parser.add_option<framework::SimpleOption<std::string>>("filter-id", ".*");
- filter_id->set_help("Regular expression to select test cases by id");
+ auto filter_id = parser.add_option<framework::SimpleOption<int64_t>>("filter-id", -1);
+ filter_id->set_help("Test id. Only this test will be executed.");
auto log_file = parser.add_option<framework::SimpleOption<std::string>>("log-file");
log_file->set_help("Write output to file instead of to the console");
auto throw_errors = parser.add_option<framework::ToggleOption>("throw-errors");