run_long.py 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #!/usr/bin/env python
  2. """ Utility package for run.py
  3. """
  4. from __future__ import print_function
  5. import xml.etree.ElementTree as ET
  6. from glob import glob
  7. from pprint import PrettyPrinter as PP
  8. LONG_TESTS_DEBUG_VALGRIND = [
  9. ('calib3d', 'Calib3d_InitUndistortRectifyMap.accuracy', 2017.22),
  10. ('dnn', 'Reproducibility*', 1000), # large DNN models
  11. ('dnn', '*RCNN*', 1000), # very large DNN models
  12. ('dnn', '*RFCN*', 1000), # very large DNN models
  13. ('dnn', '*EAST*', 1000), # very large DNN models
  14. ('dnn', '*VGG16*', 1000), # very large DNN models
  15. ('dnn', '*ZFNet*', 1000), # very large DNN models
  16. ('dnn', '*ResNet101_DUC_HDC*', 1000), # very large DNN models
  17. ('dnn', '*LResNet100E_IR*', 1000), # very large DNN models
  18. ('dnn', '*read_yolo_voc_stream*', 1000), # very large DNN models
  19. ('dnn', '*eccv16*', 1000), # very large DNN models
  20. ('dnn', '*OpenPose*', 1000), # very large DNN models
  21. ('dnn', '*SSD/*', 1000), # very large DNN models
  22. ('gapi', 'Fluid.MemoryConsumptionDoesNotGrowOnReshape', 1000000), # test doesn't work properly under valgrind
  23. ('face', 'CV_Face_FacemarkLBF.test_workflow', 10000.0), # >40min on i7
  24. ('features2d', 'Features2d/DescriptorImage.no_crash/3', 1000),
  25. ('features2d', 'Features2d/DescriptorImage.no_crash/4', 1000),
  26. ('features2d', 'Features2d/DescriptorImage.no_crash/5', 1000),
  27. ('features2d', 'Features2d/DescriptorImage.no_crash/6', 1000),
  28. ('features2d', 'Features2d/DescriptorImage.no_crash/7', 1000),
  29. ('imgcodecs', 'Imgcodecs_Png.write_big', 1000), # memory limit
  30. ('imgcodecs', 'Imgcodecs_Tiff.decode_tile16384x16384', 1000), # memory limit
  31. ('ml', 'ML_RTrees.regression', 1423.47),
  32. ('optflow', 'DenseOpticalFlow_DeepFlow.ReferenceAccuracy', 1360.95),
  33. ('optflow', 'DenseOpticalFlow_DeepFlow_perf.perf/0', 1881.59),
  34. ('optflow', 'DenseOpticalFlow_DeepFlow_perf.perf/1', 5608.75),
  35. ('optflow', 'DenseOpticalFlow_GlobalPatchColliderDCT.ReferenceAccuracy', 5433.84),
  36. ('optflow', 'DenseOpticalFlow_GlobalPatchColliderWHT.ReferenceAccuracy', 5232.73),
  37. ('optflow', 'DenseOpticalFlow_SimpleFlow.ReferenceAccuracy', 1542.1),
  38. ('photo', 'Photo_Denoising.speed', 1484.87),
  39. ('photo', 'Photo_DenoisingColoredMulti.regression', 2447.11),
  40. ('rgbd', 'Rgbd_Normals.compute', 1156.32),
  41. ('shape', 'Hauss.regression', 2625.72),
  42. ('shape', 'ShapeEMD_SCD.regression', 61913.7),
  43. ('shape', 'Shape_SCD.regression', 3311.46),
  44. ('tracking', 'AUKF.br_mean_squared_error', 10764.6),
  45. ('tracking', 'UKF.br_mean_squared_error', 5228.27),
  46. ('tracking', '*DistanceAndOverlap*/1', 1000.0), # dudek
  47. ('tracking', '*DistanceAndOverlap*/2', 1000.0), # faceocc2
  48. ('videoio', 'videoio/videoio_ffmpeg.write_big*', 1000),
  49. ('videoio', 'videoio_ffmpeg.parallel', 1000),
  50. ('videoio', '*videocapture_acceleration*', 1000), # valgrind can't track HW buffers: Conditional jump or move depends on uninitialised value(s)
  51. ('videoio', '*videowriter_acceleration*', 1000), # valgrind crash: set_mempolicy: Operation not permitted
  52. ('xfeatures2d', 'Features2d_RotationInvariance_Descriptor_BoostDesc_LBGM.regression', 1124.51),
  53. ('xfeatures2d', 'Features2d_RotationInvariance_Descriptor_VGG120.regression', 2198.1),
  54. ('xfeatures2d', 'Features2d_RotationInvariance_Descriptor_VGG48.regression', 1958.52),
  55. ('xfeatures2d', 'Features2d_RotationInvariance_Descriptor_VGG64.regression', 2113.12),
  56. ('xfeatures2d', 'Features2d_RotationInvariance_Descriptor_VGG80.regression', 2167.16),
  57. ('xfeatures2d', 'Features2d_ScaleInvariance_Descriptor_BoostDesc_LBGM.regression', 1511.39),
  58. ('xfeatures2d', 'Features2d_ScaleInvariance_Descriptor_VGG120.regression', 1222.07),
  59. ('xfeatures2d', 'Features2d_ScaleInvariance_Descriptor_VGG48.regression', 1059.14),
  60. ('xfeatures2d', 'Features2d_ScaleInvariance_Descriptor_VGG64.regression', 1163.41),
  61. ('xfeatures2d', 'Features2d_ScaleInvariance_Descriptor_VGG80.regression', 1179.06),
  62. ('ximgproc', 'L0SmoothTest.SplatSurfaceAccuracy', 6382.26),
  63. ('ximgproc', 'perf*/1*:perf*/2*:perf*/3*:perf*/4*:perf*/5*:perf*/6*:perf*/7*:perf*/8*:perf*/9*', 1000.0), # only first 10 parameters
  64. ('ximgproc', 'TypicalSet1/RollingGuidanceFilterTest.MultiThreadReproducibility/5', 1086.33),
  65. ('ximgproc', 'TypicalSet1/RollingGuidanceFilterTest.MultiThreadReproducibility/7', 1405.05),
  66. ('ximgproc', 'TypicalSet1/RollingGuidanceFilterTest.SplatSurfaceAccuracy/5', 1253.07),
  67. ('ximgproc', 'TypicalSet1/RollingGuidanceFilterTest.SplatSurfaceAccuracy/7', 1599.98),
  68. ('ximgproc', '*MultiThreadReproducibility*/1:*MultiThreadReproducibility*/2:*MultiThreadReproducibility*/3:*MultiThreadReproducibility*/4:*MultiThreadReproducibility*/5:*MultiThreadReproducibility*/6:*MultiThreadReproducibility*/7:*MultiThreadReproducibility*/8:*MultiThreadReproducibility*/9:*MultiThreadReproducibility*/1*', 1000.0),
  69. ('ximgproc', '*AdaptiveManifoldRefImplTest*/1:*AdaptiveManifoldRefImplTest*/2:*AdaptiveManifoldRefImplTest*/3', 1000.0),
  70. ('ximgproc', '*JointBilateralFilterTest_NaiveRef*', 1000.0),
  71. ('ximgproc', '*RollingGuidanceFilterTest_BilateralRef*/1*:*RollingGuidanceFilterTest_BilateralRef*/2*:*RollingGuidanceFilterTest_BilateralRef*/3*', 1000.0),
  72. ('ximgproc', '*JointBilateralFilterTest_NaiveRef*', 1000.0),
  73. ]
  74. def longTestFilter(data, module=None):
  75. res = ['*', '-'] + [v for m, v, _time in data if module is None or m == module]
  76. return '--gtest_filter={}'.format(':'.join(res))
  77. # Parse one xml file, filter out tests which took less than 'timeLimit' seconds
  78. # Returns tuple: ( <module_name>, [ (<module_name>, <test_name>, <test_time>), ... ] )
  79. def parseOneFile(filename, timeLimit):
  80. tree = ET.parse(filename)
  81. root = tree.getroot()
  82. def guess(s, delims):
  83. for delim in delims:
  84. tmp = s.partition(delim)
  85. if len(tmp[1]) != 0:
  86. return tmp[0]
  87. return None
  88. module = guess(filename, ['_posix_', '_nt_', '__']) or root.get('cv_module_name')
  89. if not module:
  90. return (None, None)
  91. res = []
  92. for elem in root.findall('.//testcase'):
  93. key = '{}.{}'.format(elem.get('classname'), elem.get('name'))
  94. val = elem.get('time')
  95. if float(val) >= timeLimit:
  96. res.append((module, key, float(val)))
  97. return (module, res)
  98. # Parse all xml files in current folder and combine results into one list
  99. # Print result to the stdout
  100. if __name__ == '__main__':
  101. LIMIT = 1000
  102. res = []
  103. xmls = glob('*.xml')
  104. for xml in xmls:
  105. print('Parsing file', xml, '...')
  106. module, testinfo = parseOneFile(xml, LIMIT)
  107. if not module:
  108. print('SKIP')
  109. continue
  110. res.extend(testinfo)
  111. print('========= RESULTS =========')
  112. PP(indent=4, width=100).pprint(sorted(res))