run.py: issues with forced configuration fixed
This commit is contained in:
parent
97878645bc
commit
7df392bfd8
@ -31,7 +31,7 @@ if __name__ == "__main__":
|
|||||||
parser.add_argument("--list", action="store_true", default=False, help="List available tests (executables)")
|
parser.add_argument("--list", action="store_true", default=False, help="List available tests (executables)")
|
||||||
parser.add_argument("--list_short", action="store_true", default=False, help="List available tests (aliases)")
|
parser.add_argument("--list_short", action="store_true", default=False, help="List available tests (aliases)")
|
||||||
parser.add_argument("--list_short_main", action="store_true", default=False, help="List available tests (main repository, aliases)")
|
parser.add_argument("--list_short_main", action="store_true", default=False, help="List available tests (main repository, aliases)")
|
||||||
parser.add_argument("--configuration", metavar="CFG", default="", help="Visual Studio: force Debug or Release configuration")
|
parser.add_argument("--configuration", metavar="CFG", default=None, help="Force Debug or Release configuration (for Visual Studio and Java tests build)")
|
||||||
parser.add_argument("-n", "--dry_run", action="store_true", help="Do not run the tests")
|
parser.add_argument("-n", "--dry_run", action="store_true", help="Do not run the tests")
|
||||||
parser.add_argument("-v", "--verbose", action="store_true", default=False, help="Print more debug information")
|
parser.add_argument("-v", "--verbose", action="store_true", default=False, help="Print more debug information")
|
||||||
|
|
||||||
@ -95,12 +95,12 @@ if __name__ == "__main__":
|
|||||||
try:
|
try:
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
raise Err("Not a directory (should contain CMakeCache.txt ot test executables)")
|
raise Err("Not a directory (should contain CMakeCache.txt ot test executables)")
|
||||||
cache = CMakeCache()
|
cache = CMakeCache(args.configuration)
|
||||||
fname = os.path.join(path, "CMakeCache.txt")
|
fname = os.path.join(path, "CMakeCache.txt")
|
||||||
|
|
||||||
if os.path.isfile(fname):
|
if os.path.isfile(fname):
|
||||||
log.debug("Reading cmake cache file: %s", fname)
|
log.debug("Reading cmake cache file: %s", fname)
|
||||||
cache.read(path, fname, args.configuration)
|
cache.read(path, fname)
|
||||||
else:
|
else:
|
||||||
log.debug("Assuming folder contains tests: %s", path)
|
log.debug("Assuming folder contains tests: %s", path)
|
||||||
cache.setDummy(path)
|
cache.setDummy(path)
|
||||||
|
@ -66,7 +66,9 @@ class TestSuite(object):
|
|||||||
res.append(fname) # filename (opencv_test_core.exe)
|
res.append(fname) # filename (opencv_test_core.exe)
|
||||||
for s in getCuts(fname, self.nameprefix):
|
for s in getCuts(fname, self.nameprefix):
|
||||||
res.append(s)
|
res.append(s)
|
||||||
res.append(re.sub(r"d$", '', s)) # MSVC debug config, remove 'd' suffix
|
if self.cache.build_type == "Debug":
|
||||||
|
res.append(re.sub(r"d$", '', s)) # MSVC debug config, remove 'd' suffix
|
||||||
|
log.debug("Aliases: %s", set(res))
|
||||||
return set(res)
|
return set(res)
|
||||||
|
|
||||||
def getTest(self, name):
|
def getTest(self, name):
|
||||||
@ -104,10 +106,7 @@ class TestSuite(object):
|
|||||||
args = args[:]
|
args = args[:]
|
||||||
exe = os.path.abspath(path)
|
exe = os.path.abspath(path)
|
||||||
if path == "java":
|
if path == "java":
|
||||||
cfg = self.cache.build_type
|
cmd = [self.cache.ant_executable, "-Dopencv.build.type=%s" % self.cache.build_type, "buildAndTest"]
|
||||||
if self.options.configuration:
|
|
||||||
cfg = self.options.configuration
|
|
||||||
cmd = [self.cache.ant_executable, "-Dopencv.build.type=%s" % cfg, "buildAndTest"]
|
|
||||||
ret = execute(cmd, cwd = self.cache.java_test_binary_dir + "/.build")
|
ret = execute(cmd, cwd = self.cache.java_test_binary_dir + "/.build")
|
||||||
return None, ret
|
return None, ret
|
||||||
else:
|
else:
|
||||||
|
@ -174,17 +174,19 @@ parse_patterns = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
class CMakeCache:
|
class CMakeCache:
|
||||||
def __init__(self):
|
def __init__(self, cfg = None):
|
||||||
self.setDefaultAttrs()
|
self.setDefaultAttrs()
|
||||||
self.cmake_home_vcver = None
|
self.cmake_home_vcver = None
|
||||||
self.opencv_home_vcver = None
|
self.opencv_home_vcver = None
|
||||||
self.featuresSIMD = None
|
self.featuresSIMD = None
|
||||||
self.main_modules = []
|
self.main_modules = []
|
||||||
|
if cfg:
|
||||||
|
self.build_type = cfg
|
||||||
|
|
||||||
def setDummy(self, path):
|
def setDummy(self, path):
|
||||||
self.tests_dir = os.path.normpath(path)
|
self.tests_dir = os.path.normpath(path)
|
||||||
|
|
||||||
def read(self, path, fname, cfg):
|
def read(self, path, fname):
|
||||||
rx = re.compile(r'^opencv_(\w+)_SOURCE_DIR:STATIC=(.*)$')
|
rx = re.compile(r'^opencv_(\w+)_SOURCE_DIR:STATIC=(.*)$')
|
||||||
module_paths = {} # name -> path
|
module_paths = {} # name -> path
|
||||||
with open(fname, "rt") as cachefile:
|
with open(fname, "rt") as cachefile:
|
||||||
@ -213,10 +215,7 @@ class CMakeCache:
|
|||||||
|
|
||||||
# fix VS test binary path (add Debug or Release)
|
# fix VS test binary path (add Debug or Release)
|
||||||
if "Visual Studio" in self.cmake_generator:
|
if "Visual Studio" in self.cmake_generator:
|
||||||
if cfg:
|
self.tests_dir = os.path.join(self.tests_dir, self.build_type)
|
||||||
self.tests_dir = os.path.join(self.tests_dir, cfg)
|
|
||||||
else:
|
|
||||||
self.tests_dir = os.path.join(self.tests_dir, self.build_type)
|
|
||||||
|
|
||||||
self.cmake_home_vcver = readGitVersion(self.git_executable, self.cmake_home)
|
self.cmake_home_vcver = readGitVersion(self.git_executable, self.cmake_home)
|
||||||
if self.opencv_home == self.cmake_home:
|
if self.opencv_home == self.cmake_home:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user