TESTS: cleanup and remove noise warnings for iscsi cmdsn tests
The iscsi cmdsn tests are noisy and generate a lot of [FAILURE] warnings for things that are expected. Fix this by do the plumbing to allow using a EXPECT_STATUS_TIMEOUT for commands we expect will never be replied to and will thus time out. Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
@@ -145,14 +145,15 @@ int all_zero(const unsigned char *buf, unsigned size)
|
|||||||
static const char *scsi_status_str(int status)
|
static const char *scsi_status_str(int status)
|
||||||
{
|
{
|
||||||
switch(status) {
|
switch(status) {
|
||||||
case SCSI_STATUS_GOOD: return "SUCCESS";
|
case SCSI_STATUS_GOOD: return "SUCCESS";
|
||||||
case SCSI_STATUS_CHECK_CONDITION: return "CHECK_CONDITION";
|
case SCSI_STATUS_TIMEOUT: return "TIMEOUT";
|
||||||
case SCSI_STATUS_CONDITION_MET: return "CONDITIONS_MET";
|
case SCSI_STATUS_CHECK_CONDITION: return "CHECK_CONDITION";
|
||||||
case SCSI_STATUS_BUSY: return "BUSY";
|
case SCSI_STATUS_CONDITION_MET: return "CONDITIONS_MET";
|
||||||
case SCSI_STATUS_RESERVATION_CONFLICT: return "RESERVATION_CONFLICT";
|
case SCSI_STATUS_BUSY: return "BUSY";
|
||||||
case SCSI_STATUS_TASK_SET_FULL: return "TASK_SET_FULL";
|
case SCSI_STATUS_RESERVATION_CONFLICT: return "RESERVATION_CONFLICT";
|
||||||
case SCSI_STATUS_ACA_ACTIVE: return "ACA_ACTIVE";
|
case SCSI_STATUS_TASK_SET_FULL: return "TASK_SET_FULL";
|
||||||
case SCSI_STATUS_TASK_ABORTED: return "TASK_ABORTED";
|
case SCSI_STATUS_ACA_ACTIVE: return "ACA_ACTIVE";
|
||||||
|
case SCSI_STATUS_TASK_ABORTED: return "TASK_ABORTED";
|
||||||
}
|
}
|
||||||
return "UNKNOWN";
|
return "UNKNOWN";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ extern const char *initiatorname1;
|
|||||||
extern const char *initiatorname2;
|
extern const char *initiatorname2;
|
||||||
|
|
||||||
#define EXPECT_STATUS_GOOD SCSI_STATUS_GOOD, SCSI_SENSE_NO_SENSE, NULL, 0
|
#define EXPECT_STATUS_GOOD SCSI_STATUS_GOOD, SCSI_SENSE_NO_SENSE, NULL, 0
|
||||||
|
#define EXPECT_STATUS_TIMEOUT SCSI_STATUS_TIMEOUT, SCSI_SENSE_NO_SENSE, NULL, 0
|
||||||
#define EXPECT_NO_MEDIUM SCSI_STATUS_CHECK_CONDITION, SCSI_SENSE_NOT_READY, no_medium_ascqs, 3
|
#define EXPECT_NO_MEDIUM SCSI_STATUS_CHECK_CONDITION, SCSI_SENSE_NOT_READY, no_medium_ascqs, 3
|
||||||
#define EXPECT_LBA_OOB SCSI_STATUS_CHECK_CONDITION, SCSI_SENSE_ILLEGAL_REQUEST, lba_oob_ascqs, 1
|
#define EXPECT_LBA_OOB SCSI_STATUS_CHECK_CONDITION, SCSI_SENSE_ILLEGAL_REQUEST, lba_oob_ascqs, 1
|
||||||
#define EXPECT_INVALID_FIELD_IN_CDB SCSI_STATUS_CHECK_CONDITION, SCSI_SENSE_ILLEGAL_REQUEST, invalid_cdb_ascqs,2
|
#define EXPECT_INVALID_FIELD_IN_CDB SCSI_STATUS_CHECK_CONDITION, SCSI_SENSE_ILLEGAL_REQUEST, invalid_cdb_ascqs,2
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ void test_iscsi_cmdsn_toohigh(void)
|
|||||||
iscsi_set_timeout(sd->iscsi_ctx, 3);
|
iscsi_set_timeout(sd->iscsi_ctx, 3);
|
||||||
|
|
||||||
ret = testunitready(sd,
|
ret = testunitready(sd,
|
||||||
EXPECT_STATUS_GOOD);
|
EXPECT_STATUS_TIMEOUT);
|
||||||
CU_ASSERT_EQUAL(ret, -1);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
if (ret == -1) {
|
if (ret == 0) {
|
||||||
logging(LOG_VERBOSE, "[SUCCESS] We did not receive a reply");
|
logging(LOG_VERBOSE, "[SUCCESS] We did not receive a reply");
|
||||||
} else {
|
} else {
|
||||||
logging(LOG_VERBOSE, "[FAILURE] We got a response from the target but SMDSN was outside of the window.");
|
logging(LOG_VERBOSE, "[FAILURE] We got a response from the target but SMDSN was outside of the window.");
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ void test_iscsi_cmdsn_toolow(void)
|
|||||||
iscsi_set_timeout(sd->iscsi_ctx, 3);
|
iscsi_set_timeout(sd->iscsi_ctx, 3);
|
||||||
|
|
||||||
ret = testunitready(sd,
|
ret = testunitready(sd,
|
||||||
EXPECT_STATUS_GOOD);
|
EXPECT_STATUS_TIMEOUT);
|
||||||
CU_ASSERT_EQUAL(ret, -1);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
if (ret == -1) {
|
if (ret == 0) {
|
||||||
logging(LOG_VERBOSE, "[SUCCESS] We did not receive a reply");
|
logging(LOG_VERBOSE, "[SUCCESS] We did not receive a reply");
|
||||||
} else {
|
} else {
|
||||||
logging(LOG_VERBOSE, "[FAILURE] We got a response from the target but SMDSN was outside of the window.");
|
logging(LOG_VERBOSE, "[FAILURE] We got a response from the target but SMDSN was outside of the window.");
|
||||||
|
|||||||
Reference in New Issue
Block a user