mirror of
https://github.com/torvalds/linux.git
synced 2026-05-05 23:05:25 -04:00
Merge tag 'linux_kselftest-kunit-6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull kunit updates from Shuah Khan:
- New parameterized test features
KUnit parameterized tests supported two primary methods for getting
parameters:
- Defining custom logic within a generate_params() function.
- Using the KUNIT_ARRAY_PARAM() and KUNIT_ARRAY_PARAM_DESC() macros
with a pre-defined static array and passing the created
*_gen_params() to KUNIT_CASE_PARAM().
These methods present limitations when dealing with dynamically
generated parameter arrays, or in scenarios where populating
parameters sequentially via generate_params() is inefficient or
overly complex.
These limitations are fixed with a parameterized test method
- Fix issues in kunit build artifacts cleanup
- Fix parsing skipped test problem in kselftest framework
- Enable PCI on UML without triggering WARN()
- a few other fixes and adds support for new configs such as MIPS
* tag 'linux_kselftest-kunit-6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
kunit: Extend kconfig help text for KUNIT_UML_PCI
rust: kunit: allow `cfg` on `test`s
kunit: qemu_configs: Add MIPS configurations
kunit: Enable PCI on UML without triggering WARN()
Documentation: kunit: Document new parameterized test features
kunit: Add example parameterized test with direct dynamic parameter array setup
kunit: Add example parameterized test with shared resource management using the Resource API
kunit: Enable direct registration of parameter arrays to a KUnit test
kunit: Pass parameterized test context to generate_params()
kunit: Introduce param_init/exit for parameterized test context management
kunit: Add parent kunit for parameterized test context
kunit: tool: Accept --raw_output=full as an alias of 'all'
kunit: tool: Parse skipped tests from kselftest.h
kunit: Always descend into kunit directory during build
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
# Config options which are added to UML builds by default
|
||||
|
||||
# Enable virtio/pci, as a lot of tests require it.
|
||||
CONFIG_VIRTIO_UML=y
|
||||
CONFIG_UML_PCI_OVER_VIRTIO=y
|
||||
# Enable pci, as a lot of tests require it.
|
||||
CONFIG_KUNIT_UML_PCI=y
|
||||
|
||||
# Enable FORTIFY_SOURCE for wider checking.
|
||||
CONFIG_FORTIFY_SOURCE=y
|
||||
|
||||
@@ -228,7 +228,7 @@ def parse_tests(request: KunitParseRequest, metadata: kunit_json.Metadata, input
|
||||
fake_test.counts.passed = 1
|
||||
|
||||
output: Iterable[str] = input_data
|
||||
if request.raw_output == 'all':
|
||||
if request.raw_output == 'all' or request.raw_output == 'full':
|
||||
pass
|
||||
elif request.raw_output == 'kunit':
|
||||
output = kunit_parser.extract_tap_lines(output)
|
||||
@@ -425,7 +425,7 @@ def add_parse_opts(parser: argparse.ArgumentParser) -> None:
|
||||
parser.add_argument('--raw_output', help='If set don\'t parse output from kernel. '
|
||||
'By default, filters to just KUnit output. Use '
|
||||
'--raw_output=all to show everything',
|
||||
type=str, nargs='?', const='all', default=None, choices=['all', 'kunit'])
|
||||
type=str, nargs='?', const='all', default=None, choices=['all', 'full', 'kunit'])
|
||||
parser.add_argument('--json',
|
||||
nargs='?',
|
||||
help='Prints parsed test results as JSON to stdout or a file if '
|
||||
|
||||
@@ -352,9 +352,9 @@ def parse_test_plan(lines: LineStream, test: Test) -> bool:
|
||||
lines.pop()
|
||||
return True
|
||||
|
||||
TEST_RESULT = re.compile(r'^\s*(ok|not ok) ([0-9]+) (- )?([^#]*)( # .*)?$')
|
||||
TEST_RESULT = re.compile(r'^\s*(ok|not ok) ([0-9]+) ?(- )?([^#]*)( # .*)?$')
|
||||
|
||||
TEST_RESULT_SKIP = re.compile(r'^\s*(ok|not ok) ([0-9]+) (- )?(.*) # SKIP(.*)$')
|
||||
TEST_RESULT_SKIP = re.compile(r'^\s*(ok|not ok) ([0-9]+) ?(- )?(.*) # SKIP ?(.*)$')
|
||||
|
||||
def peek_test_name_match(lines: LineStream, test: Test) -> bool:
|
||||
"""
|
||||
@@ -379,6 +379,8 @@ def peek_test_name_match(lines: LineStream, test: Test) -> bool:
|
||||
if not match:
|
||||
return False
|
||||
name = match.group(4)
|
||||
if not name:
|
||||
return False
|
||||
return name == test.name
|
||||
|
||||
def parse_test_result(lines: LineStream, test: Test,
|
||||
@@ -416,7 +418,7 @@ def parse_test_result(lines: LineStream, test: Test,
|
||||
|
||||
# Set name of test object
|
||||
if skip_match:
|
||||
test.name = skip_match.group(4)
|
||||
test.name = skip_match.group(4) or skip_match.group(5)
|
||||
else:
|
||||
test.name = match.group(4)
|
||||
|
||||
|
||||
18
tools/testing/kunit/qemu_configs/mips.py
Normal file
18
tools/testing/kunit/qemu_configs/mips.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
from ..qemu_config import QemuArchParams
|
||||
|
||||
QEMU_ARCH = QemuArchParams(linux_arch='mips',
|
||||
kconfig='''
|
||||
CONFIG_32BIT=y
|
||||
CONFIG_CPU_BIG_ENDIAN=y
|
||||
CONFIG_MIPS_MALTA=y
|
||||
CONFIG_SERIAL_8250=y
|
||||
CONFIG_SERIAL_8250_CONSOLE=y
|
||||
CONFIG_POWER_RESET=y
|
||||
CONFIG_POWER_RESET_SYSCON=y
|
||||
''',
|
||||
qemu_arch='mips',
|
||||
kernel_path='vmlinuz',
|
||||
kernel_command_line='console=ttyS0',
|
||||
extra_qemu_params=['-M', 'malta'])
|
||||
19
tools/testing/kunit/qemu_configs/mips64.py
Normal file
19
tools/testing/kunit/qemu_configs/mips64.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
from ..qemu_config import QemuArchParams
|
||||
|
||||
QEMU_ARCH = QemuArchParams(linux_arch='mips',
|
||||
kconfig='''
|
||||
CONFIG_CPU_MIPS64_R2=y
|
||||
CONFIG_64BIT=y
|
||||
CONFIG_CPU_BIG_ENDIAN=y
|
||||
CONFIG_MIPS_MALTA=y
|
||||
CONFIG_SERIAL_8250=y
|
||||
CONFIG_SERIAL_8250_CONSOLE=y
|
||||
CONFIG_POWER_RESET=y
|
||||
CONFIG_POWER_RESET_SYSCON=y
|
||||
''',
|
||||
qemu_arch='mips64',
|
||||
kernel_path='vmlinuz',
|
||||
kernel_command_line='console=ttyS0',
|
||||
extra_qemu_params=['-M', 'malta', '-cpu', '5KEc'])
|
||||
19
tools/testing/kunit/qemu_configs/mips64el.py
Normal file
19
tools/testing/kunit/qemu_configs/mips64el.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
from ..qemu_config import QemuArchParams
|
||||
|
||||
QEMU_ARCH = QemuArchParams(linux_arch='mips',
|
||||
kconfig='''
|
||||
CONFIG_CPU_MIPS64_R2=y
|
||||
CONFIG_64BIT=y
|
||||
CONFIG_CPU_LITTLE_ENDIAN=y
|
||||
CONFIG_MIPS_MALTA=y
|
||||
CONFIG_SERIAL_8250=y
|
||||
CONFIG_SERIAL_8250_CONSOLE=y
|
||||
CONFIG_POWER_RESET=y
|
||||
CONFIG_POWER_RESET_SYSCON=y
|
||||
''',
|
||||
qemu_arch='mips64el',
|
||||
kernel_path='vmlinuz',
|
||||
kernel_command_line='console=ttyS0',
|
||||
extra_qemu_params=['-M', 'malta', '-cpu', '5KEc'])
|
||||
18
tools/testing/kunit/qemu_configs/mipsel.py
Normal file
18
tools/testing/kunit/qemu_configs/mipsel.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
from ..qemu_config import QemuArchParams
|
||||
|
||||
QEMU_ARCH = QemuArchParams(linux_arch='mips',
|
||||
kconfig='''
|
||||
CONFIG_32BIT=y
|
||||
CONFIG_CPU_LITTLE_ENDIAN=y
|
||||
CONFIG_MIPS_MALTA=y
|
||||
CONFIG_SERIAL_8250=y
|
||||
CONFIG_SERIAL_8250_CONSOLE=y
|
||||
CONFIG_POWER_RESET=y
|
||||
CONFIG_POWER_RESET_SYSCON=y
|
||||
''',
|
||||
qemu_arch='mipsel',
|
||||
kernel_path='vmlinuz',
|
||||
kernel_command_line='console=ttyS0',
|
||||
extra_qemu_params=['-M', 'malta'])
|
||||
@@ -1,5 +1,5 @@
|
||||
TAP version 13
|
||||
1..2
|
||||
1..3
|
||||
# selftests: membarrier: membarrier_test_single_thread
|
||||
# TAP version 13
|
||||
# 1..2
|
||||
@@ -12,3 +12,4 @@ ok 1 selftests: membarrier: membarrier_test_single_thread
|
||||
# ok 1 sys_membarrier available
|
||||
# ok 2 sys membarrier invalid command test: command = -1, flags = 0, errno = 22. Failed as expected
|
||||
ok 2 selftests: membarrier: membarrier_test_multi_thread
|
||||
ok 3 # SKIP selftests: membarrier: membarrier_test_multi_thread
|
||||
|
||||
Reference in New Issue
Block a user