Commit 6151a6ea authored by Andrey Kamaev's avatar Andrey Kamaev

Make SANITY_CHECK required for all performance tests

parent 94b97b7a
......@@ -27,6 +27,7 @@
namespace perf
{
class TestBase;
/*****************************************************************************************\
* Predefined typical frame sizes and typical test parameters *
......@@ -163,7 +164,7 @@ enum ERROR_TYPE
class CV_EXPORTS Regression
{
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");
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::FileNode rootIn;
std::string currentTestNodeName;
cv::FileStorage& write();
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);
};
#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 _declareHelper;
friend class Regression;
#ifdef HAVE_TBB
cv::Ptr<tbb::task_scheduler_init> p_tbb_initializer;
#else
cv::Ptr<int> fixme;
#endif
bool verified;
public:
_declareHelper declare;
......
......@@ -97,8 +97,9 @@ Regression& Regression::instance()
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);
}
......@@ -493,6 +494,7 @@ Regression& Regression::operator() (const std::string& name, cv::InputArray arra
else
verify(this_arg, array, eps, err);
}
return *this;
}
......@@ -914,6 +916,7 @@ void TestBase::SetUp()
if (param_affinity_mask)
setCurrentThreadAffinityMask(param_affinity_mask);
#endif
verified = false;
lastTime = 0;
totalTime = 0;
runsPerIteration = 1;
......@@ -926,6 +929,9 @@ void TestBase::SetUp()
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();
if (HasFailure())
reportMetrics(false);
......
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