diff options
author | Chris Wilson <chris+github@qwirx.com> | 2015-06-10 19:45:58 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2015-06-10 19:45:58 +0000 |
commit | 1ca26a324f693c42fe7df78e782dba231b911874 (patch) | |
tree | bd8423db6161c1347b4d4a64d74e23359ff9a14b /infrastructure/buildenv-testmain-template.cpp | |
parent | 3fbe0d1f445829dad8b2636a56b99bd1050d8e89 (diff) |
Add command-line help to test executables.
Diffstat (limited to 'infrastructure/buildenv-testmain-template.cpp')
-rw-r--r-- | infrastructure/buildenv-testmain-template.cpp | 28 |
1 files changed, 27 insertions, 1 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 += " "; |