瀏覽代碼

support/testing/run-tests: add a nose2 debug option

This commit adds the -D/--debug command line options to the
support/testing/run-tests script.

Using one of those options will pass "--log-level debug" to the
nose2 invocations. This can be useful to debug nose2 internal
behaviors. See:
https://github.com/nose-devs/nose2/blob/0.15.1/nose2/main.py#L209

For example, calling:

    support/testing/run-tests --list --debug

will output:

    List of tests
    DEBUG:nose2.main:logging initialized debug
    ...

Signed-off-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Julien Olivain 1 年之前
父節點
當前提交
ab92eaa04b
共有 1 個文件被更改,包括 14 次插入4 次删除
  1. 14 4
      support/testing/run-tests

+ 14 - 4
support/testing/run-tests

@@ -36,6 +36,8 @@ def main():
                         help='BR2_JLEVEL to use for each testcase')
     parser.add_argument('--timeout-multiplier', type=int, default=1,
                         help='increase timeouts (useful for slow machines)')
+    parser.add_argument('-D', '--debug', action='store_true',
+                        help='enable debug log')
 
     args = parser.parse_args()
 
@@ -47,10 +49,15 @@ def main():
 
     if args.list:
         print("List of tests")
-        nose2.discover(argv=[script_path,
-                             "-s", test_dir,
-                             "-v",
-                             "--collect-only"],
+        nose2_args = [
+            script_path,
+            "-s", test_dir,
+            "-v",
+            "--collect-only"
+        ]
+        if args.debug:
+            nose2_args += ["--log-level", "debug"]
+        nose2.discover(argv=nose2_args,
                        plugins=["nose2.plugins.collect"])
         return 0
 
@@ -125,6 +132,9 @@ def main():
                   "-s", test_dir,
                   "-c", os.path.join(test_dir, "conf/unittest.cfg")]
 
+    if args.debug:
+        nose2_args += ["--log-level", "debug"]
+
     if args.testname:
         nose2_args += args.testname