Skip to content

Commit 3132994

Browse files
committed
ltp: add support for running tests on NFS mounts
Add comprehensive support for running LTP tests on NFS/pNFS mounts when both CONFIG_LTP_TESTS_NFS and CONFIG_KDEVOPS_SETUP_NFSD are enabled. Changes include: 1. Add CONFIG_LTP_RUN_TESTS_ON_NFS option to control NFS mount testing - Depends on both NFS test group and NFS server being enabled - Defaults to enabled when dependencies are met 2. Extend KDEVOPS_SETUP_NFSD dependencies to include LTP workflow - Allows NFS server setup for LTP testing scenarios 3. Enhance LTP role with NFS mount capability: - Mount NFS exports from kdevops NFS server before running tests - Run LTP tests in NFS mount directory (/mnt/nfs-ltp/ltp-test) - Use NFS v4.2 for comprehensive pNFS testing 4. Update nfs-ltp defconfig to enable full pNFS testing: - Enable NFS test group (CONFIG_LTP_TESTS_NFS=y) - Enable NFS server setup (CONFIG_KDEVOPS_SETUP_NFSD=y) - Enable NFS mount testing (CONFIG_LTP_RUN_TESTS_ON_NFS=y) This enables real pNFS testing where LTP tests execute on actual NFS mounts, providing comprehensive validation of NFS client functionality including parallel NFS capabilities. Generated-by: Claude AI Signed-off-by: Luis Chamberlain <[email protected]>
1 parent 90b7da3 commit 3132994

File tree

5 files changed

+114
-6
lines changed

5 files changed

+114
-6
lines changed

defconfigs/nfs-ltp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# pNFS configuration for Linux Test Project (LTP)
2-
# Note: LTP doesn't specifically test pNFS, but can run on pNFS mounts
2+
#
3+
# This defconfig sets up LTP to run tests over pNFS (parallel NFS) mounts.
4+
# It configures:
5+
# 1. An NFS server node with exports (via CONFIG_KDEVOPS_SETUP_NFSD)
6+
# 2. LTP with NFS test group enabled (CONFIG_LTP_TESTS_NFS)
7+
# 3. Automatic NFS mount setup to run tests on NFS (CONFIG_LTP_RUN_TESTS_ON_NFS)
8+
#
9+
# The LTP tests will execute on NFS v4.2 mounts, providing comprehensive
10+
# testing of NFS client functionality including pNFS capabilities.
311

412
# Use libvirt/QEMU for virtualization
513
CONFIG_GUESTFS=y
@@ -24,8 +32,14 @@ CONFIG_WORKFLOWS_DEDICATED_WORKFLOW=y
2432
CONFIG_KDEVOPS_WORKFLOW_DEDICATE_LTP=y
2533
CONFIG_KDEVOPS_WORKFLOW_ENABLE_LTP=y
2634

27-
# Use kdevops-provided NFS server for pNFS mount
35+
# Enable NFS test group for pNFS testing
36+
CONFIG_LTP_TESTS_NFS=y
37+
38+
# NFS server setup for pNFS testing
2839
CONFIG_KDEVOPS_SETUP_NFSD=y
2940

41+
# Run LTP tests on NFS mounts (enables actual pNFS testing)
42+
CONFIG_LTP_RUN_TESTS_ON_NFS=y
43+
3044
# Enable systemd journal remote for debugging
3145
CONFIG_DEVCONFIG_ENABLE_SYSTEMD_JOURNAL_REMOTE=y

kconfigs/Kconfig.nfsd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
config KDEVOPS_SETUP_NFSD
33
bool "Set up the kernel nfs server"
44
depends on KDEVOPS_WORKFLOW_ENABLE_FSTESTS || \
5-
KDEVOPS_WORKFLOW_ENABLE_PYNFS || \
6-
KDEVOPS_WORKFLOW_ENABLE_NFSTEST || \
7-
KDEVOPS_WORKFLOW_ENABLE_GITR
5+
KDEVOPS_WORKFLOW_ENABLE_PYNFS || \
6+
KDEVOPS_WORKFLOW_ENABLE_NFSTEST || \
7+
KDEVOPS_WORKFLOW_ENABLE_GITR || \
8+
KDEVOPS_WORKFLOW_ENABLE_LTP
89
default n
910
help
1011
Configure and bring up the kernel NFS server. This will provision

playbooks/roles/ltp/tasks/main.yml

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,64 @@
248248
state: reloaded
249249
enabled: true
250250

251-
- name: Run ltp
251+
# NFS mount support for running LTP tests on NFS
252+
- name: Set NFS server address
253+
tags: ["ltp", "run_tests"]
254+
ansible.builtin.set_fact:
255+
nfs_server_host: "{{ kdevops_host_prefix }}-nfs"
256+
when:
257+
- ltp_run_tests_on_nfs|default(false)|bool
258+
259+
- name: Create NFS mount point for LTP tests
260+
tags: ["ltp", "run_tests"]
261+
become: true
262+
become_flags: "su - -c"
263+
become_method: ansible.builtin.sudo
264+
ansible.builtin.file:
265+
path: "/mnt/nfs-ltp"
266+
state: directory
267+
mode: "0755"
268+
when:
269+
- ltp_run_tests_on_nfs|default(false)|bool
270+
271+
- name: Mount NFS export for LTP testing
272+
tags: ["ltp", "run_tests"]
273+
become: true
274+
become_flags: "su - -c"
275+
become_method: ansible.builtin.sudo
276+
ansible.builtin.mount:
277+
path: "/mnt/nfs-ltp"
278+
src: "{{ nfs_server_host }}:{{ nfsd_export_path }}/0"
279+
fstype: "nfs"
280+
opts: "vers=4.2"
281+
state: mounted
282+
when:
283+
- ltp_run_tests_on_nfs|default(false)|bool
284+
285+
- name: Create LTP test directory on NFS mount
286+
tags: ["ltp", "run_tests"]
287+
become: true
288+
become_flags: "su - -c"
289+
become_method: ansible.builtin.sudo
290+
ansible.builtin.file:
291+
path: "/mnt/nfs-ltp/ltp-test"
292+
state: directory
293+
mode: "0777"
294+
when:
295+
- ltp_run_tests_on_nfs|default(false)|bool
296+
297+
- name: Change to NFS mount directory for LTP tests
298+
tags: ["run_tests"]
299+
become: true
300+
become_flags: "su - -c"
301+
become_method: ansible.builtin.sudo
302+
ansible.builtin.shell: |
303+
cd /mnt/nfs-ltp/ltp-test
304+
pwd
305+
when:
306+
- ltp_run_tests_on_nfs|default(false)|bool
307+
308+
- name: Run ltp on local filesystem
252309
tags: ["run_tests"]
253310
become: true
254311
become_flags: "su - -c"
@@ -259,6 +316,24 @@
259316
cmd: "/opt/ltp/runltp {{ ltp_runltp_arg_dict[ltp_test_group] }}"
260317
changed_when: true
261318
failed_when: false
319+
when:
320+
- not ltp_run_tests_on_nfs|default(false)|bool
321+
322+
- name: Run ltp on NFS mount
323+
tags: ["run_tests"]
324+
become: true
325+
become_flags: "su - -c"
326+
become_method: ansible.builtin.sudo
327+
environment:
328+
CREATE_ENTRIES: 1
329+
TMPDIR: "/mnt/nfs-ltp/ltp-test"
330+
ansible.builtin.command:
331+
cmd: "/opt/ltp/runltp -d /mnt/nfs-ltp/ltp-test {{ ltp_runltp_arg_dict[ltp_test_group] }}"
332+
chdir: "/mnt/nfs-ltp/ltp-test"
333+
changed_when: true
334+
failed_when: false
335+
when:
336+
- ltp_run_tests_on_nfs|default(false)|bool
262337

263338
- name: Look for test results in target node's /opt/ltp/results
264339
tags: ["copy_results"]

workflows/ltp/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,18 @@ config LTP_TESTS_TIRPC
6161

6262
endmenu
6363

64+
config LTP_RUN_TESTS_ON_NFS
65+
bool "Run LTP tests on NFS mounts"
66+
depends on LTP_TESTS_NFS && KDEVOPS_SETUP_NFSD
67+
default y
68+
help
69+
When enabled, LTP tests will be run on NFS mounts instead of
70+
local filesystems. This requires both NFS test group to be enabled
71+
and kdevops NFS server to be configured.
72+
73+
The tests will mount NFS exports from the kdevops NFS server
74+
and run the LTP test suite on those mounts.
75+
6476
endif # WORKFLOWS_DEDICATED_WORKFLOW
6577

6678
config HAVE_MIRROR_LTP

workflows/ltp/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ else
8282
LTP_ARGS += ltp_tests_tirpc='False'
8383
endif # CONFIG_LTP_TESTS_TIRPC
8484

85+
ifeq (y,$(CONFIG_LTP_RUN_TESTS_ON_NFS))
86+
LTP_ARGS += ltp_run_tests_on_nfs='True'
87+
else
88+
LTP_ARGS += ltp_run_tests_on_nfs='False'
89+
endif # CONFIG_LTP_RUN_TESTS_ON_NFS
90+
8591
WORKFLOW_ARGS += $(LTP_ARGS)
8692
WORKFLOW_ARGS_SEPARATED += ltp_enabled_test_groups='$(subst $(space),+,$(LTP_ENABLED_TEST_GROUPS))'
8793

0 commit comments

Comments
 (0)