Skip to content

Commit b893d7f

Browse files
mikechristiemartinkpetersen
authored andcommitted
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 <michael.christie@oracle.com> Link: https://lore.kernel.org/r/20250113180757.16691-1-michael.christie@oracle.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 7d6f88e commit b893d7f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/scsi/scsi_lib_test.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ static void scsi_lib_test_multiple_sense(struct kunit *test)
6767
};
6868
int i;
6969

70+
/* Success */
71+
sc.result = 0;
72+
KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, &failures));
73+
KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, NULL));
74+
/* Command failed but caller did not pass in a failures array */
75+
scsi_build_sense(&sc, 0, ILLEGAL_REQUEST, 0x91, 0x36);
76+
KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, NULL));
7077
/* Match end of array */
7178
scsi_build_sense(&sc, 0, ILLEGAL_REQUEST, 0x91, 0x36);
7279
KUNIT_EXPECT_EQ(test, -EAGAIN, scsi_check_passthrough(&sc, &failures));

0 commit comments

Comments
 (0)