binman: Re-enable concurrent tests
[platform/kernel/u-boot.git] / tools / patman / test_util.py
index 0827488..4e26175 100644 (file)
@@ -16,12 +16,14 @@ from io import StringIO
 
 use_concurrent = True
 try:
-    from concurrencytest import ConcurrentTestSuite, fork_for_tests
+    from concurrencytest.concurrencytest import ConcurrentTestSuite
+    from concurrencytest.concurrencytest import fork_for_tests
 except:
     use_concurrent = False
 
 
-def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None):
+def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None,
+                    extra_args=None):
     """Run tests and check that we get 100% coverage
 
     Args:
@@ -34,6 +36,8 @@ def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None):
             calculation
         build_dir: Build directory, used to locate libfdt.py
         required: List of modules which must be in the coverage report
+        extra_args (str): Extra arguments to pass to the tool before the -t/test
+            arg
 
     Raises:
         ValueError if the code coverage is not 100%
@@ -47,13 +51,14 @@ def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None):
         glob_list = []
     glob_list += exclude_list
     glob_list += ['*libfdt.py', '*site-packages*', '*dist-packages*']
-    test_cmd = 'test' if 'binman' in prog else '-t'
+    glob_list += ['*concurrencytest*']
+    test_cmd = 'test' if 'binman' in prog or 'patman' in prog else '-t'
     prefix = ''
     if build_dir:
         prefix = 'PYTHONPATH=$PYTHONPATH:%s/sandbox_spl/tools ' % build_dir
     cmd = ('%spython3-coverage run '
-           '--omit "%s" %s %s -P1' % (prefix, ','.join(glob_list),
-                                      prog, test_cmd))
+           '--omit "%s" %s %s %s -P1' % (prefix, ','.join(glob_list),
+                                         prog, extra_args or '', test_cmd))
     os.system(cmd)
     stdout = command.Output('python3-coverage', 'report')
     lines = stdout.splitlines()