summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2015-06-10 19:45:58 +0000
committerChris Wilson <chris+github@qwirx.com>2015-06-10 19:45:58 +0000
commit1ca26a324f693c42fe7df78e782dba231b911874 (patch)
treebd8423db6161c1347b4d4a64d74e23359ff9a14b
parent3fbe0d1f445829dad8b2636a56b99bd1050d8e89 (diff)
Add command-line help to test executables.
-rw-r--r--infrastructure/buildenv-testmain-template.cpp28
-rw-r--r--lib/server/Daemon.cpp4
-rw-r--r--modules.txt10
3 files changed, 34 insertions, 8 deletions
diff --git a/infrastructure/buildenv-testmain-template.cpp b/infrastructure/buildenv-testmain-template.cpp
index a2085ea3..09be9f70 100644
--- a/infrastructure/buildenv-testmain-template.cpp
+++ b/infrastructure/buildenv-testmain-template.cpp
@@ -41,10 +41,12 @@
#endif
#include <exception>
+#include <iostream>
#include <list>
#include <string>
#include "box_getopt.h"
+#include "depot.h"
#include "Logging.h"
#include "Test.h"
#include "Timer.h"
@@ -237,6 +239,23 @@ bool checkfilesleftopen()
#endif
+int Usage(const std::string& ProgramName)
+{
+ std::cout <<
+ "(built with QDBM " << dpversion << ")\n"
+ "\n"
+ "Usage: " << ProgramName << " [options]\n"
+ "\n"
+ "Options:\n"
+ " -c/--bbackupd-args <args> Arguments to pass to bbackupd/BackupDaemon\n"
+ " -s/--bbstored-args <args> Arguments to pass to bbstored/BackupStoreDaemon\n"
+ " -d/--test-daemon-args <args> Arguments to pass to TestDaemon\n"
+ " -e/--execute-only <test> Execute only specific named test, can repeat\n"
+ " -h/--help Show this command-line help\n"
+ << Logging::OptionParser::GetUsageString();
+ return 0;
+}
+
int main(int argc, char * const * argv)
{
// Start memory leak testing
@@ -250,11 +269,12 @@ int main(int argc, char * const * argv)
{ "bbstored-args", required_argument, NULL, 's' },
{ "test-daemon-args", required_argument, NULL, 'd' },
{ "execute-only", required_argument, NULL, 'e' },
+ { "help", no_argument, NULL, 'h' },
{ NULL, 0, NULL, 0 }
};
int c;
- std::string options("c:d:e:s:");
+ std::string options("c:d:e:hs:");
options += Logging::OptionParser::GetOptionString();
Logging::OptionParser LogLevel;
@@ -289,6 +309,12 @@ int main(int argc, char * const * argv)
}
break;
+ case 'h':
+ {
+ return Usage(argv[0]);
+ }
+ break;
+
case 's':
{
bbstored_args += " ";
diff --git a/lib/server/Daemon.cpp b/lib/server/Daemon.cpp
index 4715befa..995b04ce 100644
--- a/lib/server/Daemon.cpp
+++ b/lib/server/Daemon.cpp
@@ -134,8 +134,8 @@ void Daemon::Usage()
" -k Keep console open after fork, keep writing log messages to it\n"
" -K Stop writing log messages to console while daemon is running\n"
" -o <file> Log to a file, defaults to maximum verbosity\n"
- " -O <level> Set file log verbosity to error/warning/notice/info/trace/everything\n" <<
- Logging::OptionParser::GetUsageString();
+ " -O <level> Set file log verbosity to error/warning/notice/info/trace/everything\n"
+ << Logging::OptionParser::GetUsageString();
}
// --------------------------------------------------------------------------
diff --git a/modules.txt b/modules.txt
index cfa41271..eece6472 100644
--- a/modules.txt
+++ b/modules.txt
@@ -15,11 +15,11 @@ lib/server qdbm lib/crypto
lib/compress
lib/intercept
-test/common
-test/crypto lib/crypto
-test/compress lib/compress
-test/raidfile lib/raidfile lib/intercept
-test/basicserver lib/server
+test/common qdbm
+test/crypto qdbm lib/crypto
+test/compress qdbm lib/compress
+test/raidfile qdbm lib/raidfile lib/intercept
+test/basicserver qdbm lib/server
# IF_DISTRIBUTION(boxbackup)