From 62c45c0df160361bf3a001cb323f44a985fb69ec Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Thu, 4 Jan 2018 14:44:38 +0000 Subject: performance_tests: add a --filter option to select what to run Removes a good bit of annoyance running those --- tests/performance_tests/performance_tests.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'tests/performance_tests/performance_tests.h') diff --git a/tests/performance_tests/performance_tests.h b/tests/performance_tests/performance_tests.h index a4d49fd82..589c34caf 100644 --- a/tests/performance_tests/performance_tests.h +++ b/tests/performance_tests/performance_tests.h @@ -34,6 +34,7 @@ #include #include +#include class performance_timer { @@ -122,8 +123,12 @@ private: }; template -void run_test(const char* test_name) +void run_test(const std::string &filter, const char* test_name) { + boost::smatch match; + if (!filter.empty() && !boost::regex_match(std::string(test_name), match, boost::regex(filter))) + return; + test_runner runner; if (runner.run()) { @@ -149,7 +154,7 @@ void run_test(const char* test_name) } #define QUOTEME(x) #x -#define TEST_PERFORMANCE0(test_class) run_test< test_class >(QUOTEME(test_class)) -#define TEST_PERFORMANCE1(test_class, a0) run_test< test_class >(QUOTEME(test_class)) -#define TEST_PERFORMANCE2(test_class, a0, a1) run_test< test_class >(QUOTEME(test_class) "<" QUOTEME(a0) ", " QUOTEME(a1) ">") -#define TEST_PERFORMANCE3(test_class, a0, a1, a2) run_test< test_class >(QUOTEME(test_class) "<" QUOTEME(a0) ", " QUOTEME(a1) ", " QUOTEME(a2) ">") +#define TEST_PERFORMANCE0(filter, test_class) run_test< test_class >(filter, QUOTEME(test_class)) +#define TEST_PERFORMANCE1(filter, test_class, a0) run_test< test_class >(filter, QUOTEME(test_class)) +#define TEST_PERFORMANCE2(filter, test_class, a0, a1) run_test< test_class >(filter, QUOTEME(test_class) "<" QUOTEME(a0) ", " QUOTEME(a1) ">") +#define TEST_PERFORMANCE3(filter, test_class, a0, a1, a2) run_test< test_class >(filter, QUOTEME(test_class) "<" QUOTEME(a0) ", " QUOTEME(a1) ", " QUOTEME(a2) ">") -- cgit v1.2.3