Skip to contentSkip to conversation

nvme: Add command timeout injection test

PATCH Superseded Keith Busch 2 participants 2 messages May 14, 2018

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: Add command timeout injection test

This test will run a background IO process and inject an admin command with a very short timeout that is all but guaranteed to expire without a completion: the async event request.

---
 tests/nvme/005     | 42 ++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/005.out |  3 +++
 2 files changed, 45 insertions(+)
 create mode 100755 tests/nvme/005
 create mode 100644 tests/nvme/005.out
tests/nvme/005 new file +42 -0
new file mode 100755
index 0000000..3fe9cbe
@@ -0,0 +1,42 @@
+#!/bin/bash
+#
+# Regression test for timeout handling.
+#
+# Copyright (C) 2018 Keith Busch
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+DESCRIPTION="test nvme admin command timeout handling with in-flight io"
+
+QUICK=1
+
+requires() {
+	_have_program nvme
+}
+
+test_device() {
+	echo "Running ${TEST_NAME}"
+
+	# start fio job
+	_run_fio_rand_io --filename="${TEST_DEV}" --time_based --runtime=20 &
+
+	sleep 5
+
+	# send nvme admin command 'async event request', which  will surely time out
+	nvme admin-passthru ${TEST_DEV} -o 0xc --timeout=1
+
+	wait
+
+	echo "Test complete"
+}
tests/nvme/005.out new file +3 -0
new file mode 100644
index 0000000..f4ff837
@@ -0,0 +1,3 @@
+Running nvme/005
+passthru: Interrupted system call
+Test complete
Signature · 1 line
2.14.3
#1 lore raw
Quoted 3 lines · Keith Busch

This test will run a background IO process and inject an admin command with a very short timeout that is all but guaranteed to expire without a completion: the async event request.

Thanks, a few comments below.

Quoted 14 lines
Signed-off-by Keith Busch <keith.busch at intel.com>
---
 tests/nvme/005     | 42 ++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/005.out |  3 +++
 2 files changed, 45 insertions(+)
 create mode 100755 tests/nvme/005
 create mode 100644 tests/nvme/005.out
tests/nvme/005 new file +0 -0
new file mode 100755
index 0000000..3fe9cbe

tests/nvme/005 line 3

Quoted 3 lines
tests/nvme/005 new file +3 -0
@@ -0,0 +1,42 @@
+#!/bin/bash
+#
+# Regression test for timeout handling.

Is there a specific patch that this is testing? If so, could you add:

Regression test for patch "so and so".

Quoted 11 lines
tests/nvme/005 new file +11 -0
+# Copyright (C) 2018 Keith Busch
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.

tests/nvme/005 line 25

Quoted 10 lines
tests/nvme/005 new file +10 -0
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+DESCRIPTION="test nvme admin command timeout handling with in-flight io"
+
+QUICK=1
+
+requires() {
+	_have_program nvme

Also needs && _have_fio.

tests/nvme/005 line 37

Quoted 12 lines
tests/nvme/005 new file +12 -0
+}
+
+test_device() {
+	echo "Running ${TEST_NAME}"
+
+	# start fio job
+	_run_fio_rand_io --filename="${TEST_DEV}" --time_based --runtime=20 &
+
+	sleep 5
+
+	# send nvme admin command 'async event request', which  will surely time out
+	nvme admin-passthru ${TEST_DEV} -o 0xc --timeout=1

Missing quotes around ${TEST_DEV}.

Quoted 16 lines
tests/nvme/005 new file +4 -0
+	wait
+
+	echo "Test complete"
+}
tests/nvme/005.out new file +3 -0
new file mode 100644
index 0000000..f4ff837
@@ -0,0 +1,3 @@
+Running nvme/005
+passthru: Interrupted system call
+Test complete
Signature · 1 line
2.14.3