From 1917d8b006df86be9c929e0a3493d62950be2a70 Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Thu, 8 Sep 2011 06:27:46 +0000 Subject: [PATCH] Fixed perf target on Windows. --- CMakeLists.txt | 2 +- modules/ts/misc/report.py | 27 +++++++++++++++++++++++---- modules/ts/misc/run.py | 14 ++++++++++---- modules/ts/misc/table_formatter.py | 2 +- 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a89d68..83db7fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1561,7 +1561,7 @@ endif() #----------------------------------- if(BUILD_PERF_TESTS AND PYTHON_EXECUTABLE) add_custom_target(perf - ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/modules/ts/misc/run.py" "${CMAKE_BINARY_DIR}" + ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/modules/ts/misc/run.py" --configuration $ "${CMAKE_BINARY_DIR}" WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/modules/ts/misc/run.py" ) diff --git a/modules/ts/misc/report.py b/modules/ts/misc/report.py index 2f6553e..ef24313 100644 --- a/modules/ts/misc/report.py +++ b/modules/ts/misc/report.py @@ -1,4 +1,4 @@ -import testlog_parser, sys, os, xml, re +import testlog_parser, sys, os, xml, re, glob from table_formatter import * from optparse import OptionParser @@ -16,12 +16,31 @@ if __name__ == "__main__": exit(0) options.generateHtml = detectHtmlOutputType(options.format) - + + # expand wildcards and filter duplicates + files = [] + files1 = [] + for arg in args: + if ("*" in arg) or ("?" in arg): + files1.extend([os.path.abspath(f) for f in glob.glob(arg)]) + else: + files.append(os.path.abspath(arg)) + seen = set() + files = [ x for x in files if x not in seen and not seen.add(x)] + files.extend((set(files1) - set(files))) + args = files + + # load test data tests = [] files = [] for arg in set(args): - files.append(os.path.basename(arg)) - tests.extend(testlog_parser.parseLogFile(arg)) + try: + cases = testlog_parser.parseLogFile(arg) + if cases: + files.append(os.path.basename(arg)) + tests.extend(cases) + except: + pass if options.filter: expr = re.compile(options.filter) diff --git a/modules/ts/misc/run.py b/modules/ts/misc/run.py index 42e56e1..c49289e 100644 --- a/modules/ts/misc/run.py +++ b/modules/ts/misc/run.py @@ -47,7 +47,7 @@ def query_yes_no(stdout, question, default="yes"): "(or 'y' or 'n').\n") class RunInfo(object): - def __init__(self, path): + def __init__(self, path, configuration = None): self.path = path self.error = None for p in parse_patterns: @@ -97,7 +97,10 @@ class RunInfo(object): # fix test path if "Visual Studio" in self.cmake_generator: - self.tests_dir = os.path.join(self.tests_dir, self.build_type) + if configuration: + self.tests_dir = os.path.join(self.tests_dir, configuration) + else: + self.tests_dir = os.path.join(self.tests_dir, self.build_type) elif not self.is_x64 and self.cxx_compiler: #one more attempt to detect x64 compiler try: @@ -209,7 +212,9 @@ class RunInfo(object): hw = str(self.hardware).replace(" ", "_") + "_" else: hw = "" - return "%s_%s_%s_%s%s%s.xml" %(app, self.targetos, self.targetarch, hw, rev, timestamp.strftime("%Y%m%dT%H%M%S")) + #stamp = timestamp.strftime("%Y%m%dT%H%M%S") + stamp = timestamp.strftime("%Y-%m-%d--%H-%M-%S") + return "%s_%s_%s_%s%s%s.xml" %(app, self.targetos, self.targetarch, hw, rev, stamp) def getTest(self, name): # full path @@ -381,6 +386,7 @@ if __name__ == "__main__": parser.add_option("-t", "--tests", dest="tests", help="comma-separated list of modules to test", metavar="SUITS", default="") parser.add_option("-w", "--cwd", dest="cwd", help="working directory for tests", metavar="PATH", default=".") parser.add_option("", "--android_test_data_path", dest="test_data_path", help="OPENCV_TEST_DATA_PATH for Android run", metavar="PATH", default="/sdcard/opencv_testdata/") + parser.add_option("", "--configuration", dest="configuration", help="force Debug or Release donfiguration", metavar="CFG", default="") (options, args) = parser.parse_args(argv) @@ -409,7 +415,7 @@ if __name__ == "__main__": logs = [] for path in run_args: - info = RunInfo(path) + info = RunInfo(path, options.configuration) #print vars(info),"\n" if not info.isRunnable(): print >> sys.stderr, "Error:", info.error diff --git a/modules/ts/misc/table_formatter.py b/modules/ts/misc/table_formatter.py index aacfe0f..276f01c 100644 --- a/modules/ts/misc/table_formatter.py +++ b/modules/ts/misc/table_formatter.py @@ -426,7 +426,7 @@ html, body {font-family: Lucida Console, Courier New, Courier;font-size: 16px;co .tbl th{color:#003399;font-size:16px;font-weight:normal;white-space:nowrap;padding:3px 10px;} .tbl td{border-bottom:1px solid #CCCCCC;color:#666699;padding:6px 8px;white-space:nowrap;} .tbl tbody tr:hover td{color:#000099;} -.tbl caption{font:italic 16px "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;padding:0 0 5px;text-align:right;} +.tbl caption{font:italic 16px "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;padding:0 0 5px;text-align:right;white-space:normal;} -- 2.7.4