[nnpkg/tflite_run] make help option work (#6879)
author이상규/On-Device Lab(SR)/Principal Engineer/삼성전자 <sg5.lee@samsung.com>
Mon, 26 Aug 2019 02:09:26 +0000 (22:09 -0400)
committer이춘석/On-Device Lab(SR)/Staff Engineer/삼성전자 <chunseok.lee@samsung.com>
Mon, 26 Aug 2019 02:09:26 +0000 (11:09 +0900)
Currently, tflite/nnpackage_run does not recognize help option.

It complains like:

$ LD_LIBRARY_PATH=Product/out/lib Product/out/bin/nnpackage_run --help
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::program_options::required_option> >'
  what():  the option '--nnpackage' is required but missing
  Aborted (core dumped)

This patch fixes it by notifying errors after parsing help option.

Signed-off-by: Sanggyu Lee <sg5.lee@samsung.com>
tests/tools/nnpackage_run/src/args.cc
tests/tools/tflite_run/src/args.cc

index ef787c8..a7593fa 100644 (file)
@@ -50,7 +50,6 @@ void Args::Parse(const int argc, char **argv)
   po::variables_map vm;
   po::store(po::command_line_parser(argc, argv).options(_options).positional(_positional).run(),
             vm);
-  po::notify(vm);
 
   {
     auto conflicting_options = [&](const std::string &o1, const std::string &o2) {
@@ -72,6 +71,8 @@ void Args::Parse(const int argc, char **argv)
     exit(0);
   }
 
+  po::notify(vm);
+
   if (vm.count("dump"))
   {
     _dump_filename = vm["dump"].as<std::string>();
index ef65784..6c85d88 100644 (file)
@@ -54,7 +54,6 @@ void Args::Parse(const int argc, char **argv)
   po::variables_map vm;
   po::store(po::command_line_parser(argc, argv).options(_options).positional(_positional).run(),
             vm);
-  po::notify(vm);
 
   {
     auto conflicting_options = [&](const std::string &o1, const std::string &o2) {
@@ -78,6 +77,8 @@ void Args::Parse(const int argc, char **argv)
     exit(0);
   }
 
+  po::notify(vm);
+
   if (vm.count("dump"))
   {
     _dump_filename = vm["dump"].as<std::string>();