mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
ts: test tags for flexible/reliable tests filtering
- added functionality to collect memory usage of OpenCL sybsystem - memory usage of fastMalloc() (disabled by default): * It is not accurate sometimes - external memory profiler is required. - specify common `CV_TEST_TAG_` macros - added applyTestTag() function - write memory usage / enabled tags into Google Tests output file (.xml)
This commit is contained in:
committed by
Alexander Alekhin
parent
dad2247b56
commit
b38de57f9a
@@ -51,6 +51,44 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// most part of OpenCV tests are fit into 200Mb limit, but some tests are not:
|
||||
// Note: due memory fragmentation real limits are usually lower on 20-25% (400Mb memory usage goes into mem_1Gb class)
|
||||
#define CV_TEST_TAG_MEMORY_512MB "mem_512mb" // used memory: 200..512Mb - enabled by default
|
||||
#define CV_TEST_TAG_MEMORY_1GB "mem_1gb" // used memory: 512Mb..1Gb - enabled by default
|
||||
#define CV_TEST_TAG_MEMORY_2GB "mem_2gb" // used memory: 1..2Gb - enabled by default on 64-bit configuration (32-bit - disabled)
|
||||
#define CV_TEST_TAG_MEMORY_6GB "mem_6gb" // used memory: 2..6Gb - disabled by default
|
||||
#define CV_TEST_TAG_MEMORY_14GB "mem_14gb" // used memory: 6..14Gb - disabled by default
|
||||
|
||||
// Large / huge video streams or complex workloads
|
||||
#define CV_TEST_TAG_LONG "long" // 5+ seconds on modern desktop machine (single thread)
|
||||
#define CV_TEST_TAG_VERYLONG "verylong" // 20+ seconds on modern desktop machine (single thread)
|
||||
|
||||
// Large / huge video streams or complex workloads for debug builds
|
||||
#define CV_TEST_TAG_DEBUG_LONG "debug_long" // 10+ seconds on modern desktop machine (single thread)
|
||||
#define CV_TEST_TAG_DEBUG_VERYLONG "debug_verylong" // 40+ seconds on modern desktop machine (single thread)
|
||||
|
||||
// Lets skip processing of high resolution images via instrumentation tools (valgrind/coverage/sanitizers).
|
||||
// It is enough to run lower resolution (VGA: 640x480) tests.
|
||||
#define CV_TEST_TAG_SIZE_HD "size_hd" // 720p+, enabled
|
||||
#define CV_TEST_TAG_SIZE_FULLHD "size_fullhd" // 1080p+, enabled (disable these tests for valgrind/coverage run)
|
||||
#define CV_TEST_TAG_SIZE_4K "size_4k" // 2160p+, enabled (disable these tests for valgrind/coverage run)
|
||||
|
||||
// Other misc test tags
|
||||
#define CV_TEST_TAG_TYPE_64F "type_64f" // CV_64F, enabled (disable these tests on low power embedded devices)
|
||||
|
||||
// Kernel-based image processing
|
||||
#define CV_TEST_TAG_FILTER_SMALL "filter_small" // Filtering with kernels <= 3x3
|
||||
#define CV_TEST_TAG_FILTER_MEDIUM "filter_medium" // Filtering with kernels: 3x3 < kernel <= 5x5
|
||||
#define CV_TEST_TAG_FILTER_LARGE "filter_large" // Filtering with kernels: 5x5 < kernel <= 9x9
|
||||
#define CV_TEST_TAG_FILTER_HUGE "filter_huge" // Filtering with kernels: > 9x9
|
||||
|
||||
// Other tests categories
|
||||
#define CV_TEST_TAG_OPENCL "opencl" // Tests with OpenCL
|
||||
|
||||
|
||||
|
||||
#ifdef WINRT
|
||||
#pragma warning(disable:4447) // Disable warning 'main' signature found without threading model
|
||||
#endif
|
||||
@@ -150,6 +188,30 @@ public:
|
||||
SkipTestException(const cv::String& message) : dummy(0) { this->msg = message; }
|
||||
};
|
||||
|
||||
/** Apply tag to the current test
|
||||
|
||||
Automatically apply corresponding additional tags (for example, 4K => FHD => HD => VGA).
|
||||
|
||||
If tag is in skip list, then SkipTestException is thrown
|
||||
*/
|
||||
void applyTestTag(const std::string& tag);
|
||||
|
||||
/** Run postponed checks of applied test tags
|
||||
|
||||
If tag is in skip list, then SkipTestException is thrown
|
||||
*/
|
||||
void checkTestTags();
|
||||
|
||||
void applyTestTag_(const std::string& tag);
|
||||
|
||||
static inline void applyTestTag(const std::string& tag1, const std::string& tag2)
|
||||
{ applyTestTag_(tag1); applyTestTag_(tag2); checkTestTags(); }
|
||||
static inline void applyTestTag(const std::string& tag1, const std::string& tag2, const std::string& tag3)
|
||||
{ applyTestTag_(tag1); applyTestTag_(tag2); applyTestTag_(tag3); checkTestTags(); }
|
||||
static inline void applyTestTag(const std::string& tag1, const std::string& tag2, const std::string& tag3, const std::string& tag4)
|
||||
{ applyTestTag_(tag1); applyTestTag_(tag2); applyTestTag_(tag3); applyTestTag_(tag4); checkTestTags(); }
|
||||
|
||||
|
||||
class TS;
|
||||
|
||||
int64 readSeed(const char* str);
|
||||
|
||||
@@ -13,6 +13,9 @@ void checkIppStatus();
|
||||
extern bool skipUnstableTests;
|
||||
extern bool runBigDataTests;
|
||||
extern int testThreads;
|
||||
|
||||
void testSetUp();
|
||||
void testTearDown();
|
||||
}
|
||||
|
||||
// check for required "opencv_test" namespace
|
||||
@@ -24,10 +27,8 @@ extern int testThreads;
|
||||
|
||||
#define CV__TEST_INIT \
|
||||
CV__TEST_NAMESPACE_CHECK \
|
||||
cv::ipp::setIppStatus(0); \
|
||||
cv::theRNG().state = cvtest::param_seed; \
|
||||
cv::setNumThreads(cvtest::testThreads);
|
||||
#define CV__TEST_CLEANUP ::cvtest::checkIppStatus();
|
||||
::cvtest::testSetUp();
|
||||
#define CV__TEST_CLEANUP ::cvtest::testTearDown();
|
||||
#define CV__TEST_BODY_IMPL(name) \
|
||||
{ \
|
||||
CV__TRACE_APP_FUNCTION_NAME(name); \
|
||||
|
||||
@@ -527,7 +527,15 @@ void PrintTo(const Size& sz, ::std::ostream* os);
|
||||
{ \
|
||||
CV__TEST_NAMESPACE_CHECK \
|
||||
CV__TRACE_APP_FUNCTION_NAME("PERF_TEST: " name); \
|
||||
try { \
|
||||
::cvtest::testSetUp(); \
|
||||
RunPerfTestBody(); \
|
||||
} \
|
||||
catch (cvtest::SkipTestException& e) \
|
||||
{ \
|
||||
printf("[ SKIP ] %s\n", e.what()); \
|
||||
} \
|
||||
::cvtest::testTearDown(); \
|
||||
}
|
||||
|
||||
#define PERF_PROXY_NAMESPACE_NAME_(test_case_name, test_name) \
|
||||
|
||||
Reference in New Issue
Block a user