[LTP] testcases/kernel/device-drivers/nvme: Add NVMe device discovery test

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Thu Apr 30 08:35:08 CEST 2026


Hi priyama2,

On Fri, 1 May 2026 15:14:20 +0000, priyama2 wrote:
> +++ b/testcases/kernel/device-drivers/nvme/Makefile
> +# Copyright (c) 2024 IBM Corporation

This file is new and added in 2026; the copyright year must match the
year of creation. Change 2024 -> 2026.

[...]

> +static int nvme_device_found;
> +static char nvme_dev_name[256];

[...]

> +static void run(unsigned int n)
> +{
> +	/* Reset state for each iteration */
> +	nvme_device_found = 0;
> +	memset(nvme_dev_name, 0, sizeof(nvme_dev_name));
> +
> +	switch (n) {
> +	case 0:
> +		test_detect_nvme_controllers();
> +		break;
> +	case 1:
> +		test_enumerate_namespaces();

With .tcnt = 4, each run(n) is a separate call, so the reset at the top
zeroes out nvme_device_found before cases 1-3 can use the value set by
case 0. On a machine with NVMe hardware, cases 1-3 always TCONF. Move
the device discovery into setup() so the state persists across all run()
invocations.

---
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/25150858409

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