Skip to content

Commit c91107c

Browse files
committed
nvme/065: add nvme format test with supported LBA format
Link: https://lore.kernel.org/linux-nvme/20250611055432.2401372-1-hch@lst.de/ Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
1 parent 401420a commit c91107c

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

tests/nvme/065

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: GPL-3.0+
3+
# Copyright (C) 2025 Yi Zhang <yi.zhang@redhat.com>
4+
#
5+
# Test nvme format NVMe disk with supported LBA format
6+
#
7+
8+
. tests/nvme/rc
9+
10+
DESCRIPTION="Test nvme format NVMe disk with supported LBA format"
11+
QUICK=1
12+
13+
requires() {
14+
_nvme_requires
15+
_have_program jq
16+
}
17+
18+
test_device() {
19+
echo "Running ${TEST_NAME}"
20+
21+
local flbas nlbaf lbaf
22+
23+
flbas=$(nvme id-ns --output-format=json "$TEST_DEV" | jq '.flbas')
24+
nlbaf=$(nvme id-ns --output-format=json "$TEST_DEV" | jq '.nlbaf')
25+
26+
for lbaf in $(seq 0 "$nlbaf"); do
27+
nvme format --lbaf="$lbaf" --force "$TEST_DEV" >> "${FULL}"
28+
done
29+
30+
# Restore to the original lbaf
31+
nvme format --lbaf="$flbas" --force "$TEST_DEV" >> "${FULL}"
32+
33+
udevadm settle
34+
35+
echo "Test complete"
36+
}

tests/nvme/065.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Running nvme/065
2+
Test complete

0 commit comments

Comments
 (0)