diff options
author | James Ward <james.ward@arm.com> | 2020-10-12 14:17:36 +0100 |
---|---|---|
committer | James Ward <james.ward@arm.com> | 2020-10-14 12:41:58 +0000 |
commit | c89829f1f47855227f9a842c979f3a43800ea826 (patch) | |
tree | 40d58dfa85ff4f8ebf03f5b594ace1775fae2c22 /tests/InferenceTest.inl | |
parent | f9f33a04626756b73e6fd5c89092fd4bcb504b16 (diff) | |
download | armnn-c89829f1f47855227f9a842c979f3a43800ea826.tar.gz |
IVGCVSW-5280 Switch tests/InferenceTest and derived tests over to cxxopts
* refactor AddCommandLineOptions() functions to allow checking of required options
* add CxxoptsUtils.hpp file for convenience functions
!referencetests:268500
Signed-off-by: James Ward <james.ward@arm.com>
Change-Id: Ica954b210b2981b7cd10995f0d75fcb2a2f7b443
Diffstat (limited to 'tests/InferenceTest.inl')
-rw-r--r-- | tests/InferenceTest.inl | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/tests/InferenceTest.inl b/tests/InferenceTest.inl index e8401f6bc3..3d6dae335a 100644 --- a/tests/InferenceTest.inl +++ b/tests/InferenceTest.inl @@ -6,8 +6,9 @@ #include <armnn/utility/Assert.hpp> #include <armnn/utility/NumericCast.hpp> +#include "CxxoptsUtils.hpp" -#include <boost/program_options.hpp> +#include <cxxopts/cxxopts.hpp> #include <fmt/format.h> #include <fstream> @@ -181,19 +182,21 @@ ClassifierTestCaseProvider<TDatabase, InferenceModel>::ClassifierTestCaseProvide template <typename TDatabase, typename InferenceModel> void ClassifierTestCaseProvider<TDatabase, InferenceModel>::AddCommandLineOptions( - boost::program_options::options_description& options) + cxxopts::Options& options, std::vector<std::string>& required) { - namespace po = boost::program_options; - - options.add_options() - ("validation-file-in", po::value<std::string>(&m_ValidationFileIn)->default_value(""), - "Reads expected predictions from the given file and confirms they match the actual predictions.") - ("validation-file-out", po::value<std::string>(&m_ValidationFileOut)->default_value(""), - "Predictions are saved to the given file for later use via --validation-file-in.") - ("data-dir,d", po::value<std::string>(&m_DataDir)->required(), - "Path to directory containing test data"); - - InferenceModel::AddCommandLineOptions(options, m_ModelCommandLineOptions); + options + .allow_unrecognised_options() + .add_options() + ("validation-file-in", + "Reads expected predictions from the given file and confirms they match the actual predictions.", + cxxopts::value<std::string>(m_ValidationFileIn)->default_value("")) + ("validation-file-out", "Predictions are saved to the given file for later use via --validation-file-in.", + cxxopts::value<std::string>(m_ValidationFileOut)->default_value("")) + ("d,data-dir", "Path to directory containing test data", cxxopts::value<std::string>(m_DataDir)); + + required.emplace_back("data-dir"); //add to required arguments to check + + InferenceModel::AddCommandLineOptions(options, m_ModelCommandLineOptions, required); } template <typename TDatabase, typename InferenceModel> |