Merge tag 'linux-kselftest-kunit-fixes-5.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull kunit fixes from Shuah Khan "Fixes for build and run-times failures. Also includes troubleshooting tips updates to kunit user documentation" * tag 'linux-kselftest-kunit-fixes-5.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: Documentation: kunit: Add some troubleshooting tips to the FAQ kunit: kunit_tool: Fix invalid result when build fails kunit: show error if kunit results are not present kunit: kunit_config: Fix parsing of CONFIG options with space
This commit is contained in:
@@ -82,7 +82,9 @@ def build_tests(linux: kunit_kernel.LinuxSourceTree,
|
||||
request.make_options)
|
||||
build_end = time.time()
|
||||
if not success:
|
||||
return KunitResult(KunitStatus.BUILD_FAILURE, 'could not build kernel')
|
||||
return KunitResult(KunitStatus.BUILD_FAILURE,
|
||||
'could not build kernel',
|
||||
build_end - build_start)
|
||||
if not success:
|
||||
return KunitResult(KunitStatus.BUILD_FAILURE,
|
||||
'could not build kernel',
|
||||
|
@@ -10,7 +10,7 @@ import collections
|
||||
import re
|
||||
|
||||
CONFIG_IS_NOT_SET_PATTERN = r'^# CONFIG_(\w+) is not set$'
|
||||
CONFIG_PATTERN = r'^CONFIG_(\w+)=(\S+)$'
|
||||
CONFIG_PATTERN = r'^CONFIG_(\w+)=(\S+|".*")$'
|
||||
|
||||
KconfigEntryBase = collections.namedtuple('KconfigEntry', ['name', 'value'])
|
||||
|
||||
|
@@ -265,11 +265,9 @@ def bubble_up_suite_errors(test_suite_list: List[TestSuite]) -> TestStatus:
|
||||
return bubble_up_errors(lambda x: x.status, test_suite_list)
|
||||
|
||||
def parse_test_result(lines: List[str]) -> TestResult:
|
||||
if not lines:
|
||||
return TestResult(TestStatus.NO_TESTS, [], lines)
|
||||
consume_non_diagnositic(lines)
|
||||
if not parse_tap_header(lines):
|
||||
return None
|
||||
if not lines or not parse_tap_header(lines):
|
||||
return TestResult(TestStatus.NO_TESTS, [], lines)
|
||||
test_suites = []
|
||||
test_suite = parse_test_suite(lines)
|
||||
while test_suite:
|
||||
@@ -282,6 +280,8 @@ def parse_run_tests(kernel_output) -> TestResult:
|
||||
failed_tests = 0
|
||||
crashed_tests = 0
|
||||
test_result = parse_test_result(list(isolate_kunit_output(kernel_output)))
|
||||
if test_result.status == TestStatus.NO_TESTS:
|
||||
print_with_timestamp(red('[ERROR] ') + 'no kunit output detected')
|
||||
for test_suite in test_result.suites:
|
||||
if test_suite.status == TestStatus.SUCCESS:
|
||||
print_suite_divider(green('[PASSED] ') + test_suite.name)
|
||||
|
@@ -170,6 +170,17 @@ class KUnitParserTest(unittest.TestCase):
|
||||
result.status)
|
||||
file.close()
|
||||
|
||||
def test_no_kunit_output(self):
|
||||
crash_log = get_absolute_path(
|
||||
'test_data/test_insufficient_memory.log')
|
||||
file = open(crash_log)
|
||||
print_mock = mock.patch('builtins.print').start()
|
||||
result = kunit_parser.parse_run_tests(
|
||||
kunit_parser.isolate_kunit_output(file.readlines()))
|
||||
print_mock.assert_any_call(StrContains("no kunit output detected"))
|
||||
print_mock.stop()
|
||||
file.close()
|
||||
|
||||
def test_crashed_test(self):
|
||||
crashed_log = get_absolute_path(
|
||||
'test_data/test_is_test_passed-crash.log')
|
||||
|
Reference in New Issue
Block a user