cmd option
This commit is contained in:
@@ -554,15 +554,17 @@ CV_EXPORTS void printVersionInfo(bool useStdOut = true);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_OPENCL)
|
||||
#ifdef HAVE_OPENCL
|
||||
namespace cvtest { namespace ocl {
|
||||
void dumpOpenCLDevice();
|
||||
}}
|
||||
} }
|
||||
#define TEST_DUMP_OCL_INFO cvtest::ocl::dumpOpenCLDevice();
|
||||
#else
|
||||
#define TEST_DUMP_OCL_INFO
|
||||
#endif
|
||||
|
||||
void parseCustomOptions(int argc, char **argv);
|
||||
|
||||
#define CV_TEST_MAIN(resourcesubdir, ...) \
|
||||
int main(int argc, char **argv) \
|
||||
{ \
|
||||
@@ -571,6 +573,7 @@ int main(int argc, char **argv) \
|
||||
cvtest::printVersionInfo(); \
|
||||
__CV_TEST_EXEC_ARGS(__VA_ARGS__) \
|
||||
TEST_DUMP_OCL_INFO \
|
||||
parseCustomOptions(argc, argv); \
|
||||
return RUN_ALL_TESTS(); \
|
||||
}
|
||||
|
||||
|
@@ -1,11 +1,14 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
// Copyright (C) 2014, Intel, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
|
||||
#ifndef __OPENCV_TS_EXT_HPP__
|
||||
#define __OPENCV_TS_EXT_HPP__
|
||||
|
||||
#define CHECK_IPP_STATUS \
|
||||
do \
|
||||
{ \
|
||||
EXPECT_LE(0, getIppStatus()) << getIppErrorLocation().c_str(); \
|
||||
} while ((void)0, 0)
|
||||
void checkIppStatus();
|
||||
|
||||
#undef TEST
|
||||
#define TEST(test_case_name, test_name) \
|
||||
@@ -29,7 +32,7 @@
|
||||
::testing::Test::TearDownTestCase, \
|
||||
new ::testing::internal::TestFactoryImpl<\
|
||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() { setIppStatus(0); Body(); CHECK_IPP_STATUS; } \
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() { cv::ipp::setIppStatus(0); Body(); checkIppStatus(); } \
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::Body()
|
||||
|
||||
#undef TEST_F
|
||||
@@ -54,7 +57,7 @@
|
||||
test_fixture::TearDownTestCase, \
|
||||
new ::testing::internal::TestFactoryImpl<\
|
||||
GTEST_TEST_CLASS_NAME_(test_fixture, test_name)>);\
|
||||
void GTEST_TEST_CLASS_NAME_(test_fixture, test_name)::TestBody() { setIppStatus(0); Body(); CHECK_IPP_STATUS; } \
|
||||
void GTEST_TEST_CLASS_NAME_(test_fixture, test_name)::TestBody() { cv::ipp::setIppStatus(0); Body(); checkIppStatus(); } \
|
||||
void GTEST_TEST_CLASS_NAME_(test_fixture, test_name)::Body()
|
||||
|
||||
#undef TEST_P
|
||||
@@ -83,7 +86,7 @@
|
||||
int GTEST_TEST_CLASS_NAME_(test_case_name, \
|
||||
test_name)::gtest_registering_dummy_ = \
|
||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() { setIppStatus(0); Body(); CHECK_IPP_STATUS; } \
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() { cv::ipp::setIppStatus(0); Body(); checkIppStatus(); } \
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::Body()
|
||||
|
||||
#endif // __OPENCV_TS_EXT_HPP__
|
||||
|
@@ -658,4 +658,33 @@ void smoothBorder(Mat& img, const Scalar& color, int delta)
|
||||
|
||||
} //namespace cvtest
|
||||
|
||||
bool test_ipp_check = false;
|
||||
|
||||
void checkIppStatus()
|
||||
{
|
||||
if (test_ipp_check)
|
||||
{
|
||||
int status = cv::ipp::getIppStatus();
|
||||
EXPECT_LE(0, status) << cv::ipp::getIppErrorLocation().c_str();
|
||||
}
|
||||
}
|
||||
|
||||
void parseCustomOptions(int argc, char **argv)
|
||||
{
|
||||
const char * const command_line_keys =
|
||||
"{ ipp test_ipp_check |false |check whether IPP works without failures }"
|
||||
"{ h help |false |print help info }";
|
||||
|
||||
cv::CommandLineParser parser(argc, argv, command_line_keys);
|
||||
if (parser.get<bool>("help"))
|
||||
{
|
||||
std::cout << "\nAvailable options besides google test option: \n";
|
||||
parser.printMessage();
|
||||
}
|
||||
|
||||
test_ipp_check = parser.get<bool>("test_ipp_check");
|
||||
if (!test_ipp_check)
|
||||
test_ipp_check = getenv("OPENCV_IPP_CHECK") != NULL;
|
||||
}
|
||||
|
||||
/* End of file. */
|
||||
|
@@ -31,6 +31,7 @@ static double param_time_limit;
|
||||
static int param_threads;
|
||||
static bool param_write_sanity;
|
||||
static bool param_verify_sanity;
|
||||
extern bool test_ipp_check;
|
||||
#ifdef HAVE_CUDA
|
||||
static int param_cuda_device;
|
||||
#endif
|
||||
@@ -670,6 +671,9 @@ void TestBase::Init(const std::vector<std::string> & availableImpls,
|
||||
"{ perf_time_limit |3.0 |default time limit for a single test (in seconds)}"
|
||||
#endif
|
||||
"{ perf_max_deviation |1.0 |}"
|
||||
#ifdef HAVE_IPP
|
||||
"{ perf_ipp_check |false |check whether IPP works without failures}"
|
||||
#endif
|
||||
"{ help h |false |print help info}"
|
||||
#ifdef HAVE_CUDA
|
||||
"{ perf_cuda_device |0 |run CUDA test suite onto specific CUDA capable device}"
|
||||
@@ -713,7 +717,8 @@ void TestBase::Init(const std::vector<std::string> & availableImpls,
|
||||
param_force_samples = args.get<unsigned int>("perf_force_samples");
|
||||
param_write_sanity = args.has("perf_write_sanity");
|
||||
param_verify_sanity = args.has("perf_verify_sanity");
|
||||
param_threads = args.get<int>("perf_threads");
|
||||
test_ipp_check = !args.has("perf_ipp_check") ? getenv("OPENCV_IPP_CHECK") != NULL : true;
|
||||
param_threads = args.get<int>("perf_threads");
|
||||
#ifdef ANDROID
|
||||
param_affinity_mask = args.get<int>("perf_affinity_mask");
|
||||
log_power_checkpoints = args.has("perf_log_power_checkpoints");
|
||||
|
Reference in New Issue
Block a user