Merge pull request #21267 from mshabunin:fix-kw-2021-12
[platform/upstream/opencv.git] / modules / ts / misc / run_suite.py
index 2eaeae1..2f38223 100644 (file)
@@ -1,6 +1,7 @@
 #!/usr/bin/env python
 import os
 import re
+import sys
 from run_utils import Err, log, execute, getPlatformVersion, isColorEnabled, TempEnvDir
 from run_long import LONG_TESTS_DEBUG_VALGRIND, longTestFilter
 
@@ -111,11 +112,18 @@ class TestSuite(object):
         args = args[:]
         exe = os.path.abspath(path)
         if module == "java":
-            cmd = [self.cache.ant_executable, "-Dopencv.build.type=%s" % self.cache.build_type, "buildAndTest"]
+            cmd = [self.cache.ant_executable, "-Dopencv.build.type=%s" % self.cache.build_type]
+            if self.options.package:
+                cmd += ["-Dopencv.test.package=%s" % self.options.package]
+            if self.options.java_test_exclude:
+                cmd += ["-Dopencv.test.exclude=%s" % self.options.java_test_exclude]
+            cmd += ["buildAndTest"]
             ret = execute(cmd, cwd=self.cache.java_test_dir)
             return None, ret
         elif module in ['python2', 'python3']:
             executable = os.getenv('OPENCV_PYTHON_BINARY', None)
+            if executable is None or module == 'python{}'.format(sys.version_info[0]):
+                executable = sys.executable
             if executable is None:
                 executable = path
                 if not self.tryCommand([executable, '--version'], workingDir):