[LTP] testcases/nvme: Add NVMe device discovery and identification test
linuxtestproject.agent@gmail.com
linuxtestproject.agent@gmail.com
Tue Apr 28 04:58:00 CEST 2026
Hi priyama2,
On Wed, 29 Apr 2026, priyama2 wrote:
> testcases/nvme: Add NVMe device discovery and identification test
> This patch introduces the first test case (nvme01) for NVMe device
> testing in LTP. The test verifies: [...]
The commit body describes what the test does and what hardware it was
run on, but doesn't explain *why* this test is being added to LTP —
what gap does it fill, or what problem prompted writing it?
> +TARGETS = nvme01 nvme02 nvme03 nvme04
nvme02.c, nvme03.c, nvme04.c are not present in this patch, so `make`
will fail. Remove the missing targets (and their explicit rules) from
this patch; add them when those tests land.
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2024 IBM Corporation
> + * Author: LTP NVMe Test Suite
Copyright year must be 2026 for a newly added file. "Author: LTP NVMe
Test Suite" is not a real author; use your name and email. Also, the
test description must be in a separate /*\ RST block (not merged into
the copyright block).
> + dir = opendir(NVME_DEV_PATH);
> + if (!dir) {
> + tst_brk(TBROK | TERRNO, "Failed to open %s", NVME_DEV_PATH);
Use SAFE_OPENDIR() here (and SAFE_FOPEN() / SAFE_CLOSEDIR() /
SAFE_FCLOSE() elsewhere). These are defined in tst_safe_macros.h and
tst_safe_stdio.h.
> +static int nvme_device_found = 0;
> +static char nvme_dev_name[256];
Both static vars are set in case 0 of run() but never reset. Under
`-i` (iteration), subsequent iterations inherit stale state. Reset
them at the top of run().
> + .needs_root = 1,
All operations in this test are unprivileged sysfs/devfs reads. Drop
.needs_root.
> +CC = gcc
> +CFLAGS = -Wall -O2 -I/opt/ltp/include
> +LDFLAGS = -L/opt/ltp/lib
This is a hand-rolled standalone Makefile with hardcoded paths. Replace
it with LTP's build system (env_pre.mk + generic_leaf_target.mk). Also
add `nvme` to SUBDIRS in testcases/kernel/device-drivers/Makefile, and
add a runtest entry and .gitignore entry for nvme01.
[...]
Pre-existing issues noticed in the surrounding code (not introduced by
this patch):
- nvme01.c:236 — Stray `// Made with Bob` comment at end of file.
- nvme01.c:58 — `strlen(entry->d_name) == 5` silently skips nvme10+.
---
Note:
Our agent completed the review of the patch. The full review can be
found at: https://github.com/linux-test-project/ltp-agent/actions/runs/25031212578
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
More information about the ltp
mailing list