File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed
Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 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 nlbaf olbaf clbaf
22+ local iteration=10 i=0
23+
24+ olbaf=$( nvme id-ns " $TEST_DEV " | grep " in use" | awk ' {print $2}' )
25+ nlbaf=$( nvme id-ns --output-format=json " $TEST_DEV " | jq ' .nlbaf' )
26+
27+ for lbaf in $( seq 0 " $nlbaf " ) ; do
28+ nvme format --lbaf=" $lbaf " --force " $TEST_DEV " >> " ${FULL} "
29+ while (( i < iteration )) ; do
30+ if [ ! -b " $TEST_DEV " ]; then
31+ sleep 0.2
32+ (( i++ ))
33+ else
34+ break
35+ fi
36+ done
37+
38+ clbaf=$( nvme id-ns " $TEST_DEV " | grep " in use" | awk ' {print $2}' )
39+ if [ " $clbaf " -ne " $lbaf " ]; then
40+ echo " $TEST_DEV formatted to lbaf:$clbaf , expected:$lbaf "
41+ fi
42+ done
43+
44+ # Restore to the original lbaf
45+ nvme format --lbaf=" $olbaf " --force " $TEST_DEV " >> " ${FULL} "
46+
47+ udevadm settle
48+
49+ echo " Test complete"
50+ }
Original file line number Diff line number Diff line change 1+ Running nvme/065
2+ Test complete
You can’t perform that action at this time.
0 commit comments