mirror of
https://github.com/opencv/opencv.git
synced 2025-06-16 23:00:51 +08:00
Make SANITY_CHECK required for all performance tests
This commit is contained in:
parent
94b97b7a63
commit
6151a6ea0b
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
namespace perf
|
namespace perf
|
||||||
{
|
{
|
||||||
|
class TestBase;
|
||||||
|
|
||||||
/*****************************************************************************************\
|
/*****************************************************************************************\
|
||||||
* Predefined typical frame sizes and typical test parameters *
|
* Predefined typical frame sizes and typical test parameters *
|
||||||
@ -163,7 +164,7 @@ enum ERROR_TYPE
|
|||||||
class CV_EXPORTS Regression
|
class CV_EXPORTS Regression
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static Regression& add(const std::string& name, cv::InputArray array, double eps = DBL_EPSILON, ERROR_TYPE err = ERROR_ABSOLUTE);
|
static Regression& add(TestBase* test, const std::string& name, cv::InputArray array, double eps = DBL_EPSILON, ERROR_TYPE err = ERROR_ABSOLUTE);
|
||||||
static void Init(const std::string& testSuitName, const std::string& ext = ".xml");
|
static void Init(const std::string& testSuitName, const std::string& ext = ".xml");
|
||||||
|
|
||||||
Regression& operator() (const std::string& name, cv::InputArray array, double eps = DBL_EPSILON, ERROR_TYPE err = ERROR_ABSOLUTE);
|
Regression& operator() (const std::string& name, cv::InputArray array, double eps = DBL_EPSILON, ERROR_TYPE err = ERROR_ABSOLUTE);
|
||||||
@ -183,6 +184,7 @@ private:
|
|||||||
cv::FileStorage storageOut;
|
cv::FileStorage storageOut;
|
||||||
cv::FileNode rootIn;
|
cv::FileNode rootIn;
|
||||||
std::string currentTestNodeName;
|
std::string currentTestNodeName;
|
||||||
|
|
||||||
cv::FileStorage& write();
|
cv::FileStorage& write();
|
||||||
|
|
||||||
static std::string getCurrentTestNodeName();
|
static std::string getCurrentTestNodeName();
|
||||||
@ -196,7 +198,7 @@ private:
|
|||||||
void verify(cv::FileNode node, cv::Mat actual, double eps, std::string argname, ERROR_TYPE err);
|
void verify(cv::FileNode node, cv::Mat actual, double eps, std::string argname, ERROR_TYPE err);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SANITY_CHECK(array, ...) ::perf::Regression::add(#array, array , ## __VA_ARGS__)
|
#define SANITY_CHECK(array, ...) ::perf::Regression::add(this, #array, array , ## __VA_ARGS__)
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************************\
|
/*****************************************************************************************\
|
||||||
@ -322,12 +324,14 @@ private:
|
|||||||
friend class TestBase;
|
friend class TestBase;
|
||||||
};
|
};
|
||||||
friend class _declareHelper;
|
friend class _declareHelper;
|
||||||
|
friend class Regression;
|
||||||
|
|
||||||
#ifdef HAVE_TBB
|
#ifdef HAVE_TBB
|
||||||
cv::Ptr<tbb::task_scheduler_init> p_tbb_initializer;
|
cv::Ptr<tbb::task_scheduler_init> p_tbb_initializer;
|
||||||
#else
|
#else
|
||||||
cv::Ptr<int> fixme;
|
cv::Ptr<int> fixme;
|
||||||
#endif
|
#endif
|
||||||
|
bool verified;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
_declareHelper declare;
|
_declareHelper declare;
|
||||||
|
@ -97,8 +97,9 @@ Regression& Regression::instance()
|
|||||||
return single;
|
return single;
|
||||||
}
|
}
|
||||||
|
|
||||||
Regression& Regression::add(const std::string& name, cv::InputArray array, double eps, ERROR_TYPE err)
|
Regression& Regression::add(TestBase* test, const std::string& name, cv::InputArray array, double eps, ERROR_TYPE err)
|
||||||
{
|
{
|
||||||
|
if(test) test->verified = true;
|
||||||
return instance()(name, array, eps, err);
|
return instance()(name, array, eps, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,6 +494,7 @@ Regression& Regression::operator() (const std::string& name, cv::InputArray arra
|
|||||||
else
|
else
|
||||||
verify(this_arg, array, eps, err);
|
verify(this_arg, array, eps, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -914,6 +916,7 @@ void TestBase::SetUp()
|
|||||||
if (param_affinity_mask)
|
if (param_affinity_mask)
|
||||||
setCurrentThreadAffinityMask(param_affinity_mask);
|
setCurrentThreadAffinityMask(param_affinity_mask);
|
||||||
#endif
|
#endif
|
||||||
|
verified = false;
|
||||||
lastTime = 0;
|
lastTime = 0;
|
||||||
totalTime = 0;
|
totalTime = 0;
|
||||||
runsPerIteration = 1;
|
runsPerIteration = 1;
|
||||||
@ -926,6 +929,9 @@ void TestBase::SetUp()
|
|||||||
|
|
||||||
void TestBase::TearDown()
|
void TestBase::TearDown()
|
||||||
{
|
{
|
||||||
|
if (!HasFailure() && !verified)
|
||||||
|
ADD_FAILURE() << "The test has no sanity checks. There should be at least one check at the end of performance test.";
|
||||||
|
|
||||||
validateMetrics();
|
validateMetrics();
|
||||||
if (HasFailure())
|
if (HasFailure())
|
||||||
reportMetrics(false);
|
reportMetrics(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user