Merge pull request #12383 from alalek:ts_qemu_support

This commit is contained in:
Alexander Alekhin 2018-09-04 15:15:39 +00:00
commit 71c8de8fa1
3 changed files with 13 additions and 4 deletions

View File

@ -40,6 +40,9 @@ if __name__ == "__main__":
parser.add_argument("--valgrind_supp", metavar="FILE", action='append', help="Path to valgrind suppression file (example: --valgrind_supp opencv/platforms/scripts/valgrind.supp)") parser.add_argument("--valgrind_supp", metavar="FILE", action='append', help="Path to valgrind suppression file (example: --valgrind_supp opencv/platforms/scripts/valgrind.supp)")
parser.add_argument("--valgrind_opt", metavar="OPT", action="append", default=[], help="Add command line option to valgrind (example: --valgrind_opt=--leak-check=full)") parser.add_argument("--valgrind_opt", metavar="OPT", action="append", default=[], help="Add command line option to valgrind (example: --valgrind_opt=--leak-check=full)")
# QEMU
parser.add_argument("--qemu", default="", help="Specify qemu binary and base parameters")
# Android # Android
parser.add_argument("--android", action="store_true", default=False, help="Android: force all tests to run on device") parser.add_argument("--android", action="store_true", default=False, help="Android: force all tests to run on device")
parser.add_argument("--android_sdk", metavar="PATH", help="Android: path to SDK to use adb and aapt tools") parser.add_argument("--android_sdk", metavar="PATH", help="Android: path to SDK to use adb and aapt tools")

View File

@ -77,7 +77,7 @@ class TestSuite(object):
return False return False
return os.access(fullpath, os.X_OK) return os.access(fullpath, os.X_OK)
def wrapInValgrind(self, cmd=[]): def wrapCommand(self, cmd, env):
if self.options.valgrind: if self.options.valgrind:
res = ['valgrind'] res = ['valgrind']
supp = self.options.valgrind_supp or [] supp = self.options.valgrind_supp or []
@ -89,6 +89,14 @@ class TestSuite(object):
res.extend(self.options.valgrind_opt) res.extend(self.options.valgrind_opt)
has_gtest_filter = next((True for x in cmd if x.startswith('--gtest_filter=')), False) has_gtest_filter = next((True for x in cmd if x.startswith('--gtest_filter=')), False)
return res + cmd + ([longTestFilter(LONG_TESTS_DEBUG_VALGRIND)] if not has_gtest_filter else []) return res + cmd + ([longTestFilter(LONG_TESTS_DEBUG_VALGRIND)] if not has_gtest_filter else [])
elif self.options.qemu:
import shlex
res = shlex.split(self.options.qemu)
for (name, value) in [entry for entry in os.environ.items() if entry[0].startswith('OPENCV') and not entry[0] in env]:
res += ['-E', '"{}={}"'.format(name, value)]
for (name, value) in env.items():
res += ['-E', '"{}={}"'.format(name, value)]
return res + ['--'] + cmd
return cmd return cmd
def tryCommand(self, cmd, workingDir): def tryCommand(self, cmd, workingDir):
@ -125,7 +133,6 @@ class TestSuite(object):
else: else:
if isColorEnabled(args): if isColorEnabled(args):
args.append("--gtest_color=yes") args.append("--gtest_color=yes")
cmd = self.wrapInValgrind([exe] + args)
env = {} env = {}
if not self.options.valgrind and self.options.trace: if not self.options.valgrind and self.options.trace:
env['OPENCV_TRACE'] = '1' env['OPENCV_TRACE'] = '1'
@ -133,6 +140,7 @@ class TestSuite(object):
env['OPENCV_TRACE_SYNC_OPENCL'] = '1' env['OPENCV_TRACE_SYNC_OPENCL'] = '1'
tempDir = TempEnvDir('OPENCV_TEMP_PATH', "__opencv_temp.") tempDir = TempEnvDir('OPENCV_TEMP_PATH', "__opencv_temp.")
tempDir.init() tempDir.init()
cmd = self.wrapCommand([exe] + args, env)
log.warning("Run: %s" % " ".join(cmd)) log.warning("Run: %s" % " ".join(cmd))
ret = execute(cmd, cwd=workingDir, env=env) ret = execute(cmd, cwd=workingDir, env=env)
try: try:

View File

@ -56,8 +56,6 @@ else()
endmacro() endmacro()
endif() # IN_TRY_COMPILE endif() # IN_TRY_COMPILE
set(CMAKE_SKIP_RPATH TRUE)
if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY) if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
endif() endif()