diff mbox series

[2/7] dtoc: Tidy up fdt_tests RunTests()

Message ID 20220731025711.871999-3-sjg@chromium.org
State Accepted
Commit b26dd9648c48d41c1486a623012363167c7a5fc7
Delegated to: Simon Glass
Headers show
Series fdt: Fix up tests and build warnings on newer distros | expand

Commit Message

Simon Glass July 31, 2022, 2:57 a.m. UTC
Pass the options args in rather than using the global variables. Use snake
case, fix up comments and use a ternary operator to make pylint happy.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/dtoc/test_fdt.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Simon Glass Aug. 7, 2022, 1:10 p.m. UTC | #1
Pass the options args in rather than using the global variables. Use snake
case, fix up comments and use a ternary operator to make pylint happy.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/dtoc/test_fdt.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index ec257552efc..b48819831d6 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -778,17 +778,20 @@  def run_test_coverage(build_dir):
             ['tools/patman/*.py', '*test_fdt.py'], build_dir)
 
 
-def RunTests(args):
+def run_tests(args, processes):
     """Run all the test we have for the fdt model
 
     Args:
-        args: List of positional args provided to fdt. This can hold a test
-            name to execute (as in 'fdt -t testFdt', for example)
+        args (list or str): List of positional args provided. This can hold a
+            test name to execute (as in 'test_fdt -t testFdt', for example)
+        processes (int): Number of processes to use (None means as many as there
+            are CPUs on the system. This must be set to 1 when running under
+            the python3-coverage tool
 
     Returns:
-        Return code, 0 on success
+        int: Return code, 0 on success
     """
-    test_name = args and args[0] or None
+    test_name = args[0] if args else None
     result = test_util.run_test_suites(
         'test_fdt', False, False, False, None, test_name, None,
         [TestFdt, TestNode, TestProp, TestFdtUtil])
@@ -812,7 +815,7 @@  parser.add_option('-T', '--test-coverage', action='store_true',
 
 # Run our meagre tests
 if options.test:
-    ret_code = RunTests(args)
+    ret_code = run_tests(args, options.processes)
     sys.exit(ret_code)
 elif options.test_coverage:
     run_test_coverage(options.build_dir)