aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Christie <[email protected]>2025-01-13 18:07:57 +0000
committerMartin K. Petersen <[email protected]>2025-01-21 17:16:17 +0000
commitb893d7ff853e27aa6000fc4ca12e0ffda3318bfc (patch)
treef58df821f3abfbef0031310bc413bf114b69a87f
parentMerge patch series "Introduce support for Fabric Discovery and Login Services" (diff)
downloadkernel-b893d7ff853e27aa6000fc4ca12e0ffda3318bfc.tar.gz
kernel-b893d7ff853e27aa6000fc4ca12e0ffda3318bfc.zip
scsi: core: Add passthrough tests for success and no failure definitions
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
-rw-r--r--drivers/scsi/scsi_lib_test.c7
1 files changed, 7 insertions, 0 deletions
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));