Commit ac14cee7 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #14974 from alalek:ts_optional_files_runtime_check

parents f795878d bc95c609
...@@ -205,7 +205,7 @@ TEST(Reproducibility_FCN, Accuracy) ...@@ -205,7 +205,7 @@ TEST(Reproducibility_FCN, Accuracy)
Net net; Net net;
{ {
const string proto = findDataFile("dnn/fcn8s-heavy-pascal.prototxt"); const string proto = findDataFile("dnn/fcn8s-heavy-pascal.prototxt");
const string model = findDataFile("dnn/fcn8s-heavy-pascal.caffemodel"); const string model = findDataFile("dnn/fcn8s-heavy-pascal.caffemodel", false);
net = readNetFromCaffe(proto, model); net = readNetFromCaffe(proto, model);
ASSERT_FALSE(net.empty()); ASSERT_FALSE(net.empty());
} }
......
...@@ -968,13 +968,15 @@ static std::string findData(const std::string& relative_path, bool required, boo ...@@ -968,13 +968,15 @@ static std::string findData(const std::string& relative_path, bool required, boo
std::string prefix = path_join(datapath, subdir); std::string prefix = path_join(datapath, subdir);
std::string result_; std::string result_;
CHECK_FILE_WITH_PREFIX(prefix, result_); CHECK_FILE_WITH_PREFIX(prefix, result_);
#if 1 // check for misused 'optional' mode
if (!required && !result_.empty()) if (!required && !result_.empty())
{ {
std::cout << "TEST ERROR: Don't use 'optional' findData() for " << relative_path << std::endl; std::cout << "TEST ERROR: Don't use 'optional' findData() for " << relative_path << std::endl;
CV_Assert(required || result_.empty()); static bool checkOptionalFlag = cv::utils::getConfigurationParameterBool("OPENCV_TEST_CHECK_OPTIONAL_DATA", false);
if (checkOptionalFlag)
{
CV_Assert(required || result_.empty());
}
} }
#endif
if (!result_.empty()) if (!result_.empty())
return result_; return result_;
} }
......
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