Skip to content

Commit 059c2a8

Browse files
committed
Merge pull request opencv#7856 from mshabunin:long-tests
2 parents daa9702 + f5bf1e5 commit 059c2a8

File tree

2 files changed

+94
-1
lines changed

2 files changed

+94
-1
lines changed

modules/ts/misc/run_long.py

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/usr/bin/env python
2+
3+
from __future__ import print_function
4+
import xml.etree.ElementTree as ET
5+
from glob import glob
6+
from pprint import PrettyPrinter as PP
7+
8+
LONG_TESTS_DEBUG_VALGRIND = [
9+
('calib3d', 'Calib3d_InitUndistortRectifyMap.accuracy', 2017.22),
10+
('features2d', 'Features2d_Feature2d.no_crash', 1235.68),
11+
('ml', 'ML_RTrees.regression', 1423.47),
12+
('optflow', 'DenseOpticalFlow_DeepFlow.ReferenceAccuracy', 1360.95),
13+
('optflow', 'DenseOpticalFlow_DeepFlow_perf.perf/0', 1881.59),
14+
('optflow', 'DenseOpticalFlow_DeepFlow_perf.perf/1', 5608.75),
15+
('optflow', 'DenseOpticalFlow_GlobalPatchColliderDCT.ReferenceAccuracy', 5433.84),
16+
('optflow', 'DenseOpticalFlow_GlobalPatchColliderWHT.ReferenceAccuracy', 5232.73),
17+
('optflow', 'DenseOpticalFlow_SimpleFlow.ReferenceAccuracy', 1542.1),
18+
('photo', 'Photo_Denoising.speed', 1484.87),
19+
('photo', 'Photo_DenoisingColoredMulti.regression', 2447.11),
20+
('rgbd', 'Rgbd_Normals.compute', 1156.32),
21+
('shape', 'Hauss.regression', 2625.72),
22+
('shape', 'ShapeEMD_SCD.regression', 61913.7),
23+
('shape', 'Shape_SCD.regression', 3311.46),
24+
('tracking', 'AUKF.br_mean_squared_error', 10764.6),
25+
('tracking', 'UKF.br_mean_squared_error', 5228.27),
26+
('xfeatures2d', 'Features2d_RotationInvariance_Descriptor_BoostDesc_LBGM.regression', 1124.51),
27+
('xfeatures2d', 'Features2d_RotationInvariance_Descriptor_VGG120.regression', 2198.1),
28+
('xfeatures2d', 'Features2d_RotationInvariance_Descriptor_VGG48.regression', 1958.52),
29+
('xfeatures2d', 'Features2d_RotationInvariance_Descriptor_VGG64.regression', 2113.12),
30+
('xfeatures2d', 'Features2d_RotationInvariance_Descriptor_VGG80.regression', 2167.16),
31+
('xfeatures2d', 'Features2d_ScaleInvariance_Descriptor_BoostDesc_LBGM.regression', 1511.39),
32+
('xfeatures2d', 'Features2d_ScaleInvariance_Descriptor_VGG120.regression', 1222.07),
33+
('xfeatures2d', 'Features2d_ScaleInvariance_Descriptor_VGG48.regression', 1059.14),
34+
('xfeatures2d', 'Features2d_ScaleInvariance_Descriptor_VGG64.regression', 1163.41),
35+
('xfeatures2d', 'Features2d_ScaleInvariance_Descriptor_VGG80.regression', 1179.06),
36+
('ximgproc', 'L0SmoothTest.SplatSurfaceAccuracy', 6382.26),
37+
('ximgproc', 'L0SmoothTest_perf.perf/17', 2052.16),
38+
('ximgproc', 'RollingGuidanceFilterTest_perf.perf/59', 2760.29),
39+
('ximgproc', 'TypicalSet1/RollingGuidanceFilterTest.MultiThreadReproducibility/5', 1086.33),
40+
('ximgproc', 'TypicalSet1/RollingGuidanceFilterTest.MultiThreadReproducibility/7', 1405.05),
41+
('ximgproc', 'TypicalSet1/RollingGuidanceFilterTest.SplatSurfaceAccuracy/5', 1253.07),
42+
('ximgproc', 'TypicalSet1/RollingGuidanceFilterTest.SplatSurfaceAccuracy/7', 1599.98),
43+
]
44+
45+
46+
def longTestFilter(data):
47+
res = ['*', '-']
48+
for _, v, _ in data:
49+
res.append(v)
50+
return '--gtest_filter={}'.format(':'.join(res))
51+
52+
53+
# Parse one xml file, filter out tests which took less than 'timeLimit' seconds
54+
# Returns tuple: ( <module_name>, [ (<module_name>, <test_name>, <test_time>), ... ] )
55+
def parseOneFile(filename, timeLimit):
56+
tree = ET.parse(filename)
57+
root = tree.getroot()
58+
59+
def guess(s, delims):
60+
for delim in delims:
61+
tmp = s.partition(delim)
62+
if len(tmp[1]) != 0:
63+
return tmp[0]
64+
return None
65+
module = guess(filename, ['_posix_', '_nt_', '__']) or root.get('cv_module_name')
66+
if not module:
67+
return (None, None)
68+
res = []
69+
for elem in root.findall('.//testcase'):
70+
key = '{}.{}'.format(elem.get('classname'), elem.get('name'))
71+
val = elem.get('time')
72+
if float(val) >= timeLimit:
73+
res.append((module, key, float(val)))
74+
return (module, res)
75+
76+
77+
# Parse all xml files in current folder and combine results into one list
78+
# Print result to the stdout
79+
if __name__ == '__main__':
80+
LIMIT = 1000
81+
res = []
82+
xmls = glob('*.xml')
83+
for xml in xmls:
84+
print('Parsing file', xml, '...')
85+
module, testinfo = parseOneFile(xml, LIMIT)
86+
if not module:
87+
print('SKIP')
88+
continue
89+
res.extend(testinfo)
90+
91+
print('========= RESULTS =========')
92+
PP(indent=4, width=100).pprint(sorted(res))

modules/ts/misc/run_suite.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import datetime
44
from run_utils import *
5+
from run_long import LONG_TESTS_DEBUG_VALGRIND, longTestFilter
56

67
class TestSuite(object):
78
def __init__(self, options, cache):
@@ -99,7 +100,7 @@ def wrapInValgrind(self, cmd = []):
99100
if self.options.valgrind_supp:
100101
res.append("--suppressions=%s" % self.options.valgrind_supp)
101102
res.extend(self.options.valgrind_opt)
102-
return res + cmd
103+
return res + cmd + [longTestFilter(LONG_TESTS_DEBUG_VALGRIND)]
103104
return cmd
104105

105106
def tryCommand(self, cmd):

0 commit comments

Comments
 (0)