From ab92eaa04bf8ec29dced04063ba1dc626b7d5789 Mon Sep 17 00:00:00 2001 From: Julien Olivain Date: Thu, 8 Aug 2024 22:48:11 +0200 Subject: [PATCH] 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 Signed-off-by: Thomas Petazzoni --- support/testing/run-tests | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/support/testing/run-tests b/support/testing/run-tests index 485811b746..2f670c03b8 100755 --- a/support/testing/run-tests +++ b/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