aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthew Sloyan <matthew.sloyan@arm.com>2020-09-30 13:07:51 +0100
committerTeresaARM <teresa.charlinreyes@arm.com>2020-10-01 13:26:33 +0000
commitf7017cb58b25f6047f2fa90cdb5cb06f77217089 (patch)
tree01cd3506e1050ce18bd2037ffd1a85fe3c13c099 /tests
parentb17220d7323a7ece19e8cc16839491984848bf44 (diff)
downloadarmnn-f7017cb58b25f6047f2fa90cdb5cb06f77217089.tar.gz
IVGCVSW-5283 Switch tests/profiling/gatordmock over to cxxopts
Signed-off-by: Matthew Sloyan <matthew.sloyan@arm.com> Change-Id: I4f06a414d6bd5f18c2ced882ac518052ed371cfc
Diffstat (limited to 'tests')
-rw-r--r--tests/profiling/gatordmock/CommandLineProcessor.cpp57
1 files changed, 31 insertions, 26 deletions
diff --git a/tests/profiling/gatordmock/CommandLineProcessor.cpp b/tests/profiling/gatordmock/CommandLineProcessor.cpp
index 2903dbbfe3..c1b6a6b2b3 100644
--- a/tests/profiling/gatordmock/CommandLineProcessor.cpp
+++ b/tests/profiling/gatordmock/CommandLineProcessor.cpp
@@ -5,7 +5,7 @@
#include "CommandLineProcessor.hpp"
-#include <boost/program_options.hpp>
+#include <cxxopts/cxxopts.hpp>
#include <iostream>
namespace armnn
@@ -15,19 +15,24 @@ namespace gatordmock
bool CommandLineProcessor::ProcessCommandLine(int argc, char *argv[])
{
- namespace po = boost::program_options;
- po::options_description desc("Options");
+ cxxopts::Options options("GatordMock",
+ "Simulate a Gatord server to interact with ArmNN external profiling.");
+
try
{
- desc.add_options()
- ("help,h", "Display help messages")
- ("file,f", po::value<std::string>(&m_File),
- "The path to the file that contains instructions for the mock gatord")
- ("namespace,n", po::value<std::string>(&m_UdsNamespace)->default_value("gatord_namespace"),
- "The Unix domain socket namespace this server will bind to.\n"
- "This will always be prepended with \\0 to use the abstract namespace")
- ("echo,e", po::bool_switch(&m_Echo)->default_value(false),
- "Echo packets sent and received to stdout. Disabled by default.\n");
+ options.add_options()
+ ("h,help", "Display help messages")
+ ("f,file",
+ "The path to the file that contains instructions for the mock gatord.",
+ cxxopts::value<std::string>(m_File))
+ ("n,namespace",
+ "The Unix domain socket namespace this server will bind to.\n"
+ "This will always be prepended with \\0 to use the abstract namespace",
+ cxxopts::value<std::string>(m_UdsNamespace)->default_value("gatord_namespace"))
+ ("e,echo",
+ "Echo packets sent and received to stdout. Disabled by default. "
+ "Default value = false.",
+ cxxopts::value<bool>(m_Echo)->default_value("false"));
}
catch (const std::exception& e)
{
@@ -35,32 +40,32 @@ bool CommandLineProcessor::ProcessCommandLine(int argc, char *argv[])
return false;
}
- po::variables_map vm;
try
{
- po::store(po::parse_command_line(argc, argv, desc), vm);
+ auto result = options.parse(argc, argv);
- if (vm.count("help"))
+ if (result.count("help"))
{
- std::cout << "Simulate a Gatord server to interact with ArmNN external profiling." << std::endl;
- std::cout << std::endl;
- std::cout << desc << std::endl;
+ std::cout << options.help() << std::endl;
return false;
}
+
// Currently the file parameter is mandatory.
- if (!vm.count("file"))
+ if (!result.count("file"))
{
- std::cout << std::endl << "*** Expected --file or -f parameter." << std::endl;
- std::cout << std::endl;
- std::cout << desc << std::endl;
+ std::cout << "-f/--file parameter is mandatory." << std::endl;
return false;
}
- po::notify(vm);
+
+ // Sets bool value correctly.
+ if (result.count("echo"))
+ {
+ m_Echo = true;
+ }
}
- catch (const po::error& e)
+ catch (const cxxopts::OptionException& e)
{
- std::cerr << e.what() << std::endl << std::endl;
- std::cerr << desc << std::endl;
+ std::cerr << e.what() << std::endl;
return false;
}