#define _TESTS_COMMON_H_
#include <sys/smack.h>
+#include <dpl/test/test_case_extended.h>
#include <dpl/test/test_runner.h>
#include <dpl/test/test_runner_child.h>
#include <dpl/test/test_runner_multiprocess.h>
#include <privilege-control.h>
#include <sys/smack.h>
#include <string>
+#include <tuple>
#include <errno.h>
#include <string.h>
void symlinkSafe(const std::string &targetPath, const std::string &linkPath);
void removeDir(const std::string &path);
-#define RUNNER_TEST_SMACK(Proc) \
- void Proc(); \
- static int Static##Proc##Init() \
- { \
- if(smack_check()) \
- DPL::Test::TestRunnerSingleton::Instance().RegisterTest(#Proc, &Proc); \
- \
- return 0; \
- } \
- const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init(); \
- void Proc()
-
-#define RUNNER_TEST_NOSMACK(Proc) \
- void Proc(); \
- static int Static##Proc##Init() \
- { \
- if(!(smack_check())) \
- DPL::Test::TestRunnerSingleton::Instance().RegisterTest(#Proc, &Proc); \
- \
- return 0; \
- } \
- const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init(); \
- void Proc()
-
-#define RUNNER_CHILD_TEST_SMACK(Proc) \
- void Proc(); \
- void Proc##Child(); \
- static int Static##Proc##Init() \
- { \
- if(smack_check()) \
- DPL::Test::TestRunnerSingleton::Instance().RegisterTest(#Proc, &Proc); \
- return 0; \
- } \
- const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init(); \
- void Proc(){ \
- DPL::Test::RunChildProc(&Proc##Child); \
- } \
- void Proc##Child()
-
-#define RUNNER_CHILD_TEST_NOSMACK(Proc) \
- void Proc(); \
- void Proc##Child(); \
- static int Static##Proc##Init() \
- { \
- if(!(smack_check())) \
- DPL::Test::TestRunnerSingleton::Instance().RegisterTest(#Proc, &Proc); \
- return 0; \
- } \
- const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init(); \
- void Proc(){ \
- DPL::Test::RunChildProc(&Proc##Child); \
- } \
- void Proc##Child()
-
-#define RUNNER_MULTIPROCESS_TEST_SMACK(Proc) \
- void Proc(); \
- void Proc##Multi(); \
- static int Static##Proc##Init() \
- { \
- if(smack_check()) \
- DPL::Test::TestRunnerSingleton::Instance().RegisterTest(#Proc, &Proc); \
- return 0; \
- } \
- const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init(); \
- void Proc(){ \
- DPL::Test::RunMultiProc(&Proc##Multi); \
- } \
- void Proc##Multi()
-
-#define RUNNER_MULTIPROCESS_TEST_NOSMACK(Proc) \
- void Proc(); \
- void Proc##Multi(); \
- static int Static##Proc##Init() \
- { \
- if(!(smack_check())) \
- DPL::Test::TestRunnerSingleton::Instance().RegisterTest(#Proc, &Proc); \
- return 0; \
- } \
- const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init(); \
- void Proc(){ \
- DPL::Test::RunMultiProc(&Proc##Multi); \
- } \
- void Proc##Multi()
+
+#define RUNNER_TEST_SMACK(Proc, ...) \
+ void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple); \
+ static int Static##Proc##Init() \
+ { \
+ if (smack_check()) \
+ DPL::Test::TestRunnerSingleton::Instance().RegisterTest( \
+ new DPL::Test::TestCaseExtended<__VA_ARGS__>(#Proc, &Proc)); \
+ return 0; \
+ } \
+ const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init(); \
+ void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple DPL_UNUSED)
+
+#define RUNNER_TEST_NOSMACK(Proc, ...) \
+ void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple); \
+ static int Static##Proc##Init() \
+ { \
+ if (!smack_check()) \
+ DPL::Test::TestRunnerSingleton::Instance().RegisterTest( \
+ new DPL::Test::TestCaseExtended<__VA_ARGS__>(#Proc, &Proc)); \
+ return 0; \
+ } \
+ const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init(); \
+ void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple DPL_UNUSED)
+
+#define RUNNER_CHILD_TEST_SMACK(Proc, ...) \
+ void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple); \
+ void Proc##Child(std::tuple<__VA_ARGS__> &optionalArgsTuple); \
+ static int Static##Proc##Init() \
+ { \
+ if (smack_check()) \
+ DPL::Test::TestRunnerSingleton::Instance().RegisterTest( \
+ new DPL::Test::TestCaseExtended<__VA_ARGS__>(#Proc, &Proc)); \
+ return 0; \
+ } \
+ const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init(); \
+ void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple) { \
+ DPL::Test::RunChildProc(std::bind(Proc##Child, optionalArgsTuple)); \
+ } \
+ void Proc##Child(std::tuple<__VA_ARGS__> &optionalArgsTuple DPL_UNUSED)
+
+#define RUNNER_CHILD_TEST_NOSMACK(Proc, ...) \
+ void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple); \
+ void Proc##Child(std::tuple<__VA_ARGS__> &optionalArgsTuple); \
+ static int Static##Proc##Init() \
+ { \
+ if (!smack_check()) \
+ DPL::Test::TestRunnerSingleton::Instance().RegisterTest( \
+ new DPL::Test::TestCaseExtended<__VA_ARGS__>(#Proc, &Proc)); \
+ return 0; \
+ } \
+ const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init(); \
+ void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple) { \
+ DPL::Test::RunChildProc(std::bind(Proc##Child, optionalArgsTuple)); \
+ } \
+ void Proc##Child(std::tuple<__VA_ARGS__> &optionalArgsTuple DPL_UNUSED)
+
+#define RUNNER_MULTIPROCESS_TEST_SMACK(Proc, ...) \
+ void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple); \
+ void Proc##Multi(std::tuple<__VA_ARGS__> &optionalArgsTuple); \
+ static int Static##Proc##Init() \
+ { \
+ if (smack_check()) \
+ DPL::Test::TestRunnerSingleton::Instance().RegisterTest( \
+ new DPL::Test::TestCaseExtended<__VA_ARGS__>(#Proc, &Proc)); \
+ return 0; \
+ } \
+ const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init(); \
+ void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple) { \
+ DPL::Test::RunMultiProc(std::bind(Proc##Multi, optionalArgsTuple)); \
+ } \
+ void Proc##Multi(std::tuple<__VA_ARGS__> &optionalArgsTuple DPL_UNUSED)
+
+#define RUNNER_MULTIPROCESS_TEST_NOSMACK(Proc, ...) \
+ void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple); \
+ void Proc##Multi(std::tuple<__VA_ARGS__> &optionalArgsTuple); \
+ static int Static##Proc##Init() \
+ { \
+ if (!smack_check()) \
+ DPL::Test::TestRunnerSingleton::Instance().RegisterTest( \
+ new DPL::Test::TestCaseExtended<__VA_ARGS__>(#Proc, &Proc)); \
+ return 0; \
+ } \
+ const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init(); \
+ void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple) { \
+ DPL::Test::RunMultiProc(std::bind(Proc##Multi, optionalArgsTuple)); \
+ } \
+ void Proc##Multi(std::tuple<__VA_ARGS__> &optionalArgsTuple DPL_UNUSED)
namespace DB {