Commit 31da8335 authored by Pavel Rojtberg's avatar Pavel Rojtberg

ts/ts_perf: fix wrong has() usage

`has()` only tests for an argument presence which is always true for
arguments with default values. Use `get<bool>()` to check the value
instead.
parent 96cc6184
...@@ -783,7 +783,7 @@ void TestBase::Init(const std::vector<std::string> & availableImpls, ...@@ -783,7 +783,7 @@ void TestBase::Init(const std::vector<std::string> & availableImpls,
; ;
cv::CommandLineParser args(argc, argv, command_line_keys); cv::CommandLineParser args(argc, argv, command_line_keys);
if (args.has("help")) if (args.get<bool>("help"))
{ {
args.printMessage(); args.printMessage();
return; return;
...@@ -791,7 +791,7 @@ void TestBase::Init(const std::vector<std::string> & availableImpls, ...@@ -791,7 +791,7 @@ void TestBase::Init(const std::vector<std::string> & availableImpls,
::testing::AddGlobalTestEnvironment(new PerfEnvironment); ::testing::AddGlobalTestEnvironment(new PerfEnvironment);
param_impl = args.has("perf_run_cpu") ? "plain" : args.get<std::string>("perf_impl"); param_impl = args.get<bool>("perf_run_cpu") ? "plain" : args.get<std::string>("perf_impl");
std::string perf_strategy = args.get<std::string>("perf_strategy"); std::string perf_strategy = args.get<std::string>("perf_strategy");
if (perf_strategy == "default") if (perf_strategy == "default")
{ {
...@@ -816,24 +816,24 @@ void TestBase::Init(const std::vector<std::string> & availableImpls, ...@@ -816,24 +816,24 @@ void TestBase::Init(const std::vector<std::string> & availableImpls,
param_seed = args.get<unsigned int>("perf_seed"); param_seed = args.get<unsigned int>("perf_seed");
param_time_limit = std::max(0., args.get<double>("perf_time_limit")); param_time_limit = std::max(0., args.get<double>("perf_time_limit"));
param_force_samples = args.get<unsigned int>("perf_force_samples"); param_force_samples = args.get<unsigned int>("perf_force_samples");
param_write_sanity = args.has("perf_write_sanity"); param_write_sanity = args.get<bool>("perf_write_sanity");
param_verify_sanity = args.has("perf_verify_sanity"); param_verify_sanity = args.get<bool>("perf_verify_sanity");
#ifndef WINRT #ifndef WINRT
test_ipp_check = !args.has("perf_ipp_check") ? getenv("OPENCV_IPP_CHECK") != NULL : true; test_ipp_check = !args.get<bool>("perf_ipp_check") ? getenv("OPENCV_IPP_CHECK") != NULL : true;
#else #else
test_ipp_check = false; test_ipp_check = false;
#endif #endif
param_threads = args.get<int>("perf_threads"); param_threads = args.get<int>("perf_threads");
#ifdef CV_COLLECT_IMPL_DATA #ifdef CV_COLLECT_IMPL_DATA
param_collect_impl = args.has("perf_collect_impl"); param_collect_impl = args.get<bool>("perf_collect_impl");
#endif #endif
#ifdef ANDROID #ifdef ANDROID
param_affinity_mask = args.get<int>("perf_affinity_mask"); param_affinity_mask = args.get<int>("perf_affinity_mask");
log_power_checkpoints = args.has("perf_log_power_checkpoints"); log_power_checkpoints = args.has("perf_log_power_checkpoints");
#endif #endif
bool param_list_impls = args.has("perf_list_impls"); bool param_list_impls = args.get<bool>("perf_list_impls");
if (param_list_impls) if (param_list_impls)
{ {
...@@ -861,7 +861,7 @@ void TestBase::Init(const std::vector<std::string> & availableImpls, ...@@ -861,7 +861,7 @@ void TestBase::Init(const std::vector<std::string> & availableImpls,
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
bool printOnly = args.has("perf_cuda_info_only"); bool printOnly = args.get<bool>("perf_cuda_info_only");
if (printOnly) if (printOnly)
exit(0); exit(0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment