From 3a8a73ef6c219aae1cb3ae93d17d92d7897a9e52 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Wed, 6 Dec 2017 12:58:13 +0300 Subject: [PATCH] ocl: skip unstable tests during pre-commit testing --- modules/ts/include/opencv2/ts/ts_ext.hpp | 1 + modules/ts/misc/run.py | 3 +++ modules/ts/src/ts.cpp | 5 +++++ modules/ts/src/ts_perf.cpp | 3 +++ modules/video/perf/opencl/perf_optflow_pyrlk.cpp | 9 +++++++++ modules/video/test/ocl/test_optflowpyrlk.cpp | 9 +++++++++ 6 files changed, 30 insertions(+) diff --git a/modules/ts/include/opencv2/ts/ts_ext.hpp b/modules/ts/include/opencv2/ts/ts_ext.hpp index 259f869f45..d0a699963c 100644 --- a/modules/ts/include/opencv2/ts/ts_ext.hpp +++ b/modules/ts/include/opencv2/ts/ts_ext.hpp @@ -10,6 +10,7 @@ namespace cvtest { void checkIppStatus(); +extern bool skipUnstableTests; } #define CV__TEST_INIT \ diff --git a/modules/ts/misc/run.py b/modules/ts/misc/run.py index 0befa79ea9..8f5f449e94 100755 --- a/modules/ts/misc/run.py +++ b/modules/ts/misc/run.py @@ -92,6 +92,9 @@ if __name__ == "__main__": if not [a for a in test_args if a.startswith("--perf_verify_sanity")] : test_args.extend(["--perf_verify_sanity"]) + if bool(os.environ.get('BUILD_PRECOMMIT', None)): + test_args.extend(["--skip_unstable=1"]) + ret = 0 logs = [] for path in args.build_path: diff --git a/modules/ts/src/ts.cpp b/modules/ts/src/ts.cpp index 525110290d..e8f3be9c20 100644 --- a/modules/ts/src/ts.cpp +++ b/modules/ts/src/ts.cpp @@ -694,11 +694,14 @@ void checkIppStatus() } } +bool skipUnstableTests = false; + void parseCustomOptions(int argc, char **argv) { const char * const command_line_keys = "{ ipp test_ipp_check |false |check whether IPP works without failures }" "{ test_seed |809564 |seed for random numbers generator }" + "{ skip_unstable |false |skip unstable tests }" "{ h help |false |print help info }"; cv::CommandLineParser parser(argc, argv, command_line_keys); @@ -717,6 +720,8 @@ void parseCustomOptions(int argc, char **argv) #endif param_seed = parser.get("test_seed"); + + skipUnstableTests = parser.get("skip_unstable"); } diff --git a/modules/ts/src/ts_perf.cpp b/modules/ts/src/ts_perf.cpp index e9dad94fcf..01bbf86640 100644 --- a/modules/ts/src/ts_perf.cpp +++ b/modules/ts/src/ts_perf.cpp @@ -999,6 +999,7 @@ void TestBase::Init(const std::vector & availableImpls, "{ perf_cuda_device |0 |run CUDA test suite onto specific CUDA capable device}" "{ perf_cuda_info_only |false |print an information about system and an available CUDA devices and then exit.}" #endif + "{ skip_unstable |false |skip unstable tests }" ; cv::CommandLineParser args(argc, argv, command_line_keys); @@ -1097,6 +1098,8 @@ void TestBase::Init(const std::vector & availableImpls, exit(0); #endif + skipUnstableTests = args.get("skip_unstable"); + if (available_impls.size() > 1) printf("[----------]\n[ INFO ] \tImplementation variant: %s.\n[----------]\n", param_impl.c_str()), fflush(stdout); diff --git a/modules/video/perf/opencl/perf_optflow_pyrlk.cpp b/modules/video/perf/opencl/perf_optflow_pyrlk.cpp index 81c8ed96e1..39387e7d7f 100644 --- a/modules/video/perf/opencl/perf_optflow_pyrlk.cpp +++ b/modules/video/perf/opencl/perf_optflow_pyrlk.cpp @@ -80,6 +80,15 @@ OCL_PERF_TEST_P(PyrLKOpticalFlowFixture, PyrLKOpticalFlow, const PyrLKOpticalFlowParams params = GetParam(); const int pointsCount = get<0>(params); + // SKIP unstable tests +#ifdef __linux__ + if (cvtest::skipUnstableTests && ocl::useOpenCL()) + { + if (ocl::Device::getDefault().isIntel()) + throw ::perf::TestBase::PerfSkipTestException(); + } +#endif + vector pts; goodFeaturesToTrack(frame0, pts, pointsCount, 0.01, 0.0); Mat ptsMat(1, static_cast(pts.size()), CV_32FC2, (void *)&pts[0]); diff --git a/modules/video/test/ocl/test_optflowpyrlk.cpp b/modules/video/test/ocl/test_optflowpyrlk.cpp index 20b0cead02..05a049fed6 100644 --- a/modules/video/test/ocl/test_optflowpyrlk.cpp +++ b/modules/video/test/ocl/test_optflowpyrlk.cpp @@ -87,6 +87,15 @@ OCL_TEST_P(PyrLKOpticalFlow, Mat) ASSERT_FALSE(frame1.empty()); UMat umatFrame1; frame1.copyTo(umatFrame1); + // SKIP unstable tests +#ifdef __linux__ + if (cvtest::skipUnstableTests && ocl::useOpenCL()) + { + if (ocl::Device::getDefault().isIntel()) + throw cvtest::SkipTestException("Skip unstable test"); + } +#endif + std::vector pts; cv::goodFeaturesToTrack(frame0, pts, npoints, 0.01, 0.0);