diff options
author | Riccardo Spagni <ric@spagni.net> | 2018-01-25 16:46:40 -0800 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2018-01-25 16:46:41 -0800 |
commit | 395ab6c4308fffa596c53dae2773fc6aaa862a45 (patch) | |
tree | 9460d7d7061525a55f04c0ee9cd8898375054397 /tests/performance_tests/performance_tests.h | |
parent | Merge pull request #3057 (diff) | |
parent | performance_tests: add a --filter option to select what to run (diff) | |
download | monero-395ab6c4308fffa596c53dae2773fc6aaa862a45.tar.xz |
Merge pull request #3064
62c45c0d performance_tests: add a --filter option to select what to run (moneromooo-monero)
Diffstat (limited to 'tests/performance_tests/performance_tests.h')
-rw-r--r-- | tests/performance_tests/performance_tests.h | 15 |
1 files changed, 10 insertions, 5 deletions
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 <stdint.h> #include <boost/chrono.hpp> +#include <boost/regex.hpp> class performance_timer { @@ -122,8 +123,12 @@ private: }; template <typename T> -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<T> 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<a0> >(QUOTEME(test_class<a0>)) -#define TEST_PERFORMANCE2(test_class, a0, a1) run_test< test_class<a0, a1> >(QUOTEME(test_class) "<" QUOTEME(a0) ", " QUOTEME(a1) ">") -#define TEST_PERFORMANCE3(test_class, a0, a1, a2) run_test< test_class<a0, a1, a2> >(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<a0> >(filter, QUOTEME(test_class<a0>)) +#define TEST_PERFORMANCE2(filter, test_class, a0, a1) run_test< test_class<a0, a1> >(filter, QUOTEME(test_class) "<" QUOTEME(a0) ", " QUOTEME(a1) ">") +#define TEST_PERFORMANCE3(filter, test_class, a0, a1, a2) run_test< test_class<a0, a1, a2> >(filter, QUOTEME(test_class) "<" QUOTEME(a0) ", " QUOTEME(a1) ", " QUOTEME(a2) ">") |