Skip to content

tests: add netapp mock-test and fuzz coverage - #4487

Merged
igaw merged 2 commits into
linux-nvme:masterfrom
martin-gpy:ntap_dev_fuzz
Dec 2, 2026
Merged

igaw merged 2 commits into
linux-nvme:masterfrom
martin-gpy:ntap_dev_fuzz

Conversation

@martin-gpy

Copy link
Copy Markdown
Contributor

The NetApp smdevices and ontapdevices commands were run by no test, leaving about 5% of the plugin covered. This series adds
hardware-free coverage for both:

  • A device-info test decodes real vendor data for an explicitly selected namespace: the E-Series array and volume labels, access state and volume ID, and the ONTAP vserver, subsystem, namespace path and UUID, in normal, column and JSON form. It also covers the nsinfo log paths (with and without the namespace path TLV, a non-nsinfo log, a missing vserver/volume/namespace TLV, a missing subsystem name and a truncated log) and the Identify/Get Log Page failures of the per-device info gathering of both commands.

  • The device fuzz target gains both commands, so the E-Series label and the ONTAP nsinfo TLV parsing run on fuzzed device data, seeded from the device-info test. The normal, column, verbose and JSON printers are all reached.

This is test-only; there is no change to the nvme-cli binary. Resolves #4315

The netapp smdevices and ontapdevices commands had no test that decoded
real device data, so the E-Series label parsing and the ONTAP nsinfo log
parsing were never exercised.

Add a mock test that feeds vendor-specific Identify data and a C2 nsinfo
log for an explicitly selected namespace and checks the decoded output:
the E-Series array and volume labels, access state and volume ID, and
the ONTAP vserver, subsystem, namespace path and UUID, in normal, column
and JSON form. Cover the nsinfo paths with and without the namespace
path TLV, a non-nsinfo log, a missing vserver/volume/namespace TLV, a
missing subsystem name, a truncated log, and the Identify/Get Log Page
failures of the per-device info gathering of both commands.

This uses the standard /dev/nvme0n1 the mock maps, so nvme-fuzz seeds
can record its valid device data as seeds of the device fuzz target.

Link: linux-nvme#4315
Signed-off-by: Martin George <marting@netapp.com>
The netapp smdevices and ontapdevices commands decode vendor-specific
data the device returns: the E-Series Identify labels, and the ONTAP C2
nsinfo log, whose length-delimited TLVs are parsed with offsets and
lengths taken from the log itself. Nothing fuzzed that.

Add both to the device fuzz target. They enumerate /dev themselves, but
given the namespace device the target passes they query that one device
instead, whose answers are the fuzz input, so the parsers run on it.
Make the stat() of that device succeed (MOCK_NVME_STAT_PATH), which the
commands do before opening it. The verbose and JSON printers are reached
through the variant byte the target already applies; a column option set
reaches the remaining column printers. nvme-fuzz seeds records the
netapp mock tests as the seed corpus.

Link: linux-nvme#4315
Signed-off-by: Martin George <marting@netapp.com>
@igaw
igaw merged commit 8da15ec into linux-nvme:master Dec 2, 2026
39 checks passed
@igaw

igaw commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Nice! Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests: NetApp plugin commands without mock tests

2 participants