[PATCH blktests] nvme: test log page offsets

Keith Busch
2024-02-05T18:52:44Z

From: Keith Busch <kbusch@kernel.org>

I've encountered a device that fails catastrophically if the host
requests to an error log with a non-zero LPO. The fallout has been bad
enough to warrant a sanity check against this scenario.

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
tests/nvme/051 | 26 ++++++++++++++++++++++++++
tests/nvme/051.out | 2 ++
2 files changed, 28 insertions(+)
create mode 100755 tests/nvme/051
create mode 100644 tests/nvme/051.out

diff --git a/tests/nvme/051 b/tests/nvme/051
new file mode 100755
index 0000000..ef30ad8
--- /dev/null
+++ b/tests/nvme/051
@@ -0,0 +1,26 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2024 Keith Busch
+
+. tests/nvme/rc
+
+DESCRIPTION="Tests device support for log page offsets"
+CAN_BE_ZONED=1
+QUICK=1
+
+requires() {
+ _nvme_requires
+}
+
+test_device() {
+ echo "Running ${TEST_NAME}"
+
+ lpa=$(sudo nvme id-ctrl "${TEST_DEV}" | grep lpa | cut -d":" -f 2 | xargs)
+ lpo=$((lpa & 0x4))
+
+ if [ $lpo -ne 0 ]; then
+ nvme get-log "${TEST_DEV}" --log-id=1 --log-len=128 --lpo=0x1000 > /dev/NULL
+ fi
+
+ echo "Test complete"
+}
diff --git a/tests/nvme/051.out b/tests/nvme/051.out
new file mode 100644
index 0000000..156f068
--- /dev/null
+++ b/tests/nvme/051.out
@@ -0,0 +1,2 @@
+Running nvme/051
+Test complete
--
2.34.1