From dde46c1a3c30bde75333aab7369082bec16b8892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cezary=20Skrzy=C5=84ski?= Date: Mon, 21 Dec 2020 12:11:27 +0100 Subject: [PATCH] #1111: backport: test: implement addAdditionalArgs --- tests/unit/test_parallel_harness.h | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/unit/test_parallel_harness.h b/tests/unit/test_parallel_harness.h index 6d98f10df0..d6897903c0 100644 --- a/tests/unit/test_parallel_harness.h +++ b/tests/unit/test_parallel_harness.h @@ -119,6 +119,41 @@ struct TestParallelHarnessAny : TestHarnessAny { TestHarnessAny::TearDown(); } + +protected: + template + void addArgs(Arg& arg) { + this->additional_args_.emplace_back(&arg[0]); + } + + template + void addArgs(Arg& arg, Args&... args) { + this->additional_args_.emplace_back(&arg[0]); + addArgs(args...); + } + +private: + /** + * \internal \brief Add additional arguments used during initialization of vt + * components + * + * To add additional arguments override this function in your class and add + * needed arguments to `additional_args_` vector. + * + * Example: + * struct TestParallelHarnessWithStatsDumping : TestParallelHarnessParam { + * virtual void addAdditionalArgs() override { + * static char vt_lb_stats[]{"--vt_lb_stats"}; + * static char vt_lb_stats_dir[]{"--vt_lb_stats_dir=test_stats_dir"}; + * static char vt_lb_stats_file[]{"--vt_lb_stats_file=test_stats_outfile"}; + * + * addArgs(vt_lb_stats, vt_lb_stats_dir, vt_lb_stats_file); + * } + * }; + */ + virtual void addAdditionalArgs() {} + + std::vector additional_args_; }; using TestParallelHarness = TestParallelHarnessAny;