Add --perf_verify_sanity option to performance tests

This option provides an easy way to identify tests having no regression data
for sanity checks
This commit is contained in:
Andrey Kamaev 2012-12-11 17:16:27 +04:00
parent 7c6191ec11
commit e1afb1409f
2 changed files with 10 additions and 1 deletions

View File

@ -849,6 +849,8 @@ if __name__ == "__main__":
test_args.extend(["--perf_min_samples=1"])
if not [a for a in test_args if a.startswith("--perf_force_samples=")] :
test_args.extend(["--perf_force_samples=1"])
if not [a for a in test_args if a.startswith("--perf_verify_sanity")] :
test_args.extend(["--perf_verify_sanity"])
logs = []
test_list = []

View File

@ -16,7 +16,8 @@ const std::string command_line_keys =
"{ |perf_force_samples |100 |force set maximum number of samples for all tests}"
"{ |perf_seed |809564 |seed for random numbers generator}"
"{ |perf_threads |-1 |the number of worker threads, if parallel execution is enabled}"
"{ |perf_write_sanity |false |allow to create new records for sanity checks}"
"{ |perf_write_sanity |false |create new records for sanity checks}"
"{ |perf_verify_sanity |false |fail tests having no regression data for sanity checks}"
#ifdef ANDROID
"{ |perf_time_limit |6.0 |default time limit for a single test (in seconds)}"
"{ |perf_affinity_mask |0 |set affinity mask for the main thread}"
@ -41,6 +42,7 @@ static uint64 param_seed;
static double param_time_limit;
static int param_threads;
static bool param_write_sanity;
static bool param_verify_sanity;
#ifdef HAVE_CUDA
static bool param_run_cpu;
static int param_cuda_device;
@ -599,6 +601,10 @@ Regression& Regression::operator() (const std::string& name, cv::InputArray arra
write(array);
write() << "}";
}
else if(param_verify_sanity)
{
ADD_FAILURE() << " No regression data for " << name << " argument";
}
}
else
{
@ -657,6 +663,7 @@ void TestBase::Init(int argc, const char* const argv[])
param_time_limit = std::max(0., args.get<double>("perf_time_limit"));
param_force_samples = args.get<unsigned int>("perf_force_samples");
param_write_sanity = args.get<bool>("perf_write_sanity");
param_verify_sanity = args.get<bool>("perf_verify_sanity");
param_threads = args.get<int>("perf_threads");
#ifdef ANDROID
param_affinity_mask = args.get<int>("perf_affinity_mask");