v4:
- update the commit message with application of patch 3/4
v3:
- use the quotes with correct format in the commit message of patch 4/4,
sorry for that
v2:
- update the commit message to explain the detailed reason of patch 3/4
- add this cover letter
Tiezhu Yang (4):
selftests: kmod: Use variable NAME in kmod_test_0001()
kmod: Remove redundant "be an" in the comment
kmod: Return directly if module name is empty in request_module()
test_kmod: Avoid potential double free in trigger_config_run_type()
kernel/kmod.c | 10 +++++++---
lib/test_kmod.c | 2 +-
tools/testing/selftests/kmod/kmod.sh | 4 ++--
3 files changed, 10 insertions(+), 6 deletions(-)
--
2.1.0
A recent RFC patch set [1] suggests some additional functionality
may be needed around kunit resources. It seems to require
1. support for resources without allocation
2. support for lookup of such resources
3. support for access to resources across multiple kernel threads
The proposed changes here are designed to address these needs.
The idea is we first generalize the API to support adding
resources with static data; then from there we support named
resources. The latter support is needed because if we are
in a different thread context and only have the "struct kunit *"
to work with, we need a way to identify a resource in lookup.
[1] https://lkml.org/lkml/2020/2/26/1286
Changes since v3:
- removed unused "init" field from "struct kunit_resources" (Brendan)
Changes since v2:
- moved a few functions relating to resource retrieval in patches
1 and 2 into include/kunit/test.h and defined as "static inline";
this allows built-in consumers to use these functions when KUnit
is built as a module
Changes since v1:
- reformatted longer parameter lists to have one parameter per-line
(Brendan, patch 1)
- fixed phrasing in various comments to clarify allocation of memory
and added comment to kunit resource tests to clarify why
kunit_put_resource() is used there (Brendan, patch 1)
- changed #define to static inline function (Brendan, patch 2)
- simplified kunit_add_named_resource() to use more of existing
code for non-named resource (Brendan, patch 2)
Alan Maguire (2):
kunit: generalize kunit_resource API beyond allocated resources
kunit: add support for named resources
Alan Maguire (2):
kunit: generalize kunit_resource API beyond allocated resources
kunit: add support for named resources
include/kunit/test.h | 210 +++++++++++++++++++++++++++++++++++++++-------
lib/kunit/kunit-test.c | 111 +++++++++++++++++++-----
lib/kunit/string-stream.c | 14 ++--
lib/kunit/test.c | 171 ++++++++++++++++++++++---------------
4 files changed, 380 insertions(+), 126 deletions(-)
--
1.8.3.1
The identation before this code (`if not os.path.exists(cli_args.build_dir):``)
was with spaces instead of tabs after fixed up merge conflits,
this commit revert spaces to tabs:
[iha@bbking linux]$ tools/testing/kunit/kunit.py run
File "tools/testing/kunit/kunit.py", line 247
if not linux:
^
TabError: inconsistent use of tabs and spaces in indentation
Remove defconfig related code to fix these two errors,
the commit 9bdf64b35 was created before 45ba7a893ad,
and the commit 9bdf64b35 removes defconfig related code:
[iha@bbking linux]$ tools/testing/kunit/kunit.py run
Traceback (most recent call last):
File "tools/testing/kunit/kunit.py", line 338, in <module>
main(sys.argv[1:])
File "tools/testing/kunit/kunit.py", line 215, in main
add_config_opts(config_parser)
[iha@bbking linux]$ tools/testing/kunit/kunit.py run
Traceback (most recent call last):
File "tools/testing/kunit/kunit.py", line 337, in <module>
main(sys.argv[1:])
File "tools/testing/kunit/kunit.py", line 255, in main
result = run_tests(linux, request)
File "tools/testing/kunit/kunit.py", line 133, in run_tests
request.defconfig,
AttributeError: 'KunitRequest' object has no attribute 'defconfig'
Handles when there is no .kunitconfig, the error occurs because
commit 9bdf64b35 was created before 45ba7a893ad.
[iha@bbking linux]$ tools/testing/kunit/kunit.py run
Traceback (most recent call last):
File "tools/testing/kunit/kunit.py", line 335, in <module>
main(sys.argv[1:])
File "tools/testing/kunit/kunit.py", line 246, in main
linux = kunit_kernel.LinuxSourceTree()
File "/home/iha/sdb/opensource/lkmp/linux/tools/testing/kunit/kunit_kernel.py", line 109, in __init__
self._kconfig.read_from_file(kunitconfig_path)
File "/home/iha/sdb/opensource/lkmp/linux/tools/testing/kunit/kunit_config.py", line 88, in read_from_file
with open(path, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '.kunit/.kunitconfig'
Signed-off-by: Vitor Massaru Iha <vitor(a)massaru.org>
---
Fix the fixup on this commits: 9bdf64b, ddbd60c.
Some errors occurs because these commits were created before
this commit 45ba7a8, as explained in the commit message.
---
tools/testing/kunit/kunit.py | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py
index ec73b07d1265..787b6d4ad716 100755
--- a/tools/testing/kunit/kunit.py
+++ b/tools/testing/kunit/kunit.py
@@ -23,7 +23,7 @@ import kunit_parser
KunitResult = namedtuple('KunitResult', ['status','result','elapsed_time'])
KunitConfigRequest = namedtuple('KunitConfigRequest',
- ['build_dir', 'defconfig', 'make_options'])
+ ['build_dir', 'make_options'])
KunitBuildRequest = namedtuple('KunitBuildRequest',
['jobs', 'build_dir', 'alltests',
'make_options'])
@@ -130,7 +130,6 @@ def run_tests(linux: kunit_kernel.LinuxSourceTree,
run_start = time.time()
config_request = KunitConfigRequest(request.build_dir,
- request.defconfig,
request.make_options)
config_result = config_tests(linux, config_request)
if config_result.status != KunitStatus.SUCCESS:
@@ -212,7 +211,6 @@ def main(argv, linux=None):
help='Ensures that .config contains all of '
'the options in .kunitconfig')
add_common_opts(config_parser)
- add_config_opts(config_parser)
build_parser = subparser.add_parser('build', help='Builds a kernel with KUnit tests')
add_common_opts(build_parser)
@@ -238,11 +236,14 @@ def main(argv, linux=None):
cli_args = parser.parse_args(argv)
if cli_args.subcommand == 'run':
- if not os.path.exists(cli_args.build_dir):
- os.mkdir(cli_args.build_dir)
- kunit_kernel.kunitconfig_path = os.path.join(
- cli_args.build_dir,
- kunit_kernel.kunitconfig_path)
+ if not os.path.exists(cli_args.build_dir):
+ os.mkdir(cli_args.build_dir)
+ kunit_kernel.kunitconfig_path = os.path.join(
+ cli_args.build_dir,
+ kunit_kernel.kunitconfig_path)
+
+ if not os.path.exists(kunit_kernel.kunitconfig_path):
+ create_default_kunitconfig()
if not linux:
linux = kunit_kernel.LinuxSourceTree()
@@ -264,11 +265,13 @@ def main(argv, linux=None):
cli_args.build_dir,
kunit_kernel.kunitconfig_path)
+ if not os.path.exists(kunit_kernel.kunitconfig_path):
+ create_default_kunitconfig()
+
if not linux:
linux = kunit_kernel.LinuxSourceTree()
request = KunitConfigRequest(cli_args.build_dir,
- cli_args.defconfig,
cli_args.make_options)
result = config_tests(linux, request)
kunit_parser.print_with_timestamp((
@@ -284,6 +287,9 @@ def main(argv, linux=None):
cli_args.build_dir,
kunit_kernel.kunitconfig_path)
+ if not os.path.exists(kunit_kernel.kunitconfig_path):
+ create_default_kunitconfig()
+
if not linux:
linux = kunit_kernel.LinuxSourceTree()
@@ -305,6 +311,9 @@ def main(argv, linux=None):
cli_args.build_dir,
kunit_kernel.kunitconfig_path)
+ if not os.path.exists(kunit_kernel.kunitconfig_path):
+ create_default_kunitconfig()
+
if not linux:
linux = kunit_kernel.LinuxSourceTree()
--
2.26.2
Hi,
This patchset will try to enable as many KUnit test fragments as
possible for the current .config file.
This will make it easier for both developers that tests their specific
feature and also for test-systems that would like to get as much as
possible for their current .config file.
I will send a separate KCSAN KUnit patch after this patchset since that
isn't in mainline yet.
Since v2:
Fixed David's comments. KUNIT_RUN_ALL -> KUNIT_ALL_TESTS, and he
suggested a great help text.
Since v1:
Marco commented to split up the patches, and change a "." to a ",".
Cheers,
Anders
Anders Roxell (6):
kunit: Kconfig: enable a KUNIT_ALL_TESTS fragment
kunit: default KUNIT_* fragments to KUNIT_ALL_TESTS
lib: Kconfig.debug: default KUNIT_* fragments to KUNIT_ALL_TESTS
drivers: base: default KUNIT_* fragments to KUNIT_ALL_TESTS
fs: ext4: default KUNIT_* fragments to KUNIT_ALL_TESTS
security: apparmor: default KUNIT_* fragments to KUNIT_ALL_TESTS
drivers/base/Kconfig | 3 ++-
drivers/base/test/Kconfig | 3 ++-
fs/ext4/Kconfig | 3 ++-
lib/Kconfig.debug | 6 ++++--
lib/kunit/Kconfig | 23 ++++++++++++++++++++---
security/apparmor/Kconfig | 3 ++-
6 files changed, 32 insertions(+), 9 deletions(-)
--
2.20.1
Hi,
Recently, I found some tests were always skipped.
Here is a series of patches to fix those issues.
The prime_numbers test is skipped in some cases because
prime_numbers.ko is not always compiled.
Since the CONFIG_PRIME_NUMBERS is not independently
configurable item (it has no title and help), it is enabled
only if other configs (DRM_DEBUG_SELFTEST etc.) select it.
To fix this issue, I added a title and help for
CONFIG_PRIME_NUMBERS.
The sysctl test is skipped because
- selftests/sysctl/config requires CONFIG_TEST_SYSCTL=y. But
since lib/test_sysctl.c doesn't use module_init(), the
test_syscall is not listed under /sys/module/ and the
test script gives up.
- Even if we make CONFIG_TEST_SYSCTL=m, the test script checks
/sys/modules/test_sysctl before loading module and gives up.
- Ayway, since the test module introduces useless sysctl
interface to the kernel, it would better be a module.
This series includes fixes for above 3 points.
- Fix lib/test_sysctl.c to use module_init()
- Fix tools/testing/selftests/sysctl/sysctl.sh to try to load
test module if it is not loaded (nor embedded).
- Fix tools/testing/selftests/sysctl/config to require
CONFIG_TEST_SYSCTL=m, not y.
Thank you,
---
Masami Hiramatsu (4):
lib: Make prime number generator independently selectable
lib: Make test_sysctl initialized as module
selftests/sysctl: Fix to load test_sysctl module
selftests/sysctl: Make sysctl test driver as a module
lib/math/Kconfig | 7 ++++++-
lib/test_sysctl.c | 2 +-
tools/testing/selftests/sysctl/config | 2 +-
tools/testing/selftests/sysctl/sysctl.sh | 13 ++-----------
4 files changed, 10 insertions(+), 14 deletions(-)
--
Masami Hiramatsu (Linaro) <mhiramat(a)kernel.org>
The test-klp-callbacks change implement a synchronization replacement of
initial code to use completion variables instead of delays. The
completion variable interlocks the busy module with the concurrent
loading of the target livepatch patches which works with the execution
flow instead of estimated time delays.
The test-klp-shadow-vars changes first refactors the code to be more of
a readable example as well as continuing to verify the component code.
The patch is broken in two to display the renaming and restructuring in
part 1 and the addition and change of logic in part 2. The last change
frees memory before bailing in case of errors.
Patchset to be merged via the livepatching tree is against: livepatching/for-next
Joe Lawrence (1):
selftests/livepatch: rework test-klp-callbacks to use completion
variables
Yannick Cote (3):
selftests/livepatch: rework test-klp-shadow-vars
selftests/livepatch: more verification in test-klp-shadow-vars
selftests/livepatch: fix mem leaks in test-klp-shadow-vars
lib/livepatch/test_klp_callbacks_busy.c | 42 +++-
lib/livepatch/test_klp_shadow_vars.c | 222 +++++++++---------
.../selftests/livepatch/test-callbacks.sh | 29 ++-
.../selftests/livepatch/test-shadow-vars.sh | 85 ++++---
4 files changed, 214 insertions(+), 164 deletions(-)
--
2.25.4
hmm_range_fault() returns an array of page frame numbers and flags for
how the pages are mapped in the requested process' page tables. The PFN
can be used to get the struct page with hmm_pfn_to_page() and the page size
order can be determined with compound_order(page) but if the page is larger
than order 0 (PAGE_SIZE), there is no indication that the page is mapped
using a larger page size. To be fully general, hmm_range_fault() would need
to return the mapping size to handle cases like a 1GB compound page being
mapped with 2MB PMD entries. However, the most common case is the mapping
size the same as the underlying compound page size.
This series adds a new output flag to indicate this so that callers know it
is safe to use a large device page table mapping if one is available.
Nouveau and the HMM tests are updated to use the new flag.
Note that this series depends on a patch queued in Ben Skeggs' nouveau
tree ("nouveau/hmm: map pages after migration") and the patches queued
in Jason's HMM tree.
There is also a patch outstanding ("nouveau/hmm: fix nouveau_dmem_chunk
allocations") that is independent of the above and could be applied
before or after.
Ralph Campbell (6):
nouveau/hmm: map pages after migration
nouveau: make nvkm_vmm_ctor() and nvkm_mmu_ptp_get() static
nouveau/hmm: fault one page at a time
mm/hmm: add output flag for compound page mapping
nouveau/hmm: support mapping large sysmem pages
hmm: add tests for HMM_PFN_COMPOUND flag
drivers/gpu/drm/nouveau/nouveau_dmem.c | 46 ++-
drivers/gpu/drm/nouveau/nouveau_dmem.h | 2 +
drivers/gpu/drm/nouveau/nouveau_svm.c | 288 +++++++++---------
drivers/gpu/drm/nouveau/nouveau_svm.h | 5 +
.../gpu/drm/nouveau/nvkm/subdev/mmu/base.c | 6 +-
.../gpu/drm/nouveau/nvkm/subdev/mmu/priv.h | 2 +
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c | 12 +-
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h | 3 -
.../drm/nouveau/nvkm/subdev/mmu/vmmgp100.c | 29 +-
include/linux/hmm.h | 4 +-
lib/test_hmm.c | 2 +
lib/test_hmm_uapi.h | 2 +
mm/hmm.c | 10 +-
tools/testing/selftests/vm/hmm-tests.c | 76 +++++
14 files changed, 311 insertions(+), 176 deletions(-)
--
2.20.1
To make KUnit easier to use, and to avoid overwriting object and
.config files, the default KUnit build directory is set to .kunit
Fixed up minor merge conflicts - Shuah Khan <skhan(a)linuxfoundation.org>
Fixed this identation error exchanging spaces for tabs between lines
248 and 252:
tools/testing/kunit/kunit.py run --defconfig
File "tools/testing/kunit/kunit.py", line 254
if not linux:
^
TabError: inconsistent use of tabs and spaces in indentation
Signed-off-by: Vitor Massaru Iha <vitor(a)massaru.org>
Reviewed-by: Brendan Higgins <brendanhiggins(a)google.com>
Signed-off-by: Shuah Khan <skhan(a)linuxfoundation.org>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=205221
---
version after merge on kunit brach:
v1:
* fix identation (tabs instead of spaces)
v2:
* fix v1 changelog description: fix identation
(spaces instead of tabs, lines 248-252);
* add python error message on commit message;
* fix Link tag on commit message.
---
tools/testing/kunit/kunit.py | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py
index b01838b6f5f9..b3490271a103 100755
--- a/tools/testing/kunit/kunit.py
+++ b/tools/testing/kunit/kunit.py
@@ -169,7 +169,7 @@ def add_common_opts(parser):
parser.add_argument('--build_dir',
help='As in the make command, it specifies the build '
'directory.',
- type=str, default='', metavar='build_dir')
+ type=str, default='.kunit', metavar='build_dir')
parser.add_argument('--make_options',
help='X=Y make option, can be repeated.',
action='append')
@@ -245,12 +245,11 @@ def main(argv, linux=None):
cli_args = parser.parse_args(argv)
if cli_args.subcommand == 'run':
- if cli_args.build_dir:
- if not os.path.exists(cli_args.build_dir):
- os.mkdir(cli_args.build_dir)
- kunit_kernel.kunitconfig_path = os.path.join(
- cli_args.build_dir,
- kunit_kernel.kunitconfig_path)
+ if not os.path.exists(cli_args.build_dir):
+ os.mkdir(cli_args.build_dir)
+ kunit_kernel.kunitconfig_path = os.path.join(
+ cli_args.build_dir,
+ kunit_kernel.kunitconfig_path)
if not linux:
linux = kunit_kernel.LinuxSourceTree()
--
2.26.2