aboutsummaryrefslogtreecommitdiff
path: root/tests/performance_tests/performance_tests.h
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-01-04 14:44:38 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-01-04 14:46:51 +0000
commit62c45c0df160361bf3a001cb323f44a985fb69ec (patch)
tree7289891822c51a8fe27dd24e8b1b81810ce95d2d /tests/performance_tests/performance_tests.h
parentMerge pull request #3019 (diff)
downloadmonero-62c45c0df160361bf3a001cb323f44a985fb69ec.tar.xz
performance_tests: add a --filter option to select what to run
Removes a good bit of annoyance running those
Diffstat (limited to 'tests/performance_tests/performance_tests.h')
-rw-r--r--tests/performance_tests/performance_tests.h15
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) ">")