From b48c3cd3e3debf604ffafb6e932686ed70bff322 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 17 Aug 2023 16:27:39 -0400 Subject: [PATCH] twister: do not attempt to parse empty file Do not attemp to parse empty file, just skip them. Fixes #60835 Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/testsuite.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/pylib/twister/twisterlib/testsuite.py b/scripts/pylib/twister/twisterlib/testsuite.py index dc29c352f4a..3f4a71e4a8c 100644 --- a/scripts/pylib/twister/twisterlib/testsuite.py +++ b/scripts/pylib/twister/twisterlib/testsuite.py @@ -266,6 +266,8 @@ def scan_testsuite_path(testsuite_path): src_dir_path = _find_src_dir_path(testsuite_path) for filename in glob.glob(os.path.join(src_dir_path, "*.c*")): + if os.stat(filename).st_size == 0: + continue try: result: ScanPathResult = scan_file(filename) if result.warnings: @@ -284,7 +286,7 @@ def scan_testsuite_path(testsuite_path): ztest_suite_names += result.ztest_suite_names except ValueError as e: - logger.error("%s: can't find: %s" % (filename, e)) + logger.error("%s: error parsing source file: %s" % (filename, e)) for filename in glob.glob(os.path.join(testsuite_path, "*.c*")): try: