* [PATCH] selftests: add support for VMA userspace tests
@ 2025-07-22 1:19 Luis Chamberlain
0 siblings, 0 replies; only message in thread
From: Luis Chamberlain @ 2025-07-22 1:19 UTC (permalink / raw)
To: Chuck Lever, Daniel Gomez, Viacheslav Dubeyko, David Bueso,
Liam R . Howlett, Lorenzo Stoakes, kdevops
Cc: Luis Chamberlain
Add support for testing VMA userspace tests under the radix tree test
bundle. The VMA tests are located in tools/testing/vma and are
userspace-only tests that don't require kernel module loading like
the existing xarray and maple tree tests.
This extends the SELFTESTS_TEST_BUNDLE_RADIX_TREE configuration to
include VMA testing alongside the existing xarray and maple tree tests.
Demo:
make DEVOPS_HOSTS_PREFIX="mm" defconfig-seltests-radix-tree
make
make linux
make selftests
make sefltests-baseline HOSTS=mm-vma
cat workflows/selftests/results/last-run/6.16.0-rc7/vma.userspace.log
16 tests run, 16 passed, 0 failed
Generated-by: Claude AI
Suggested-by: Liam Howlett <liam.howlett@oracle.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
I just asked Claude AI to add support. I hope this shows that
adding support is really easy for new selftests even odd tests
which are not part of the formal selftests or kunit like this one.
This and all my pending patches can be found here:
https://github.com/linux-kdevops/kdevops/tree/mcgrof/vma-v2
In case folks are curious, the prompt I used to Claude AI was just
(get the npm version, don't use the web interface, that's ancient stuff):
We already support testing the Linux kernel maple tree and radix tree
on the selftests workflow. These are custom tests and each of these
are tested on kdevops in-kernel and then in userspace. The kernel
testing is done is there is loadable kernel module for each. We have
support for bundling these two tests under the defconfigs/seltests-radix-tree
and use SELFTESTS_TEST_BUNDLE_RADIX_TREE to help us bundle radix-tree related
tests. We want to extend this with a new userspace only test. Its the vma
tests on the kernel but for userspace. So it won't have a corresponding Linux
kernel module load, contrary to test_xarray and test_maple_tree. The only
thing that needs to be done to test it is to change directory on the linux
kernel directory sources into tools/testing/vma and as a user run
make -j$(nproc) and then just run sudo ./vma. So add support for this and
augment SELFTESTS_TEST_BUNDLE_RADIX_TREE to select this.
playbooks/roles/selftests/defaults/main.yml | 2 +
playbooks/roles/selftests/tasks/main.yml | 52 ++++++++++++++++-----
workflows/selftests/Kconfig | 12 +++++
3 files changed, 55 insertions(+), 11 deletions(-)
diff --git a/playbooks/roles/selftests/defaults/main.yml b/playbooks/roles/selftests/defaults/main.yml
index 9700b00cfd18..dc5982fb5f63 100644
--- a/playbooks/roles/selftests/defaults/main.yml
+++ b/playbooks/roles/selftests/defaults/main.yml
@@ -22,6 +22,7 @@ selftests_section_kmod: False
selftests_section_maple: False
selftests_section_sysctl: False
selftests_section_xarray: False
+selftests_section_vma: False
selftests_ksrc: "tools/testing/selftests/"
selftests_data: "{{ target_linux_dir_path }}/{{ selftests_ksrc }}"
@@ -35,3 +36,4 @@ selftest_kernelspace: False
selftest_xarray: False
selftest_maple: False
+selftest_vma: False
diff --git a/playbooks/roles/selftests/tasks/main.yml b/playbooks/roles/selftests/tasks/main.yml
index f080d8c0c8c2..657f93bbb6a9 100644
--- a/playbooks/roles/selftests/tasks/main.yml
+++ b/playbooks/roles/selftests/tasks/main.yml
@@ -28,15 +28,17 @@
vars:
is_selftest_xarray: "{{ 'xarray' in ansible_host }}"
is_selftest_maple: "{{ 'maple' in ansible_host }}"
+ is_selftest_vma: "{{ 'vma' in ansible_host }}"
set_fact:
selftest_xarray: "{{ is_selftest_xarray }}"
selftest_maple: "{{ is_selftest_maple }}"
+ selftest_vma: "{{ is_selftest_vma }}"
tags: ['vars']
- name: Check if this node is in charge of userspace tests
vars:
set_fact:
- selftest_userspace: "{{ selftest_xarray or selftest_maple }}"
+ selftest_userspace: "{{ selftest_xarray or selftest_maple or selftest_vma }}"
tags: ['vars']
- name: Check if this node is in charge of running kernel tests
@@ -50,6 +52,7 @@
Host: {{ ansible_host }}
- selftest_xarray: {{ selftest_xarray }}
- selftest_maple: {{ selftest_maple }}
+ - selftest_vma: {{ selftest_vma }}
- selftest_kernelspace: {{ selftest_kernelspace }}
- selftest_userspace: {{ selftest_userspace }}
tags: ['run_tests']
@@ -69,7 +72,7 @@
- name: Fail if selftest_kernelspace is true on incorrect host
fail:
msg: "Both selftest_userspace and selftest_kernelspace are True for host {{ ansible_host }}. This is not expected."
- when: (selftest_kernelspace and (selftest_xarray or selftest_maple))
+ when: (selftest_kernelspace and (selftest_xarray or selftest_maple or selftest_vma))
tags: ['vars']
- name: Remove /lib/udev/rules.d/50-firmware.rules
@@ -189,6 +192,26 @@
- bootlinux_9p|bool
- selftests_build_radix_tree|bool
+- name: Build VMA tools/testing/vma
+ tags: [ 'selftests', 'build' ]
+ make:
+ chdir: "{{ target_linux_dir_path }}/tools/testing/vma"
+ jobs: "{{ nproc.stdout }}"
+ when:
+ - not bootlinux_9p|bool
+ - selftest_vma|bool
+
+- name: Build VMA tools/testing/vma on host
+ tags: [ 'selftests', 'build' ]
+ command: "make -j{{ nproc.stdout }}"
+ args:
+ chdir: "{{ bootlinux_9p_host_path }}/tools/testing/vma"
+ delegate_to: localhost
+ run_once: true
+ when:
+ - bootlinux_9p|bool
+ - selftest_vma|bool
+
# We use the target node only, not the host as if you've enaabled
# 9p the path will be available and everything will have been built
# for us.
@@ -315,6 +338,7 @@
- kdevops_run_selftests|bool
- selftests_build_radix_tree|bool
- selftest_userspace|bool
+ - not selftest_vma|bool
vars:
command_to_run: >
{%- if selftest_xarray -%}
@@ -332,20 +356,25 @@
become_method: sudo
command: "{{ command_to_run }}"
args:
- chdir: "{{ target_linux_dir_path }}/tools/testing/radix-tree"
+ chdir: "{{ test_target_dir }}"
register: selftests_userspace_out
when:
- kdevops_run_selftests|bool
- - selftests_build_radix_tree|bool
- - selftest_userspace|bool
+ - (selftests_build_radix_tree|bool and selftest_userspace|bool and not selftest_vma|bool) or selftest_vma|bool
vars:
- command_to_run: >
- {%- if selftest_xarray -%}
- ./xarray
- modprobe test_xarray
+ test_target_dir: >-
+ {%- if selftest_vma -%}
+ {{ target_linux_dir_path }}/tools/testing/vma
+ {%- else -%}
+ {{ target_linux_dir_path }}/tools/testing/radix-tree
+ {%- endif -%}
+ command_to_run: >-
+ {%- if selftest_vma -%}
+ ./vma
+ {%- elif selftest_xarray -%}
+ ./xarray && modprobe test_xarray
{%- elif selftest_maple -%}
- ./maple
- modprobe test_maple_tree
+ ./maple && modprobe test_maple_tree
{%- else -%}
echo missing command
{%- endif -%}
@@ -450,6 +479,7 @@
dest: "{{ selftests_workdir}}/module.log"
when:
- selftest_userspace|bool
+ - not selftest_vma|bool
- name: Look for the test output logs files on {{ selftests_workdir }}
tags: [ 'selftests', 'copy_results' ]
diff --git a/workflows/selftests/Kconfig b/workflows/selftests/Kconfig
index ea69775c7f9e..f34e2f145bd6 100644
--- a/workflows/selftests/Kconfig
+++ b/workflows/selftests/Kconfig
@@ -33,6 +33,7 @@ config SELFTESTS_TEST_BUNDLE_RADIX_TREE
output yaml
select SELFTESTS_SECTION_MAPLE
select SELFTESTS_SECTION_XARRAY
+ select SELFTESTS_SECTION_VMA
help
This will ensure you test the radix tree in the kernel.
@@ -78,6 +79,12 @@ config SELFTESTS_SECTION_XARRAY
help
This will create a host to test the xarray.
+config SELFTESTS_SECTION_VMA
+ bool "VMA"
+ output yaml
+ help
+ This will create a host to test the VMA userspace tests.
+
endif # SELFTESTS_MANUAL_COVERAGE
if !SELFTESTS_MANUAL_COVERAGE
@@ -107,6 +114,11 @@ config SELFTESTS_SECTION_XARRAY
output yaml
default y
+config SELFTESTS_SECTION_VMA
+ bool
+ output yaml
+ default y
+
endif # !SELFTESTS_MANUAL_COVERAGE
endmenu
--
2.45.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-07-22 1:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-22 1:19 [PATCH] selftests: add support for VMA userspace tests Luis Chamberlain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox