Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kunit: tool: Parse skipped tests from kselftest.h

Skipped tests reported by kselftest.h use a different format than KTAP,
there is no explicit test name. Normally the test name is part of the
free-form string after the SKIP keyword:

ok 3 # SKIP test: some reason

Extend the parser to handle those correctly. Use the free-form string as
test name instead.

Link: https://lore.kernel.org/r/20250813-kunit-kselftesth-skip-v1-1-57ae3de4f109@linutronix.de
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Thomas Weißschuh and committed by
Shuah Khan
bd80c4d6 29128da2

+7 -4
+5 -3
tools/testing/kunit/kunit_parser.py
··· 352 352 lines.pop() 353 353 return True 354 354 355 - TEST_RESULT = re.compile(r'^\s*(ok|not ok) ([0-9]+) (- )?([^#]*)( # .*)?$') 355 + TEST_RESULT = re.compile(r'^\s*(ok|not ok) ([0-9]+) ?(- )?([^#]*)( # .*)?$') 356 356 357 - TEST_RESULT_SKIP = re.compile(r'^\s*(ok|not ok) ([0-9]+) (- )?(.*) # SKIP(.*)$') 357 + TEST_RESULT_SKIP = re.compile(r'^\s*(ok|not ok) ([0-9]+) ?(- )?(.*) # SKIP ?(.*)$') 358 358 359 359 def peek_test_name_match(lines: LineStream, test: Test) -> bool: 360 360 """ ··· 379 379 if not match: 380 380 return False 381 381 name = match.group(4) 382 + if not name: 383 + return False 382 384 return name == test.name 383 385 384 386 def parse_test_result(lines: LineStream, test: Test, ··· 418 416 419 417 # Set name of test object 420 418 if skip_match: 421 - test.name = skip_match.group(4) 419 + test.name = skip_match.group(4) or skip_match.group(5) 422 420 else: 423 421 test.name = match.group(4) 424 422
+2 -1
tools/testing/kunit/test_data/test_is_test_passed-kselftest.log
··· 1 1 TAP version 13 2 - 1..2 2 + 1..3 3 3 # selftests: membarrier: membarrier_test_single_thread 4 4 # TAP version 13 5 5 # 1..2 ··· 12 12 # ok 1 sys_membarrier available 13 13 # ok 2 sys membarrier invalid command test: command = -1, flags = 0, errno = 22. Failed as expected 14 14 ok 2 selftests: membarrier: membarrier_test_multi_thread 15 + ok 3 # SKIP selftests: membarrier: membarrier_test_multi_thread