Skip to content

Commit c2ee54a

Browse files
committed
selftests: add support for VMA userspace tests
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>
1 parent 788d0ea commit c2ee54a

3 files changed

Lines changed: 55 additions & 11 deletions

File tree

playbooks/roles/selftests/defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ selftests_section_kmod: False
2222
selftests_section_maple: False
2323
selftests_section_sysctl: False
2424
selftests_section_xarray: False
25+
selftests_section_vma: False
2526

2627
selftests_ksrc: "tools/testing/selftests/"
2728
selftests_data: "{{ target_linux_dir_path }}/{{ selftests_ksrc }}"
@@ -35,3 +36,4 @@ selftest_kernelspace: False
3536

3637
selftest_xarray: False
3738
selftest_maple: False
39+
selftest_vma: False

playbooks/roles/selftests/tasks/main.yml

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,17 @@
2828
vars:
2929
is_selftest_xarray: "{{ 'xarray' in ansible_host }}"
3030
is_selftest_maple: "{{ 'maple' in ansible_host }}"
31+
is_selftest_vma: "{{ 'vma' in ansible_host }}"
3132
set_fact:
3233
selftest_xarray: "{{ is_selftest_xarray }}"
3334
selftest_maple: "{{ is_selftest_maple }}"
35+
selftest_vma: "{{ is_selftest_vma }}"
3436
tags: ['vars']
3537

3638
- name: Check if this node is in charge of userspace tests
3739
vars:
3840
set_fact:
39-
selftest_userspace: "{{ selftest_xarray or selftest_maple }}"
41+
selftest_userspace: "{{ selftest_xarray or selftest_maple or selftest_vma }}"
4042
tags: ['vars']
4143

4244
- name: Check if this node is in charge of running kernel tests
@@ -50,6 +52,7 @@
5052
Host: {{ ansible_host }}
5153
- selftest_xarray: {{ selftest_xarray }}
5254
- selftest_maple: {{ selftest_maple }}
55+
- selftest_vma: {{ selftest_vma }}
5356
- selftest_kernelspace: {{ selftest_kernelspace }}
5457
- selftest_userspace: {{ selftest_userspace }}
5558
tags: ['run_tests']
@@ -69,7 +72,7 @@
6972
- name: Fail if selftest_kernelspace is true on incorrect host
7073
fail:
7174
msg: "Both selftest_userspace and selftest_kernelspace are True for host {{ ansible_host }}. This is not expected."
72-
when: (selftest_kernelspace and (selftest_xarray or selftest_maple))
75+
when: (selftest_kernelspace and (selftest_xarray or selftest_maple or selftest_vma))
7376
tags: ['vars']
7477

7578
- name: Remove /lib/udev/rules.d/50-firmware.rules
@@ -189,6 +192,26 @@
189192
- bootlinux_9p|bool
190193
- selftests_build_radix_tree|bool
191194

195+
- name: Build VMA tools/testing/vma
196+
tags: [ 'selftests', 'build' ]
197+
make:
198+
chdir: "{{ target_linux_dir_path }}/tools/testing/vma"
199+
jobs: "{{ nproc.stdout }}"
200+
when:
201+
- not bootlinux_9p|bool
202+
- selftest_vma|bool
203+
204+
- name: Build VMA tools/testing/vma on host
205+
tags: [ 'selftests', 'build' ]
206+
command: "make -j{{ nproc.stdout }}"
207+
args:
208+
chdir: "{{ bootlinux_9p_host_path }}/tools/testing/vma"
209+
delegate_to: localhost
210+
run_once: true
211+
when:
212+
- bootlinux_9p|bool
213+
- selftest_vma|bool
214+
192215
# We use the target node only, not the host as if you've enaabled
193216
# 9p the path will be available and everything will have been built
194217
# for us.
@@ -315,6 +338,7 @@
315338
- kdevops_run_selftests|bool
316339
- selftests_build_radix_tree|bool
317340
- selftest_userspace|bool
341+
- not selftest_vma|bool
318342
vars:
319343
command_to_run: >
320344
{%- if selftest_xarray -%}
@@ -332,20 +356,25 @@
332356
become_method: sudo
333357
command: "{{ command_to_run }}"
334358
args:
335-
chdir: "{{ target_linux_dir_path }}/tools/testing/radix-tree"
359+
chdir: "{{ test_target_dir }}"
336360
register: selftests_userspace_out
337361
when:
338362
- kdevops_run_selftests|bool
339-
- selftests_build_radix_tree|bool
340-
- selftest_userspace|bool
363+
- (selftests_build_radix_tree|bool and selftest_userspace|bool and not selftest_vma|bool) or selftest_vma|bool
341364
vars:
342-
command_to_run: >
343-
{%- if selftest_xarray -%}
344-
./xarray
345-
modprobe test_xarray
365+
test_target_dir: >-
366+
{%- if selftest_vma -%}
367+
{{ target_linux_dir_path }}/tools/testing/vma
368+
{%- else -%}
369+
{{ target_linux_dir_path }}/tools/testing/radix-tree
370+
{%- endif -%}
371+
command_to_run: >-
372+
{%- if selftest_vma -%}
373+
./vma
374+
{%- elif selftest_xarray -%}
375+
./xarray && modprobe test_xarray
346376
{%- elif selftest_maple -%}
347-
./maple
348-
modprobe test_maple_tree
377+
./maple && modprobe test_maple_tree
349378
{%- else -%}
350379
echo missing command
351380
{%- endif -%}
@@ -450,6 +479,7 @@
450479
dest: "{{ selftests_workdir}}/module.log"
451480
when:
452481
- selftest_userspace|bool
482+
- not selftest_vma|bool
453483

454484
- name: Look for the test output logs files on {{ selftests_workdir }}
455485
tags: [ 'selftests', 'copy_results' ]

workflows/selftests/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ config SELFTESTS_TEST_BUNDLE_RADIX_TREE
3333
output yaml
3434
select SELFTESTS_SECTION_MAPLE
3535
select SELFTESTS_SECTION_XARRAY
36+
select SELFTESTS_SECTION_VMA
3637
help
3738
This will ensure you test the radix tree in the kernel.
3839

@@ -78,6 +79,12 @@ config SELFTESTS_SECTION_XARRAY
7879
help
7980
This will create a host to test the xarray.
8081

82+
config SELFTESTS_SECTION_VMA
83+
bool "VMA"
84+
output yaml
85+
help
86+
This will create a host to test the VMA userspace tests.
87+
8188
endif # SELFTESTS_MANUAL_COVERAGE
8289

8390
if !SELFTESTS_MANUAL_COVERAGE
@@ -107,6 +114,11 @@ config SELFTESTS_SECTION_XARRAY
107114
output yaml
108115
default y
109116

117+
config SELFTESTS_SECTION_VMA
118+
bool
119+
output yaml
120+
default y
121+
110122
endif # !SELFTESTS_MANUAL_COVERAGE
111123

112124
endmenu

0 commit comments

Comments
 (0)