From 6446257a930a2b4ff6b4a83a060d45d4d70cc331 Mon Sep 17 00:00:00 2001 From: Karen Shea Date: Mon, 13 Feb 2017 17:57:39 +0100 Subject: [PATCH] add error logging for missing osrm file to library tests (#3704) --- unit_tests/library/args.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/unit_tests/library/args.hpp b/unit_tests/library/args.hpp index 512b612dd4a..f9b95b17ccc 100644 --- a/unit_tests/library/args.hpp +++ b/unit_tests/library/args.hpp @@ -1,12 +1,27 @@ #ifndef OSRM_UNIT_TEST_ARGS #define OSRM_UNIT_TEST_ARGS +#include "util/log.hpp" +#include +#include #include #include #include inline std::vector get_args() { + osrm::util::LogPolicy::GetInstance().Unmute(); + if ((boost::unit_test::framework::master_test_suite().argc != 2) || + (!boost::filesystem::is_regular_file( + boost::unit_test::framework::master_test_suite().argv[1]))) + { + osrm::util::Log(logERROR) << "Please provide valid input osrm file"; + osrm::util::Log(logERROR) << "Usage: " + << boost::unit_test::framework::master_test_suite().argv[0] + << " /path/to/input_osrm_file" << std::endl; + std::exit(EXIT_FAILURE); + } + // Split off argv[0], store actual positional arguments in args const auto argc = boost::unit_test::framework::master_test_suite().argc - 1; const auto argv = boost::unit_test::framework::master_test_suite().argv + 1;