Repository navigation
tests: add netapp mock-test and fuzz coverage - #4487
Merged
Merged
Conversation
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>
Collaborator
|
Nice! Thanks a lot! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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