mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Merge branch 4.x
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "opencv2/ts.hpp"
|
||||
#include <opencv2/core/utils/logger.hpp>
|
||||
#include "opencv2/core/utils/configuration.private.hpp"
|
||||
#include "opencv2/core/utility.hpp"
|
||||
#if !defined(__EMSCRIPTEN__)
|
||||
#include "opencv2/core/private.hpp"
|
||||
|
||||
+11
-18
@@ -551,13 +551,9 @@ static int tsErrorCallback( int status, const char* func_name, const char* err_m
|
||||
void TS::init( const string& modulename )
|
||||
{
|
||||
data_search_subdir.push_back(modulename);
|
||||
#ifndef WINRT
|
||||
char* datapath_dir = getenv("OPENCV_TEST_DATA_PATH");
|
||||
#else
|
||||
char* datapath_dir = OPENCV_TEST_DATA_PATH;
|
||||
#endif
|
||||
std::string datapath_dir = cv::utils::getConfigurationParameterString("OPENCV_TEST_DATA_PATH");
|
||||
|
||||
if( datapath_dir )
|
||||
if( !datapath_dir.empty() )
|
||||
{
|
||||
data_path = path_join(path_join(datapath_dir, modulename), "");
|
||||
}
|
||||
@@ -850,11 +846,7 @@ void parseCustomOptions(int argc, char **argv)
|
||||
|
||||
test_ipp_check = parser.get<bool>("test_ipp_check");
|
||||
if (!test_ipp_check)
|
||||
#ifndef WINRT
|
||||
test_ipp_check = getenv("OPENCV_IPP_CHECK") != NULL;
|
||||
#else
|
||||
test_ipp_check = false;
|
||||
#endif
|
||||
test_ipp_check = cv::utils::getConfigurationParameterBool("OPENCV_IPP_CHECK");
|
||||
|
||||
param_seed = parser.get<unsigned int>("test_seed");
|
||||
|
||||
@@ -900,9 +892,14 @@ static bool isDirectory(const std::string& path)
|
||||
|
||||
void addDataSearchPath(const std::string& path)
|
||||
{
|
||||
if (isDirectory(path))
|
||||
if (!path.empty() && isDirectory(path))
|
||||
TS::ptr()->data_search_path.push_back(path);
|
||||
}
|
||||
void addDataSearchEnv(const std::string& env_name)
|
||||
{
|
||||
const std::string val = cv::utils::getConfigurationParameterString(env_name.c_str());
|
||||
cvtest::addDataSearchPath(val);
|
||||
}
|
||||
void addDataSearchSubDirectory(const std::string& subdir)
|
||||
{
|
||||
TS::ptr()->data_search_subdir.push_back(subdir);
|
||||
@@ -948,14 +945,10 @@ static std::string findData(const std::string& relative_path, bool required, boo
|
||||
|
||||
const std::vector<std::string>& search_subdir = TS::ptr()->data_search_subdir;
|
||||
|
||||
#ifndef WINRT
|
||||
char* datapath_dir = getenv("OPENCV_TEST_DATA_PATH");
|
||||
#else
|
||||
char* datapath_dir = OPENCV_TEST_DATA_PATH;
|
||||
#endif
|
||||
std::string datapath_dir = cv::utils::getConfigurationParameterString("OPENCV_TEST_DATA_PATH");
|
||||
|
||||
std::string datapath;
|
||||
if (datapath_dir)
|
||||
if (!datapath_dir.empty())
|
||||
{
|
||||
datapath = datapath_dir;
|
||||
//CV_Assert(isDirectory(datapath) && "OPENCV_TEST_DATA_PATH is specified but it doesn't exist");
|
||||
|
||||
+14
-20
@@ -192,22 +192,18 @@ void Regression::init(const std::string& testSuitName, const std::string& ext)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef WINRT
|
||||
const char *data_path_dir = getenv("OPENCV_TEST_DATA_PATH");
|
||||
#else
|
||||
const char *data_path_dir = OPENCV_TEST_DATA_PATH;
|
||||
#endif
|
||||
const std::string data_path_dir = utils::getConfigurationParameterString("OPENCV_TEST_DATA_PATH");
|
||||
|
||||
cvtest::addDataSearchSubDirectory("");
|
||||
cvtest::addDataSearchSubDirectory(testSuitName);
|
||||
|
||||
const char *path_separator = "/";
|
||||
|
||||
if (data_path_dir)
|
||||
if (!data_path_dir.empty())
|
||||
{
|
||||
int len = (int)strlen(data_path_dir)-1;
|
||||
int len = (int)data_path_dir.size()-1;
|
||||
if (len < 0) len = 0;
|
||||
std::string path_base = (data_path_dir[0] == 0 ? std::string(".") : std::string(data_path_dir))
|
||||
std::string path_base = (data_path_dir[0] == 0 ? std::string(".") : data_path_dir)
|
||||
+ (data_path_dir[len] == '/' || data_path_dir[len] == '\\' ? "" : path_separator)
|
||||
+ "perf"
|
||||
+ path_separator;
|
||||
@@ -1051,7 +1047,7 @@ void TestBase::Init(const std::vector<std::string> & availableImpls,
|
||||
param_verify_sanity = args.get<bool>("perf_verify_sanity");
|
||||
|
||||
#ifdef HAVE_IPP
|
||||
test_ipp_check = !args.get<bool>("perf_ipp_check") ? getenv("OPENCV_IPP_CHECK") != NULL : true;
|
||||
test_ipp_check = !args.get<bool>("perf_ipp_check") ? utils::getConfigurationParameterBool("OPENCV_IPP_CHECK") : true;
|
||||
#endif
|
||||
testThreads = args.get<int>("perf_threads");
|
||||
#ifdef CV_COLLECT_IMPL_DATA
|
||||
@@ -1134,12 +1130,11 @@ void TestBase::Init(const std::vector<std::string> & availableImpls,
|
||||
#endif
|
||||
|
||||
{
|
||||
#ifndef WINRT
|
||||
const char* path = getenv("OPENCV_PERF_VALIDATION_DIR");
|
||||
#else
|
||||
const char* path = OPENCV_PERF_VALIDATION_DIR;
|
||||
std::string path = utils::getConfigurationParameterString("OPENCV_PERF_VALIDATION_DIR");
|
||||
#ifdef WINRT
|
||||
path = OPENCV_PERF_VALIDATION_DIR;
|
||||
#endif
|
||||
if (path)
|
||||
if (!path.empty())
|
||||
perf_validation_results_directory = path;
|
||||
}
|
||||
|
||||
@@ -1897,17 +1892,16 @@ std::string TestBase::getDataPath(const std::string& relativePath)
|
||||
throw PerfEarlyExitException();
|
||||
}
|
||||
|
||||
#ifndef WINRT
|
||||
const char *data_path_dir = getenv("OPENCV_TEST_DATA_PATH");
|
||||
#else
|
||||
const char *data_path_dir = OPENCV_TEST_DATA_PATH;
|
||||
std::string data_path_dir = utils::getConfigurationParameterString("OPENCV_TEST_DATA_PATH");
|
||||
#ifdef WINRT
|
||||
data_path_dir = OPENCV_TEST_DATA_PATH;
|
||||
#endif
|
||||
const char *path_separator = "/";
|
||||
|
||||
std::string path;
|
||||
if (data_path_dir)
|
||||
if (!data_path_dir.empty())
|
||||
{
|
||||
int len = (int)strlen(data_path_dir) - 1;
|
||||
int len = (int)data_path_dir.size() - 1;
|
||||
if (len < 0) len = 0;
|
||||
path = (data_path_dir[0] == 0 ? std::string(".") : std::string(data_path_dir))
|
||||
+ (data_path_dir[len] == '/' || data_path_dir[len] == '\\' ? "" : path_separator);
|
||||
|
||||
Reference in New Issue
Block a user