Skip to content

Commit f14914d

Browse files
igawkawasaki
authored andcommitted
nvme/039: use nvme --no-ioctl-probing when available
nvme-cli 3.x uses the 64-bit IOCTL interface when it's available. It uses a IOCTL to probe if it is available. The test relies that after setting up the error injection the next ioctl is the expected one (either IO or ADMIN command). Thus new probing breaks the test case. nvme-cli 3. introduce a --no-ioctl-probing global command line option which disables this feature and the 32-bit IOCTL interface will be used without probing. Link: #227 Link: #224 Signed-off-by: Daniel Wagner <[email protected]> Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
1 parent b5b6993 commit f14914d

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

tests/nvme/039

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,28 @@ last_dmesg()
3131
| sed 's/\[.*\] //'
3232
}
3333

34+
_nvme_admin_passthru()
35+
{
36+
local opt_args=()
37+
38+
if nvme admin-passthru --help 2>&1 | grep -q -- '--no-ioctl-probing'; then
39+
opt_args=(--no-ioctl-probing)
40+
fi
41+
42+
nvme admin-passthru "${opt_args[@]}" "$@"
43+
}
44+
45+
_nvme_io_passthru()
46+
{
47+
local opt_args=()
48+
49+
if nvme io-passthru --help 2>&1 | grep -q -- '--no-ioctl-probing'; then
50+
opt_args=(--no-ioctl-probing)
51+
fi
52+
53+
nvme io-passthru "${opt_args[@]}" "$@"
54+
}
55+
3456
inject_unrec_read_on_read()
3557
{
3658
# Inject a 'Unrecovered Read Error' (0x281) status error on a READ
@@ -97,7 +119,7 @@ inject_access_denied_on_identify()
97119
# Identify admin command
98120
_nvme_enable_err_inject "$1" 0 100 1 0x286 1
99121

100-
nvme admin-passthru /dev/"$1" --opcode=0x06 --data-len=4096 \
122+
_nvme_admin_passthru /dev/"$1" --opcode=0x06 --data-len=4096 \
101123
--cdw10=1 -r 2> /dev/null 1>&2
102124

103125
_nvme_disable_err_inject "$1"
@@ -118,7 +140,7 @@ inject_invalid_admin_cmd()
118140
# Inject a 'Invalid Command Opcode' (0x1) on an invalid command (0x96)
119141
_nvme_enable_err_inject "$1" 0 100 1 0x1 1
120142

121-
nvme admin-passthru /dev/"$1" --opcode=0x96 --data-len="${LB_SZ}" \
143+
_nvme_admin_passthru /dev/"$1" --opcode=0x96 --data-len="${LB_SZ}" \
122144
--cdw10=1 -r 2> /dev/null 1>&2
123145

124146
_nvme_disable_err_inject "$1"
@@ -143,7 +165,7 @@ inject_invalid_io_cmd_passthru()
143165
# Inject a 'Invalid Command Opcode' (0x1) on a read (0x02)
144166
_nvme_enable_err_inject "$ns_dev" 0 100 1 0x1 1
145167

146-
nvme io-passthru /dev/"$1" --opcode=0x02 --namespace-id="$ns" \
168+
_nvme_io_passthru /dev/"$1" --opcode=0x02 --namespace-id="$ns" \
147169
--data-len="${LB_SZ}" --read --cdw10=0 --cdw11=0 --cdw12="$2" 2> /dev/null 1>&2
148170

149171
_nvme_disable_err_inject "$1"

0 commit comments

Comments
 (0)