summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--infrastructure/buildenv-testmain-template.cpp11
-rw-r--r--lib/common/Test.h2
-rw-r--r--test/basicserver/testbasicserver.cpp24
3 files changed, 25 insertions, 12 deletions
diff --git a/infrastructure/buildenv-testmain-template.cpp b/infrastructure/buildenv-testmain-template.cpp
index 1a176c52..b392606b 100644
--- a/infrastructure/buildenv-testmain-template.cpp
+++ b/infrastructure/buildenv-testmain-template.cpp
@@ -57,7 +57,7 @@ int test(int argc, const char *argv[]);
int failures = 0;
int first_fail_line;
std::string first_fail_file;
-std::string bbackupd_args, bbstored_args, bbackupquery_args;
+std::string bbackupd_args, bbstored_args, bbackupquery_args, test_args;
int filedes_open_at_beginning = -1;
@@ -194,12 +194,16 @@ int main(int argc, char * const * argv)
case 't':
{
Console::SetTag(optarg);
+ test_args += " -t '";
+ test_args += optarg;
+ test_args += "'";
}
break;
case 'T':
{
Console::SetShowTime(true);
+ test_args += " -T";
}
break;
@@ -207,13 +211,14 @@ int main(int argc, char * const * argv)
{
Console::SetShowTime(true);
Console::SetShowTimeMicros(true);
+ test_args += " -U";
}
break;
case '?':
{
- fprintf(stderr, "Unknown option: %s\n",
- optarg);
+ fprintf(stderr, "Unknown option: '%c'\n",
+ optopt);
exit(2);
}
diff --git a/lib/common/Test.h b/lib/common/Test.h
index cf7cb713..49b0ac66 100644
--- a/lib/common/Test.h
+++ b/lib/common/Test.h
@@ -43,7 +43,7 @@
extern int failures;
extern int first_fail_line;
extern std::string first_fail_file;
-extern std::string bbackupd_args, bbstored_args, bbackupquery_args;
+extern std::string bbackupd_args, bbstored_args, bbackupquery_args, test_args;
#define TEST_FAIL_WITH_MESSAGE(msg) \
{ \
diff --git a/test/basicserver/testbasicserver.cpp b/test/basicserver/testbasicserver.cpp
index 4b33f555..be704881 100644
--- a/test/basicserver/testbasicserver.cpp
+++ b/test/basicserver/testbasicserver.cpp
@@ -436,8 +436,10 @@ int test(int argc, const char *argv[])
// Launch a basic server
{
- int pid = LaunchServer("./test srv1 testfiles/srv1.conf",
- "testfiles/srv1.pid");
+ std::string cmd = "./test";
+ cmd += test_args;
+ cmd += " srv1 testfiles/srv1.conf";
+ int pid = LaunchServer(cmd, "testfiles/srv1.pid");
TEST_THAT(pid != -1 && pid != 0);
if(pid > 0)
@@ -480,8 +482,10 @@ int test(int argc, const char *argv[])
// Launch a test forking server
{
- int pid = LaunchServer("./test srv2 testfiles/srv2.conf",
- "testfiles/srv2.pid");
+ std::string cmd = "./test";
+ cmd += test_args;
+ cmd += " srv2 testfiles/srv2.conf";
+ int pid = LaunchServer(cmd, "testfiles/srv2.pid");
TEST_THAT(pid != -1 && pid != 0);
@@ -548,8 +552,10 @@ int test(int argc, const char *argv[])
// Launch a test SSL server
{
- int pid = LaunchServer("./test srv3 testfiles/srv3.conf",
- "testfiles/srv3.pid");
+ std::string cmd = "./test";
+ cmd += test_args;
+ cmd += " srv3 testfiles/srv3.conf";
+ int pid = LaunchServer(cmd, "testfiles/srv3.pid");
TEST_THAT(pid != -1 && pid != 0);
@@ -627,8 +633,10 @@ int test(int argc, const char *argv[])
//protocolserver:
// Launch a test protocol handling server
{
- int pid = LaunchServer("./test srv4 testfiles/srv4.conf",
- "testfiles/srv4.pid");
+ std::string cmd = "./test";
+ cmd += test_args;
+ cmd += " srv4 testfiles/srv4.conf";
+ int pid = LaunchServer(cmd, "testfiles/srv4.pid");
TEST_THAT(pid != -1 && pid != 0);