diff options
| author | Alan Conway <aconway@apache.org> | 2007-11-28 15:22:15 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2007-11-28 15:22:15 +0000 |
| commit | f9818ad39528a4f29e5bcce61da83aa19e78eac8 (patch) | |
| tree | 3552853e9b0457f8f10a08c0981e70ecc4658193 /qpid/cpp/src/tests/TestOptions.h | |
| parent | 408b7835d66f6c46bfd91094f3f21dafc2568953 (diff) | |
| download | qpid-python-f9818ad39528a4f29e5bcce61da83aa19e78eac8.tar.gz | |
src/tests/perftest.cpp:
- Added help text explaining multi-process use.
- Fixed bug in multi-process mode, too many threads were started.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@599025 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/TestOptions.h')
| -rw-r--r-- | qpid/cpp/src/tests/TestOptions.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/qpid/cpp/src/tests/TestOptions.h b/qpid/cpp/src/tests/TestOptions.h index 95ebb1e219..e226ebbb68 100644 --- a/qpid/cpp/src/tests/TestOptions.h +++ b/qpid/cpp/src/tests/TestOptions.h @@ -34,7 +34,11 @@ namespace qpid { struct TestOptions : public qpid::Options { - TestOptions() : Options("Test Options"), host("localhost"), port(TcpAddress::DEFAULT_PORT), clientid("cpp"), help(false) + TestOptions(const std::string& helpText_=std::string()) : + Options("Test Options"), + host("localhost"), port(TcpAddress::DEFAULT_PORT), + clientid("cpp"), help(false), + helpText(helpText_) { addOptions() ("host,h", optValue(host, "HOST"), "Broker host to connect to") @@ -49,23 +53,24 @@ struct TestOptions : public qpid::Options add(log); } - /** As well as parsing, print help & exit if required */ + /** As well as parsing, throw help message if requested. */ void parse(int argc, char** argv) { try { qpid::Options::parse(argc, argv); } catch (const std::exception& e) { - std::cout << e.what() << std::endl << *this << std::endl; - exit(1); + std::ostringstream msg; + msg << *this << std::endl << std::endl << e.what() << std::endl; + throw qpid::Options::Exception(msg.str()); } + qpid::log::Logger::instance().configure(log, argv[0]); if (help) { - std::cout << *this << std::endl; - exit(0); + std::ostringstream msg; + msg << *this << std::endl << std::endl << helpText << std::endl; + throw qpid::Options::Exception(msg.str()); } - trace = log.trace; - qpid::log::Logger::instance().configure(log, argv[0]); } - /** Open a connection usin option values */ + /** Open a connection using option values */ void open(qpid::client::Connection& connection) { connection.open(host, port, username, password, virtualhost); } @@ -77,9 +82,9 @@ struct TestOptions : public qpid::Options std::string clientid; std::string username; std::string password; - bool trace; bool help; log::Options log; + std::string helpText; }; } |
