diff mbox series

[1/1] scsi: Add passthrough tests for success and no failure definitions

Message ID 20250113180757.16691-1-michael.christie@oracle.com (mailing list archive)
State New
Headers show
Series [1/1] scsi: Add passthrough tests for success and no failure definitions | expand

Commit Message

Mike Christie Jan. 13, 2025, 6:07 p.m. UTC
This patch adds scsi_check_passthrough tests for the cases where a
command completes successfully and when the command failed but the
caller did not pass in a list of failures.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/scsi/scsi_lib_test.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Bart Van Assche Jan. 15, 2025, 6:34 p.m. UTC | #1
On 1/13/25 10:07 AM, Mike Christie wrote:
> This patch adds scsi_check_passthrough tests for the cases where a
> command completes successfully and when the command failed but the
> caller did not pass in a list of failures.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_lib_test.c b/drivers/scsi/scsi_lib_test.c
index 99834426a100..ae8af0e0047a 100644
--- a/drivers/scsi/scsi_lib_test.c
+++ b/drivers/scsi/scsi_lib_test.c
@@ -67,6 +67,13 @@  static void scsi_lib_test_multiple_sense(struct kunit *test)
 	};
 	int i;
 
+	/* Success */
+	sc.result = 0;
+	KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, &failures));
+	KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, NULL));
+	/* Command failed but caller did not pass in a failures array */
+	scsi_build_sense(&sc, 0, ILLEGAL_REQUEST, 0x91, 0x36);
+	KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, NULL));
 	/* Match end of array */
 	scsi_build_sense(&sc, 0, ILLEGAL_REQUEST, 0x91, 0x36);
 	KUNIT_EXPECT_EQ(test, -EAGAIN, scsi_check_passthrough(&sc, &failures));