TESTS: Flag a whole bunch of tests as not supported on non-iSCSI backends

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
Ronnie Sahlberg
2014-09-27 08:58:24 -07:00
parent abbf9a11b0
commit 45d87238e2
35 changed files with 384 additions and 24 deletions
+4 -2
View File
@@ -1653,7 +1653,7 @@ preventallow(struct scsi_device *sdev, int prevent)
} }
int int
read6(struct scsi_device *sdev, uint32_t lba, read6(struct scsi_device *sdev, struct scsi_task **out_task, uint32_t lba,
uint32_t datalen, int blocksize, uint32_t datalen, int blocksize,
unsigned char *data, unsigned char *data,
int status, enum scsi_sense_key key, int *ascq, int num_ascq) int status, enum scsi_sense_key key, int *ascq, int num_ascq)
@@ -1674,7 +1674,9 @@ read6(struct scsi_device *sdev, uint32_t lba,
if (data && task) { if (data && task) {
memcpy(data, task->datain.data, task->datain.size); memcpy(data, task->datain.data, task->datain.size);
} }
if (task) { if (out_task) {
*out_task = task;
} else if (task) {
scsi_free_scsi_task(task); scsi_free_scsi_task(task);
} }
return ret; return ret;
+1 -1
View File
@@ -277,7 +277,7 @@ int orwrite(struct scsi_device *sdev, uint64_t lba, uint32_t datalen, int blocks
int prefetch10(struct scsi_device *sdev, uint32_t lba, int num_blocks, int immed, int group, int status, enum scsi_sense_key key, int *ascq, int num_ascq); int prefetch10(struct scsi_device *sdev, uint32_t lba, int num_blocks, int immed, int group, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int prefetch16(struct scsi_device *sdev, uint64_t lba, int num_blocks, int immed, int group, int status, enum scsi_sense_key key, int *ascq, int num_ascq); int prefetch16(struct scsi_device *sdev, uint64_t lba, int num_blocks, int immed, int group, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int preventallow(struct scsi_device *sdev, int prevent); int preventallow(struct scsi_device *sdev, int prevent);
int read6(struct scsi_device *sdev, uint32_t lba, uint32_t datalen, int blocksize, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq); int read6(struct scsi_device *sdev, struct scsi_task **task, uint32_t lba, uint32_t datalen, int blocksize, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int read10(struct scsi_device *sdev, struct scsi_task **task, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq); int read10(struct scsi_device *sdev, struct scsi_task **task, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int read12(struct scsi_device *sdev, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq); int read12(struct scsi_device *sdev, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int read16(struct scsi_device *sdev, uint64_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq); int read16(struct scsi_device *sdev, uint64_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
+8
View File
@@ -51,6 +51,14 @@ void test_iscsi_cmdsn_toohigh(void)
logging(LOG_VERBOSE, "Test sending invalid iSCSI CMDSN"); logging(LOG_VERBOSE, "Test sending invalid iSCSI CMDSN");
logging(LOG_VERBOSE, "CMDSN MUST be in the range EXPCMDSN and MAXCMDSN"); logging(LOG_VERBOSE, "CMDSN MUST be in the range EXPCMDSN and MAXCMDSN");
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
logging(LOG_VERBOSE, "RFC3720:3.2.2.1 CMDSN > MAXCMDSN must be silently ignored by the target"); logging(LOG_VERBOSE, "RFC3720:3.2.2.1 CMDSN > MAXCMDSN must be silently ignored by the target");
logging(LOG_VERBOSE, "Send a TESTUNITREADY with CMDSN == MAXCMDSN+1. Should be ignored by the target."); logging(LOG_VERBOSE, "Send a TESTUNITREADY with CMDSN == MAXCMDSN+1. Should be ignored by the target.");
+8
View File
@@ -51,6 +51,14 @@ void test_iscsi_cmdsn_toolow(void)
logging(LOG_VERBOSE, "Test sending invalid iSCSI CMDSN"); logging(LOG_VERBOSE, "Test sending invalid iSCSI CMDSN");
logging(LOG_VERBOSE, "CMDSN MUST be in the range EXPCMDSN and MAXCMDSN"); logging(LOG_VERBOSE, "CMDSN MUST be in the range EXPCMDSN and MAXCMDSN");
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
logging(LOG_VERBOSE, "RFC3720:3.2.2.1 CMDSN < EXPCMDSN must be silently ignored by the target"); logging(LOG_VERBOSE, "RFC3720:3.2.2.1 CMDSN < EXPCMDSN must be silently ignored by the target");
logging(LOG_VERBOSE, "Send a TESTUNITREADY with CMDSN == EXPCMDSN-1. Should be ignored by the target."); logging(LOG_VERBOSE, "Send a TESTUNITREADY with CMDSN == EXPCMDSN-1. Should be ignored by the target.");
+7
View File
@@ -65,6 +65,13 @@ void test_iscsi_datasn_invalid(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test sending invalid iSCSI DATASN"); logging(LOG_VERBOSE, "Test sending invalid iSCSI DATASN");
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
logging(LOG_VERBOSE, "Send 2 DATAIN with DATASN==0. Should fail."); logging(LOG_VERBOSE, "Send 2 DATAIN with DATASN==0. Should fail.");
change_datasn = 1; change_datasn = 1;
@@ -36,6 +36,14 @@ test_preventallow_2_itnexuses(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that PREVENT MEDIUM REMOVAL are seen on other nexuses as well"); logging(LOG_VERBOSE, "Test that PREVENT MEDIUM REMOVAL are seen on other nexuses as well");
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This PREVENTALLOW test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
logging(LOG_VERBOSE, "Set the PREVENT flag"); logging(LOG_VERBOSE, "Set the PREVENT flag");
ret = preventallow(sd, 1); ret = preventallow(sd, 1);
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
+8
View File
@@ -35,6 +35,14 @@ test_preventallow_cold_reset(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that Target Warm Reset clears PREVENT MEDIUM REMOVAL"); logging(LOG_VERBOSE, "Test that Target Warm Reset clears PREVENT MEDIUM REMOVAL");
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This PREVENTALLOW test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
logging(LOG_VERBOSE, "Set the PREVENT flag"); logging(LOG_VERBOSE, "Set the PREVENT flag");
ret = preventallow(sd, 1); ret = preventallow(sd, 1);
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
@@ -35,6 +35,14 @@ test_preventallow_itnexus_loss(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that IT-Nexus loss clears PREVENT MEDIUM REMOVAL"); logging(LOG_VERBOSE, "Test that IT-Nexus loss clears PREVENT MEDIUM REMOVAL");
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This PREVENTALLOW test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
logging(LOG_VERBOSE, "Set the PREVENT flag"); logging(LOG_VERBOSE, "Set the PREVENT flag");
ret = preventallow(sd, 1); ret = preventallow(sd, 1);
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
+8
View File
@@ -35,6 +35,14 @@ test_preventallow_logout(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that Logout loss clears PREVENT MEDIUM REMOVAL"); logging(LOG_VERBOSE, "Test that Logout loss clears PREVENT MEDIUM REMOVAL");
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This PREVENTALLOW test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
logging(LOG_VERBOSE, "Set the PREVENT flag"); logging(LOG_VERBOSE, "Set the PREVENT flag");
ret = preventallow(sd, 1); ret = preventallow(sd, 1);
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
+8
View File
@@ -35,6 +35,14 @@ test_preventallow_lun_reset(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that Target Warm Reset clears PREVENT MEDIUM REMOVAL"); logging(LOG_VERBOSE, "Test that Target Warm Reset clears PREVENT MEDIUM REMOVAL");
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This PREVENTALLOW test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
logging(LOG_VERBOSE, "Set the PREVENT flag"); logging(LOG_VERBOSE, "Set the PREVENT flag");
ret = preventallow(sd, 1); ret = preventallow(sd, 1);
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
+8
View File
@@ -35,6 +35,14 @@ test_preventallow_warm_reset(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that Target Warm Reset clears PREVENT MEDIUM REMOVAL"); logging(LOG_VERBOSE, "Test that Target Warm Reset clears PREVENT MEDIUM REMOVAL");
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This PREVENTALLOW test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
logging(LOG_VERBOSE, "Set the PREVENT flag"); logging(LOG_VERBOSE, "Set the PREVENT flag");
ret = preventallow(sd, 1); ret = preventallow(sd, 1);
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
+72 -6
View File
@@ -124,7 +124,18 @@ test_prout_reserve_access_ea(void)
{ {
struct scsi_device sd2; struct scsi_device sd2;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun); if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This PERSISTENT RESERVE test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_url = sd->iscsi_url;
sd2.iscsi_lun = sd->iscsi_lun;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd2.iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) { if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target"); logging(LOG_VERBOSE, "Failed to login to target");
return; return;
@@ -140,7 +151,18 @@ test_prout_reserve_access_we(void)
{ {
struct scsi_device sd2; struct scsi_device sd2;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun); if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This PERSISTENT RESERVE test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_url = sd->iscsi_url;
sd2.iscsi_lun = sd->iscsi_lun;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd2.iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) { if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target"); logging(LOG_VERBOSE, "Failed to login to target");
return; return;
@@ -156,7 +178,18 @@ test_prout_reserve_access_earo(void)
{ {
struct scsi_device sd2; struct scsi_device sd2;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun); if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This PERSISTENT RESERVE test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_url = sd->iscsi_url;
sd2.iscsi_lun = sd->iscsi_lun;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd2.iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) { if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target"); logging(LOG_VERBOSE, "Failed to login to target");
return; return;
@@ -172,7 +205,18 @@ test_prout_reserve_access_wero(void)
{ {
struct scsi_device sd2; struct scsi_device sd2;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun); if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This PERSISTENT RESERVE test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_url = sd->iscsi_url;
sd2.iscsi_lun = sd->iscsi_lun;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd2.iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) { if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target"); logging(LOG_VERBOSE, "Failed to login to target");
return; return;
@@ -188,7 +232,18 @@ test_prout_reserve_access_eaar(void)
{ {
struct scsi_device sd2; struct scsi_device sd2;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun); if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This PERSISTENT RESERVE test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_url = sd->iscsi_url;
sd2.iscsi_lun = sd->iscsi_lun;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd2.iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) { if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target"); logging(LOG_VERBOSE, "Failed to login to target");
return; return;
@@ -204,7 +259,18 @@ test_prout_reserve_access_wear(void)
{ {
struct scsi_device sd2; struct scsi_device sd2;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun); if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This PERSISTENT RESERVE test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_url = sd->iscsi_url;
sd2.iscsi_lun = sd->iscsi_lun;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd2.iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) { if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target"); logging(LOG_VERBOSE, "Failed to login to target");
return; return;
+72 -6
View File
@@ -98,7 +98,18 @@ test_prout_reserve_ownership_ea(void)
{ {
struct scsi_device sd2; struct scsi_device sd2;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun); if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This PERSISTENT RESERVE test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_url = sd->iscsi_url;
sd2.iscsi_lun = sd->iscsi_lun;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd2.iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) { if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target"); logging(LOG_VERBOSE, "Failed to login to target");
return; return;
@@ -113,7 +124,18 @@ test_prout_reserve_ownership_we(void)
{ {
struct scsi_device sd2; struct scsi_device sd2;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun); if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This PERSISTENT RESERVE test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_url = sd->iscsi_url;
sd2.iscsi_lun = sd->iscsi_lun;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd2.iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) { if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target"); logging(LOG_VERBOSE, "Failed to login to target");
return; return;
@@ -128,7 +150,18 @@ test_prout_reserve_ownership_earo(void)
{ {
struct scsi_device sd2; struct scsi_device sd2;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun); if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This PERSISTENT RESERVE test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_url = sd->iscsi_url;
sd2.iscsi_lun = sd->iscsi_lun;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd2.iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) { if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target"); logging(LOG_VERBOSE, "Failed to login to target");
return; return;
@@ -143,7 +176,18 @@ test_prout_reserve_ownership_wero(void)
{ {
struct scsi_device sd2; struct scsi_device sd2;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun); if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This PERSISTENT RESERVE test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_url = sd->iscsi_url;
sd2.iscsi_lun = sd->iscsi_lun;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd2.iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) { if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target"); logging(LOG_VERBOSE, "Failed to login to target");
return; return;
@@ -158,7 +202,18 @@ test_prout_reserve_ownership_eaar(void)
{ {
struct scsi_device sd2; struct scsi_device sd2;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun); if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This PERSISTENT RESERVE test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_url = sd->iscsi_url;
sd2.iscsi_lun = sd->iscsi_lun;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd2.iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) { if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target"); logging(LOG_VERBOSE, "Failed to login to target");
return; return;
@@ -173,7 +228,18 @@ test_prout_reserve_ownership_wear(void)
{ {
struct scsi_device sd2; struct scsi_device sd2;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun); if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This PERSISTENT RESERVE test is "
"only supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_url = sd->iscsi_url;
sd2.iscsi_lun = sd->iscsi_lun;
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd2.iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) { if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target"); logging(LOG_VERBOSE, "Failed to login to target");
return; return;
+8
View File
@@ -39,6 +39,14 @@ test_read10_invalid(void)
logging(LOG_VERBOSE, "Test invalid READ10 commands"); logging(LOG_VERBOSE, "Test invalid READ10 commands");
logging(LOG_VERBOSE, "Block size is %zu", block_size); logging(LOG_VERBOSE, "Block size is %zu", block_size);
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This READ10 test is only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
/* Try a read10 of 1 block but xferlength == 0 */ /* Try a read10 of 1 block but xferlength == 0 */
task = malloc(sizeof(struct scsi_task)); task = malloc(sizeof(struct scsi_task));
CU_ASSERT_PTR_NOT_NULL(task); CU_ASSERT_PTR_NOT_NULL(task);
+8
View File
@@ -40,6 +40,14 @@ test_read10_residuals(void)
logging(LOG_VERBOSE, "Test READ10 commands with residuals"); logging(LOG_VERBOSE, "Test READ10 commands with residuals");
logging(LOG_VERBOSE, "Block size is %zu", block_size); logging(LOG_VERBOSE, "Block size is %zu", block_size);
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This READ10 test is only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
/* Try a read10 of 1 block but xferlength == 0 */ /* Try a read10 of 1 block but xferlength == 0 */
task = malloc(sizeof(struct scsi_task)); task = malloc(sizeof(struct scsi_task));
CU_ASSERT_PTR_NOT_NULL(task); CU_ASSERT_PTR_NOT_NULL(task);
+8
View File
@@ -36,6 +36,14 @@ test_read12_residuals(void)
logging(LOG_VERBOSE, "Test READ12 commands with residuals"); logging(LOG_VERBOSE, "Test READ12 commands with residuals");
logging(LOG_VERBOSE, "Block size is %zu", block_size); logging(LOG_VERBOSE, "Block size is %zu", block_size);
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This READ12 test is only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
task = malloc(sizeof(struct scsi_task)); task = malloc(sizeof(struct scsi_task));
CU_ASSERT_PTR_NOT_NULL(task); CU_ASSERT_PTR_NOT_NULL(task);
+8
View File
@@ -36,6 +36,14 @@ test_read16_residuals(void)
logging(LOG_VERBOSE, "Test READ16 commands with residuals"); logging(LOG_VERBOSE, "Test READ16 commands with residuals");
logging(LOG_VERBOSE, "Block size is %zu", block_size); logging(LOG_VERBOSE, "Block size is %zu", block_size);
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This READ16 test is only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
task = malloc(sizeof(struct scsi_task)); task = malloc(sizeof(struct scsi_task));
CU_ASSERT_PTR_NOT_NULL(task); CU_ASSERT_PTR_NOT_NULL(task);
+3 -3
View File
@@ -38,7 +38,7 @@ test_read6_beyond_eol(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ6 1-255 blocks one block beyond the end"); logging(LOG_VERBOSE, "Test READ6 1-255 blocks one block beyond the end");
for (i = 1; i <= 255; i++) { for (i = 1; i <= 255; i++) {
ret = read6(sd, num_blocks + 1 - i, ret = read6(sd, NULL, num_blocks + 1 - i,
i * block_size, block_size, NULL, i * block_size, block_size, NULL,
EXPECT_LBA_OOB); EXPECT_LBA_OOB);
if (ret == -2) { if (ret == -2) {
@@ -52,7 +52,7 @@ test_read6_beyond_eol(void)
logging(LOG_VERBOSE, "Test READ6 1-255 blocks at LBA==0x1fffff"); logging(LOG_VERBOSE, "Test READ6 1-255 blocks at LBA==0x1fffff");
for (i = 1; i <= 255; i++) { for (i = 1; i <= 255; i++) {
ret = read6(sd, 0x1fffff, ret = read6(sd, NULL, 0x1fffff,
i * block_size, block_size, NULL, i * block_size, block_size, NULL,
EXPECT_LBA_OOB); EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
@@ -61,7 +61,7 @@ test_read6_beyond_eol(void)
logging(LOG_VERBOSE, "Test READ6 2-255 blocks all but one block beyond the end"); logging(LOG_VERBOSE, "Test READ6 2-255 blocks all but one block beyond the end");
for (i = 2; i <= 255; i++) { for (i = 2; i <= 255; i++) {
ret = read6(sd, num_blocks - 1, ret = read6(sd, NULL, num_blocks - 1,
i * block_size, block_size, NULL, i * block_size, block_size, NULL,
EXPECT_LBA_OOB); EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
+6 -5
View File
@@ -34,7 +34,7 @@ test_read6_simple(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ6 of 1-255 blocks at the start of the LUN"); logging(LOG_VERBOSE, "Test READ6 of 1-255 blocks at the start of the LUN");
for (i = 1; i <= 255; i++) { for (i = 1; i <= 255; i++) {
ret = read6(sd, 0, i * block_size, ret = read6(sd, NULL, 0, i * block_size,
block_size, NULL, block_size, NULL,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
if (ret == -2) { if (ret == -2) {
@@ -51,7 +51,7 @@ test_read6_simple(void)
CU_PASS("LUN is too big for read-at-eol tests with READ6. Skipping test.\n"); CU_PASS("LUN is too big for read-at-eol tests with READ6. Skipping test.\n");
} else { } else {
for (i = 1; i <= 255; i++) { for (i = 1; i <= 255; i++) {
ret = read6(sd, num_blocks - i, ret = read6(sd, NULL, num_blocks - i,
i * block_size, block_size, NULL, i * block_size, block_size, NULL,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
@@ -64,11 +64,12 @@ test_read6_simple(void)
logging(LOG_VERBOSE, "Test sending a READ6 with transfer length == 0 " logging(LOG_VERBOSE, "Test sending a READ6 with transfer length == 0 "
"(meaning 256 blocks)"); "(meaning 256 blocks)");
/* 256 is converted to 0 when the CDB is marshalled by the helper */ /* 256 is converted to 0 when the CDB is marshalled by the helper */
task = iscsi_read6_sync(sd->iscsi_ctx, sd->iscsi_lun, 0, ret = read6(sd, &task, 0,
256 * block_size, block_size); 256 * block_size, block_size, NULL,
EXPECT_STATUS_GOOD);
if (task->status != SCSI_STATUS_GOOD) { if (task->status != SCSI_STATUS_GOOD) {
logging(LOG_NORMAL, "[FAILED] READ6 command: " logging(LOG_NORMAL, "[FAILED] READ6 command: "
"failed with sense. %s", iscsi_get_error(sd->iscsi_ctx)); "failed with sense. %s", sd->error_str );
} }
CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD);
+7
View File
@@ -34,6 +34,13 @@ test_reserve6_2initiators(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test RESERVE6/RELEASE6 across two initiators"); logging(LOG_VERBOSE, "Test RESERVE6/RELEASE6 across two initiators");
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This RESERVE6 test is only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
logging(LOG_NORMAL, "Take out a RESERVE6 from the first initiator"); logging(LOG_NORMAL, "Take out a RESERVE6 from the first initiator");
ret = reserve6(sd); ret = reserve6(sd);
+7
View File
@@ -34,6 +34,13 @@ test_reserve6_itnexus_loss(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that RESERVE6 is released on it-nexus loss"); logging(LOG_VERBOSE, "Test that RESERVE6 is released on it-nexus loss");
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This RESERVE6 test is only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
logging(LOG_NORMAL, "Take out a RESERVE6 from the first initiator"); logging(LOG_NORMAL, "Take out a RESERVE6 from the first initiator");
ret = reserve6(sd); ret = reserve6(sd);
+7
View File
@@ -34,6 +34,13 @@ test_reserve6_logout(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that RESERVE6 is released on logout"); logging(LOG_VERBOSE, "Test that RESERVE6 is released on logout");
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This RESERVE6 test is only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
logging(LOG_NORMAL, "Take out a RESERVE6 from the first initiator"); logging(LOG_NORMAL, "Take out a RESERVE6 from the first initiator");
ret = reserve6(sd); ret = reserve6(sd);
+7
View File
@@ -34,6 +34,13 @@ test_reserve6_lun_reset(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that RESERVE6 is released on lun reset"); logging(LOG_VERBOSE, "Test that RESERVE6 is released on lun reset");
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This RESERVE6 test is only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
logging(LOG_VERBOSE, "Take out a RESERVE6 from the first initiator"); logging(LOG_VERBOSE, "Take out a RESERVE6 from the first initiator");
ret = reserve6(sd); ret = reserve6(sd);
@@ -34,6 +34,13 @@ test_reserve6_target_cold_reset(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that RESERVE6 is released on target cold reset"); logging(LOG_VERBOSE, "Test that RESERVE6 is released on target cold reset");
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This RESERVE6 test is only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
logging(LOG_VERBOSE, "Take out a RESERVE6 from the first initiator"); logging(LOG_VERBOSE, "Take out a RESERVE6 from the first initiator");
ret = reserve6(sd); ret = reserve6(sd);
@@ -34,6 +34,13 @@ test_reserve6_target_warm_reset(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that RESERVE6 is released on target warm reset"); logging(LOG_VERBOSE, "Test that RESERVE6 is released on target warm reset");
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This RESERVE6 test is only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
logging(LOG_VERBOSE, "Take out a RESERVE6 from the first initiator"); logging(LOG_VERBOSE, "Take out a RESERVE6 from the first initiator");
ret = reserve6(sd); ret = reserve6(sd);
+1 -1
View File
@@ -121,7 +121,7 @@ check_unmap(void)
if (task_ret->status != SCSI_STATUS_GOOD) { if (task_ret->status != SCSI_STATUS_GOOD) {
logging(LOG_VERBOSE, "[FAILED] Failed to read LBA mapping " logging(LOG_VERBOSE, "[FAILED] Failed to read LBA mapping "
"from the target. Sense: %s", "from the target. Sense: %s",
iscsi_get_error(sd->iscsi_ctx)); sd->error_str);
CU_FAIL("[FAILED] Failed to read LBA mapping " CU_FAIL("[FAILED] Failed to read LBA mapping "
"from the target."); "from the target.");
scsi_free_scsi_task(task_ret); scsi_free_scsi_task(task_ret);
+8
View File
@@ -40,6 +40,14 @@ test_sanitize_readonly(void)
CHECK_FOR_SANITIZE; CHECK_FOR_SANITIZE;
CHECK_FOR_DATALOSS; CHECK_FOR_DATALOSS;
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This SANITIZE test is only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
logging(LOG_VERBOSE, "Create a second connection to the target"); logging(LOG_VERBOSE, "Create a second connection to the target");
memset(&sd2, 0, sizeof(sd2)); memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_url = sd->iscsi_url; sd2.iscsi_url = sd->iscsi_url;
+8
View File
@@ -40,6 +40,14 @@ test_sanitize_reservations(void)
CHECK_FOR_SANITIZE; CHECK_FOR_SANITIZE;
CHECK_FOR_DATALOSS; CHECK_FOR_DATALOSS;
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This SANITIZE test is only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
logging(LOG_VERBOSE, "Create a second connection to the target"); logging(LOG_VERBOSE, "Create a second connection to the target");
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun); sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) { if (sd2.iscsi_ctx == NULL) {
+8
View File
@@ -46,6 +46,14 @@ test_sanitize_reset(void)
CHECK_FOR_SANITIZE; CHECK_FOR_SANITIZE;
CHECK_FOR_DATALOSS; CHECK_FOR_DATALOSS;
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This SANITIZE test is only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
logging(LOG_VERBOSE, "Check that SANITIZE OVERWRITE will continue " logging(LOG_VERBOSE, "Check that SANITIZE OVERWRITE will continue "
"even after Task/Lun/Target/* reset."); "even after Task/Lun/Target/* reset.");
cd = get_command_descriptor(SCSI_OPCODE_SANITIZE, cd = get_command_descriptor(SCSI_OPCODE_SANITIZE,
+8
View File
@@ -43,6 +43,14 @@ test_write10_residuals(void)
CHECK_FOR_DATALOSS; CHECK_FOR_DATALOSS;
CHECK_FOR_SBC; CHECK_FOR_SBC;
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This WRITE10 test is only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
/* Try a write10 of 1 block but xferlength == 0 */ /* Try a write10 of 1 block but xferlength == 0 */
task = malloc(sizeof(struct scsi_task)); task = malloc(sizeof(struct scsi_task));
CU_ASSERT_PTR_NOT_NULL(task); CU_ASSERT_PTR_NOT_NULL(task);
+8
View File
@@ -43,6 +43,14 @@ test_write12_residuals(void)
CHECK_FOR_DATALOSS; CHECK_FOR_DATALOSS;
CHECK_FOR_SBC; CHECK_FOR_SBC;
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This WRITE12 test is only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
/* Try a write12 of 1 block but xferlength == 0 */ /* Try a write12 of 1 block but xferlength == 0 */
task = malloc(sizeof(struct scsi_task)); task = malloc(sizeof(struct scsi_task));
CU_ASSERT_PTR_NOT_NULL(task); CU_ASSERT_PTR_NOT_NULL(task);
+8
View File
@@ -43,6 +43,14 @@ test_write16_residuals(void)
CHECK_FOR_DATALOSS; CHECK_FOR_DATALOSS;
CHECK_FOR_SBC; CHECK_FOR_SBC;
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This WRITE16 test is only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
/* Try a write16 of 1 block but xferlength == 0 */ /* Try a write16 of 1 block but xferlength == 0 */
task = malloc(sizeof(struct scsi_task)); task = malloc(sizeof(struct scsi_task));
CU_ASSERT_PTR_NOT_NULL(task); CU_ASSERT_PTR_NOT_NULL(task);
+8
View File
@@ -43,6 +43,14 @@ test_writeverify10_residuals(void)
CHECK_FOR_DATALOSS; CHECK_FOR_DATALOSS;
CHECK_FOR_SBC; CHECK_FOR_SBC;
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This WRITEVERIFY10 test is only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
/* check if writeverify10 is supported */ /* check if writeverify10 is supported */
ret = writeverify10(sd, 0, 0, ret = writeverify10(sd, 0, 0,
block_size, 0, 0, 0, 0, NULL, block_size, 0, 0, 0, 0, NULL,
+8
View File
@@ -43,6 +43,14 @@ test_writeverify12_residuals(void)
CHECK_FOR_DATALOSS; CHECK_FOR_DATALOSS;
CHECK_FOR_SBC; CHECK_FOR_SBC;
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This WRITEVERIFY12 test is only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
/* check if writeverify12 is supported */ /* check if writeverify12 is supported */
ret = writeverify12(sd, 0, 0, ret = writeverify12(sd, 0, 0,
block_size, 0, 0, 0, 0, NULL, block_size, 0, 0, 0, 0, NULL,
+16
View File
@@ -43,6 +43,14 @@ test_writeverify16_residuals(void)
CHECK_FOR_DATALOSS; CHECK_FOR_DATALOSS;
CHECK_FOR_SBC; CHECK_FOR_SBC;
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] This WRITEVERIFY16 test is only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
/* check if writeverify16 is supported */ /* check if writeverify16 is supported */
ret = writeverify16(sd, 0, 0, ret = writeverify16(sd, 0, 0,
block_size, 0, 0, 0, 0, NULL, block_size, 0, 0, 0, 0, NULL,
@@ -53,6 +61,14 @@ test_writeverify16_residuals(void)
return; return;
} }
if (sd->iscsi_ctx == NULL) {
const char *err = "[SKIPPED] WRITEVERIFY16 tests are only "
"supported for iSCSI backends";
logging(LOG_NORMAL, "%s", err);
CU_PASS(err);
return;
}
/* Try a writeverify16 of 1 block but xferlength == 0 */ /* Try a writeverify16 of 1 block but xferlength == 0 */
task = malloc(sizeof(struct scsi_task)); task = malloc(sizeof(struct scsi_task));
CU_ASSERT_PTR_NOT_NULL(task); CU_ASSERT_PTR_NOT_NULL(task);