TESTS: keep the unmarshalled std inq structure around
This commit is contained in:
@@ -43,12 +43,12 @@ int T0103_read10_rdprotect(const char *initiator, const char *url)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
printf("LUN is not SBC device. Skipping test\n");
|
||||
if (inq->device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
logging(LOG_VERBOSE, "[SKIPPED] Not SBC device."
|
||||
" Skipping test");
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
ret = 0;
|
||||
|
||||
/* Try out Different non-zero values for RDPROTECT. They should all fail */
|
||||
|
||||
@@ -47,13 +47,12 @@ int T0104_read10_flags(const char *initiator, const char *url)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* This test is only valid for SBC devices */
|
||||
if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
printf("LUN is not SBC device. Skipping test\n");
|
||||
if (inq->device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
logging(LOG_VERBOSE, "[SKIPPED] Not SBC device."
|
||||
" Skipping test");
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
ret = 0;
|
||||
|
||||
|
||||
|
||||
@@ -44,13 +44,12 @@ int T0202_read16_flags(const char *initiator, const char *url)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* This test is only valid for SBC devices */
|
||||
if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
printf("LUN is not SBC device. Skipping test\n");
|
||||
if (inq->device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
logging(LOG_VERBOSE, "[SKIPPED] Not SBC device."
|
||||
" Skipping test");
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
printf("Read16 with DPO ");
|
||||
task = iscsi_read16_sync(iscsi, lun, 0, block_size, block_size, 0, 1, 0, 0, 0);
|
||||
if (task == NULL) {
|
||||
|
||||
@@ -44,13 +44,12 @@ int T0212_read12_flags(const char *initiator, const char *url)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* This test is only valid for SBC devices */
|
||||
if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
printf("LUN is not SBC device. Skipping test\n");
|
||||
if (inq->device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
logging(LOG_VERBOSE, "[SKIPPED] Not SBC device."
|
||||
" Skipping test");
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
printf("Read12 with DPO ");
|
||||
task = iscsi_read12_sync(iscsi, lun, 0, block_size, block_size, 0, 1, 0, 0, 0);
|
||||
if (task == NULL) {
|
||||
|
||||
@@ -45,13 +45,12 @@ int T0222_write16_flags(const char *initiator, const char *url)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* This test is only valid for SBC devices */
|
||||
if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
printf("LUN is not SBC device. Skipping test\n");
|
||||
if (inq->device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
logging(LOG_VERBOSE, "[SKIPPED] Not SBC device."
|
||||
" Skipping test");
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
printf("Write16 with DPO ");
|
||||
task = iscsi_write16_sync(iscsi, lun, 0, data, block_size, block_size, 0, 1, 0, 0, 0);
|
||||
if (task == NULL) {
|
||||
|
||||
@@ -45,13 +45,12 @@ int T0232_write12_flags(const char *initiator, const char *url)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* This test is only valid for SBC devices */
|
||||
if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
printf("LUN is not SBC device. Skipping test\n");
|
||||
if (inq->device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
logging(LOG_VERBOSE, "[SKIPPED] Not SBC device."
|
||||
" Skipping test");
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
printf("Write12 with DPO ");
|
||||
task = iscsi_write12_sync(iscsi, lun, 0, data, block_size, block_size, 0, 1, 0, 0, 0);
|
||||
if (task == NULL) {
|
||||
|
||||
@@ -45,13 +45,12 @@ int T0292_write10_flags(const char *initiator, const char *url)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* This test is only valid for SBC devices */
|
||||
if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
printf("LUN is not SBC device. Skipping test\n");
|
||||
if (inq->device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
logging(LOG_VERBOSE, "[SKIPPED] Not SBC device."
|
||||
" Skipping test");
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
printf("Write10 with DPO ");
|
||||
task = iscsi_write10_sync(iscsi, lun, 0, data, block_size, block_size, 0, 1, 0, 0, 0);
|
||||
if (task == NULL) {
|
||||
|
||||
@@ -59,15 +59,14 @@ int T0300_readonly(const char *initiator, const char *url)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!data_loss) {
|
||||
printf("--dataloss flag is not set. Skipping test\n");
|
||||
ret = -2;
|
||||
goto finished;
|
||||
if (inq->device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
logging(LOG_VERBOSE, "[SKIPPED] Not SBC device."
|
||||
" Skipping test");
|
||||
return -2;
|
||||
}
|
||||
|
||||
/* This test is only valid for SBC devices */
|
||||
if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
printf("LUN is not SBC device. Skipping test\n");
|
||||
if (!data_loss) {
|
||||
logging(LOG_VERBOSE, "[SKIPPED] --dataloss flag not set."
|
||||
" Skipping test");
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ int T0360_startstopunit_simple(const char *initiator, const char *url)
|
||||
ret = 0;
|
||||
|
||||
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
printf("Media is removable. STARTSTOPUNIT should work\n");
|
||||
} else {
|
||||
printf("Media is not removable. STARTSTOPUNIT should fail\n");
|
||||
@@ -80,7 +80,7 @@ int T0360_startstopunit_simple(const char *initiator, const char *url)
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
printf("Medium is removable. Check with TESTUNITREADY that was removed.\n");
|
||||
ret = testunitready_nomedium(iscsi, lun);
|
||||
if (ret != 0) {
|
||||
@@ -138,7 +138,7 @@ int T0360_startstopunit_simple(const char *initiator, const char *url)
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
printf("Medium is removable. Check with TESTUNITREADY that was removed.\n");
|
||||
ret = testunitready_nomedium(iscsi, lun);
|
||||
if (ret != 0) {
|
||||
|
||||
@@ -53,7 +53,7 @@ int T0361_startstopunit_pwrcnd(const char *initiator, const char *url)
|
||||
ret = 0;
|
||||
|
||||
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
printf("Media is removable. STARTSTOPUNIT should work\n");
|
||||
} else {
|
||||
printf("Media is not removable. STARTSTOPUNIT should fail\n");
|
||||
|
||||
@@ -59,7 +59,7 @@ int T0362_startstopunit_noloej(const char *initiator, const char *url)
|
||||
ret = 0;
|
||||
|
||||
|
||||
if (!removable) {
|
||||
if (!inq->rmb) {
|
||||
printf("Media is not removable. SKIPPING tests\n");
|
||||
ret = -2;
|
||||
goto finished;
|
||||
|
||||
@@ -71,7 +71,7 @@ int T0370_nomedia(const char *initiator, const char *url)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!removable) {
|
||||
if (!inq->rmb) {
|
||||
printf("Media is not removable. Skipping test.\n");
|
||||
ret = -2;
|
||||
goto finished;
|
||||
|
||||
@@ -53,7 +53,7 @@ int T0380_preventallow_simple(const char *initiator, const char *url)
|
||||
ret = 0;
|
||||
|
||||
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
printf("Media is removable. PREVENTALLOW should work\n");
|
||||
} else {
|
||||
printf("Media is not removable. PREVENTALLOW should fail\n");
|
||||
@@ -70,7 +70,7 @@ int T0380_preventallow_simple(const char *initiator, const char *url)
|
||||
/* SPC doesnt really say anything about what should happen if using PREVENTALLOW
|
||||
* on a device that does not support medium removals.
|
||||
*/
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("PREVENTALLOW command: failed with sense %s\n", iscsi_get_error(iscsi));
|
||||
@@ -94,7 +94,7 @@ int T0380_preventallow_simple(const char *initiator, const char *url)
|
||||
/* SPC doesnt really say anything about what should happen if using PREVENTALLOW
|
||||
* on a device that does not support medium removals.
|
||||
*/
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("PREVENTALLOW command: failed with sense %s\n", iscsi_get_error(iscsi));
|
||||
|
||||
@@ -51,7 +51,7 @@ int T0381_preventallow_eject(const char *initiator, const char *url)
|
||||
goto finished;
|
||||
}
|
||||
|
||||
if (!removable) {
|
||||
if (!inq->rmb) {
|
||||
printf("Media is not removable. Skipping tests\n");
|
||||
ret = -2;
|
||||
goto finished;
|
||||
@@ -72,7 +72,7 @@ int T0381_preventallow_eject(const char *initiator, const char *url)
|
||||
/* SPC doesnt really say anything about what should happen if using PREVENTALLOW
|
||||
* on a device that does not support medium removals.
|
||||
*/
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("PREVENTALLOW command: failed with sense %s\n", iscsi_get_error(iscsi));
|
||||
@@ -132,7 +132,7 @@ int T0381_preventallow_eject(const char *initiator, const char *url)
|
||||
/* SPC doesnt really say anything about what should happen if using PREVENTALLOW
|
||||
* on a device that does not support medium removals.
|
||||
*/
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("PREVENTALLOW command: failed with sense %s\n", iscsi_get_error(iscsi));
|
||||
|
||||
@@ -57,7 +57,7 @@ int T0382_preventallow_itnexus_loss(const char *initiator, const char *url)
|
||||
ret = 0;
|
||||
|
||||
|
||||
if (!removable) {
|
||||
if (!inq->rmb) {
|
||||
printf("Media is not removable. Skipping tests\n");
|
||||
ret = -2;
|
||||
goto finished;
|
||||
@@ -75,7 +75,7 @@ int T0382_preventallow_itnexus_loss(const char *initiator, const char *url)
|
||||
/* SPC doesnt really say anything about what should happen if using PREVENTALLOW
|
||||
* on a device that does not support medium removals.
|
||||
*/
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("PREVENTALLOW command: failed with sense %s\n", iscsi_get_error(iscsi));
|
||||
@@ -166,7 +166,7 @@ int T0382_preventallow_itnexus_loss(const char *initiator, const char *url)
|
||||
/* SPC doesnt really say anything about what should happen if using PREVENTALLOW
|
||||
* on a device that does not support medium removals.
|
||||
*/
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("PREVENTALLOW command: failed with sense %s\n", iscsi_get_error(iscsi));
|
||||
|
||||
@@ -71,7 +71,7 @@ int T0383_preventallow_target_warm_reset(const char *initiator, const char *url)
|
||||
goto finished;
|
||||
}
|
||||
|
||||
if (!removable) {
|
||||
if (!inq->rmb) {
|
||||
printf("Media is not removable. Skipping tests\n");
|
||||
ret = -2;
|
||||
goto finished;
|
||||
@@ -92,7 +92,7 @@ int T0383_preventallow_target_warm_reset(const char *initiator, const char *url)
|
||||
/* SPC doesnt really say anything about what should happen if using PREVENTALLOW
|
||||
* on a device that does not support medium removals.
|
||||
*/
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("PREVENTALLOW command: failed with sense %s\n", iscsi_get_error(iscsi));
|
||||
@@ -200,7 +200,7 @@ again:
|
||||
/* SPC doesnt really say anything about what should happen if using PREVENTALLOW
|
||||
* on a device that does not support medium removals.
|
||||
*/
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("PREVENTALLOW command: failed with sense %s\n", iscsi_get_error(iscsi));
|
||||
|
||||
@@ -71,7 +71,7 @@ int T0384_preventallow_target_cold_reset(const char *initiator, const char *url)
|
||||
goto finished;
|
||||
}
|
||||
|
||||
if (!removable) {
|
||||
if (!inq->rmb) {
|
||||
printf("Media is not removable. Skipping tests\n");
|
||||
ret = -2;
|
||||
goto finished;
|
||||
@@ -92,7 +92,7 @@ int T0384_preventallow_target_cold_reset(const char *initiator, const char *url)
|
||||
/* SPC doesnt really say anything about what should happen if using PREVENTALLOW
|
||||
* on a device that does not support medium removals.
|
||||
*/
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("PREVENTALLOW command: failed with sense %s\n", iscsi_get_error(iscsi));
|
||||
@@ -201,7 +201,7 @@ again:
|
||||
/* SPC doesnt really say anything about what should happen if using PREVENTALLOW
|
||||
* on a device that does not support medium removals.
|
||||
*/
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("PREVENTALLOW command: failed with sense %s\n", iscsi_get_error(iscsi));
|
||||
|
||||
@@ -71,7 +71,7 @@ int T0385_preventallow_lun_reset(const char *initiator, const char *url)
|
||||
goto finished;
|
||||
}
|
||||
|
||||
if (!removable) {
|
||||
if (!inq->rmb) {
|
||||
printf("Media is not removable. Skipping tests\n");
|
||||
ret = -2;
|
||||
goto finished;
|
||||
@@ -92,7 +92,7 @@ int T0385_preventallow_lun_reset(const char *initiator, const char *url)
|
||||
/* SPC doesnt really say anything about what should happen if using PREVENTALLOW
|
||||
* on a device that does not support medium removals.
|
||||
*/
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("PREVENTALLOW command: failed with sense %s\n", iscsi_get_error(iscsi));
|
||||
@@ -201,7 +201,7 @@ again:
|
||||
/* SPC doesnt really say anything about what should happen if using PREVENTALLOW
|
||||
* on a device that does not support medium removals.
|
||||
*/
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("PREVENTALLOW command: failed with sense %s\n", iscsi_get_error(iscsi));
|
||||
|
||||
@@ -54,7 +54,7 @@ int T0386_preventallow_2_itl_nexuses(const char *initiator, const char *url)
|
||||
goto finished;
|
||||
}
|
||||
|
||||
if (!removable) {
|
||||
if (!inq->rmb) {
|
||||
printf("Media is not removable. Skipping tests\n");
|
||||
ret = -2;
|
||||
goto finished;
|
||||
@@ -75,7 +75,7 @@ int T0386_preventallow_2_itl_nexuses(const char *initiator, const char *url)
|
||||
/* SPC doesnt really say anything about what should happen if using PREVENTALLOW
|
||||
* on a device that does not support medium removals.
|
||||
*/
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("PREVENTALLOW command: failed with sense %s\n", iscsi_get_error(iscsi));
|
||||
@@ -182,7 +182,7 @@ int T0386_preventallow_2_itl_nexuses(const char *initiator, const char *url)
|
||||
/* SPC doesnt really say anything about what should happen if using PREVENTALLOW
|
||||
* on a device that does not support medium removals.
|
||||
*/
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("PREVENTALLOW command: failed with sense %s\n", iscsi_get_error(iscsi));
|
||||
|
||||
@@ -62,18 +62,16 @@ int T0390_mandatory_opcodes_sbc(const char *initiator, const char *url)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
printf("Not a SBC device. Skipping test\n");
|
||||
ret = -2;
|
||||
goto finished;
|
||||
if (inq->device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
logging(LOG_VERBOSE, "[SKIPPED] Not SBC device."
|
||||
" Skipping test");
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (!data_loss) {
|
||||
printf("--dataloss flag is not set. Skipping test\n");
|
||||
ret = -2;
|
||||
goto finished;
|
||||
logging(LOG_VERBOSE, "[SKIPPED] --dataloss flag not set."
|
||||
" Skipping test");
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
printf("Test FORMAT UNIT ... ");
|
||||
printf("[TEST NOT IMPLEMENTED YET]\n");
|
||||
@@ -86,7 +84,7 @@ int T0390_mandatory_opcodes_sbc(const char *initiator, const char *url)
|
||||
|
||||
|
||||
printf("Test MAINTENANCE IN ... ");
|
||||
if (sccs == 0) {
|
||||
if (inq->sccs == 0) {
|
||||
printf("[SCCS == 0, SKIPPING TEST]\n");
|
||||
} else {
|
||||
printf("[TEST NOT IMPLEMENTED YET]\n");
|
||||
@@ -94,7 +92,7 @@ int T0390_mandatory_opcodes_sbc(const char *initiator, const char *url)
|
||||
|
||||
|
||||
printf("Test MAINTENANCE OUT ... ");
|
||||
if (sccs == 0) {
|
||||
if (inq->sccs == 0) {
|
||||
printf("[SCCS == 0, SKIPPING TEST]\n");
|
||||
} else {
|
||||
printf("[TEST NOT IMPLEMENTED YET]\n");
|
||||
@@ -138,7 +136,7 @@ int T0390_mandatory_opcodes_sbc(const char *initiator, const char *url)
|
||||
|
||||
|
||||
printf("Test RECEIVE DIAGNOSTIC RESULT ... ");
|
||||
if (encserv == 0) {
|
||||
if (inq->encserv == 0) {
|
||||
printf("[ENCSERV == 0, SKIPPING TEST]\n");
|
||||
} else {
|
||||
printf("[TEST NOT IMPLEMENTED YET]\n");
|
||||
@@ -146,7 +144,7 @@ int T0390_mandatory_opcodes_sbc(const char *initiator, const char *url)
|
||||
|
||||
|
||||
printf("Test REDUNDANCY GROUP IN ... ");
|
||||
if (sccs == 0) {
|
||||
if (inq->sccs == 0) {
|
||||
printf("[SCCS == 0, SKIPPING TEST]\n");
|
||||
} else {
|
||||
printf("[TEST NOT IMPLEMENTED YET]\n");
|
||||
@@ -154,7 +152,7 @@ int T0390_mandatory_opcodes_sbc(const char *initiator, const char *url)
|
||||
|
||||
|
||||
printf("Test REDUNDANCY GROUP OUT ... ");
|
||||
if (sccs == 0) {
|
||||
if (inq->sccs == 0) {
|
||||
printf("[SCCS == 0, SKIPPING TEST]\n");
|
||||
} else {
|
||||
printf("[TEST NOT IMPLEMENTED YET]\n");
|
||||
@@ -188,7 +186,7 @@ int T0390_mandatory_opcodes_sbc(const char *initiator, const char *url)
|
||||
|
||||
|
||||
printf("Test SPARE IN ... ");
|
||||
if (sccs == 0) {
|
||||
if (inq->sccs == 0) {
|
||||
printf("[SCCS == 0, SKIPPING TEST]\n");
|
||||
goto finished;
|
||||
}
|
||||
@@ -196,7 +194,7 @@ int T0390_mandatory_opcodes_sbc(const char *initiator, const char *url)
|
||||
|
||||
|
||||
printf("Test SPARE OUT ... ");
|
||||
if (sccs == 0) {
|
||||
if (inq->sccs == 0) {
|
||||
printf("[SCCS == 0, SKIPPING TEST]\n");
|
||||
} else {
|
||||
printf("[TEST NOT IMPLEMENTED YET]\n");
|
||||
@@ -232,7 +230,7 @@ int T0390_mandatory_opcodes_sbc(const char *initiator, const char *url)
|
||||
|
||||
|
||||
printf("Test VOLUME SET IN ... ");
|
||||
if (sccs == 0) {
|
||||
if (inq->sccs == 0) {
|
||||
printf("[SCCS == 0, SKIPPING TEST]\n");
|
||||
} else {
|
||||
printf("[TEST NOT IMPLEMENTED YET]\n");
|
||||
@@ -240,7 +238,7 @@ int T0390_mandatory_opcodes_sbc(const char *initiator, const char *url)
|
||||
|
||||
|
||||
printf("Test VOLUME SET OUT ... ");
|
||||
if (sccs == 0) {
|
||||
if (inq->sccs == 0) {
|
||||
printf("[SCCS == 0, SKIPPING TEST]\n");
|
||||
} else {
|
||||
printf("[TEST NOT IMPLEMENTED YET]\n");
|
||||
|
||||
@@ -26,7 +26,7 @@ int T0400_inquiry_basic(const char *initiator, const char *url)
|
||||
{
|
||||
struct iscsi_context *iscsi;
|
||||
struct scsi_task *task;
|
||||
struct scsi_inquiry_standard *inq;
|
||||
struct scsi_inquiry_standard *std_inq;
|
||||
int ret, lun, i;
|
||||
int full_size;
|
||||
|
||||
@@ -90,8 +90,8 @@ int T0400_inquiry_basic(const char *initiator, const char *url)
|
||||
goto finished;
|
||||
}
|
||||
}
|
||||
inq = scsi_datain_unmarshall(task);
|
||||
if (inq == NULL) {
|
||||
std_inq = scsi_datain_unmarshall(task);
|
||||
if (std_inq == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("failed to unmarshall inquiry datain blob\n");
|
||||
scsi_free_scsi_task(task);
|
||||
@@ -111,14 +111,14 @@ int T0400_inquiry_basic(const char *initiator, const char *url)
|
||||
printf("[OK]\n");
|
||||
|
||||
printf("Check device-type is either of DISK, TAPE or CD/DVD ... ");
|
||||
switch (inq->device_type) {
|
||||
switch (std_inq->device_type) {
|
||||
case SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS:
|
||||
case SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_SEQUENTIAL_ACCESS:
|
||||
case SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_MMC:
|
||||
break;
|
||||
default:
|
||||
printf("[FAILED]\n");
|
||||
printf("Device-type is not DISK, TAPE or CD/DVD. Device reported:%s\n", scsi_devtype_to_str(inq->device_type));
|
||||
printf("Device-type is not DISK, TAPE or CD/DVD. Device reported:%s\n", scsi_devtype_to_str(std_inq->device_type));
|
||||
ret = -1;
|
||||
goto test4;
|
||||
}
|
||||
@@ -127,9 +127,9 @@ int T0400_inquiry_basic(const char *initiator, const char *url)
|
||||
|
||||
test4:
|
||||
printf("Check PREIPHERAL QUALIFIER FIELD is 0 ... ");
|
||||
if (inq->qualifier != 0) {
|
||||
if (std_inq->qualifier != 0) {
|
||||
printf("[FAILED]\n");
|
||||
printf("QUALIFIER was not 0, it was %d\n", inq->qualifier);
|
||||
printf("QUALIFIER was not 0, it was %d\n", std_inq->qualifier);
|
||||
ret = -1;
|
||||
goto test5;
|
||||
}
|
||||
@@ -137,14 +137,14 @@ test4:
|
||||
|
||||
test5:
|
||||
printf("Check VERSION field is either 0x4, 0x5 or 0x6 ... ");
|
||||
switch (inq->version) {
|
||||
switch (std_inq->version) {
|
||||
case 0x4: /* SPC-2 */
|
||||
case 0x5: /* SPC-3 */
|
||||
case 0x6: /* SPC-4 */
|
||||
break;
|
||||
default:
|
||||
printf("[FAILED]\n");
|
||||
printf("Invalid VERSION:%d. Should be 0x4, 0x5 or 0x6\n", inq->version);
|
||||
printf("Invalid VERSION:%d. Should be 0x4, 0x5 or 0x6\n", std_inq->version);
|
||||
ret = -1;
|
||||
goto test6;
|
||||
}
|
||||
@@ -152,9 +152,9 @@ test5:
|
||||
|
||||
test6:
|
||||
printf("Check RESPONSE DATA FORMAT is 2 ... ");
|
||||
if (inq->response_data_format != 2) {
|
||||
if (std_inq->response_data_format != 2) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Invalid RESPONSE_DATA_FORMAT:%d. Should be 2\n", inq->response_data_format);
|
||||
printf("Invalid RESPONSE_DATA_FORMAT:%d. Should be 2\n", std_inq->response_data_format);
|
||||
ret = -1;
|
||||
goto test7;
|
||||
}
|
||||
@@ -162,9 +162,9 @@ test6:
|
||||
|
||||
test7:
|
||||
printf("Verify Additional-Length ... ");
|
||||
if (inq->additional_length + 5 != full_size) {
|
||||
if (std_inq->additional_length + 5 != full_size) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Invalid additional-length. Was %d but should be %d\n", inq->additional_length, full_size-5);
|
||||
printf("Invalid additional-length. Was %d but should be %d\n", std_inq->additional_length, full_size-5);
|
||||
ret = -1;
|
||||
goto test8;
|
||||
}
|
||||
@@ -172,7 +172,7 @@ test7:
|
||||
|
||||
test8:
|
||||
printf("Verify HiSup is set ... ");
|
||||
if (!inq->hisup) {
|
||||
if (!std_inq->hisup) {
|
||||
printf("[FAILED]\n");
|
||||
printf("HiSup flag is not set.\n");
|
||||
ret = -1;
|
||||
@@ -236,7 +236,7 @@ test11:
|
||||
|
||||
test12:
|
||||
printf("Verify AERC is clear in SPC-3 and later ... ");
|
||||
if (task->datain.data[3] & 0x80 && inq->version >= 5) {
|
||||
if (task->datain.data[3] & 0x80 && std_inq->version >= 5) {
|
||||
printf("[FAILED]\n");
|
||||
printf("AERC is set but this device reports SPC-3 or later\n");
|
||||
ret = -1;
|
||||
@@ -246,7 +246,7 @@ test12:
|
||||
|
||||
test13:
|
||||
printf("Verify TrmTsk is clear in SPC-2 and later ... ");
|
||||
if (task->datain.data[3] & 0x40 && inq->version >= 4) {
|
||||
if (task->datain.data[3] & 0x40 && std_inq->version >= 4) {
|
||||
printf("[FAILED]\n");
|
||||
printf("TrmTsk is set but this device reports SPC-2 or later\n");
|
||||
ret = -1;
|
||||
|
||||
@@ -26,7 +26,7 @@ int T0403_inquiry_supported_vpd(const char *initiator, const char *url)
|
||||
{
|
||||
struct iscsi_context *iscsi;
|
||||
struct scsi_task *task;
|
||||
struct scsi_inquiry_supported_pages *inq;
|
||||
struct scsi_inquiry_supported_pages *std_inq;
|
||||
size_t i;
|
||||
int ret, lun, j;
|
||||
int full_size;
|
||||
@@ -83,8 +83,8 @@ int T0403_inquiry_supported_vpd(const char *initiator, const char *url)
|
||||
goto finished;
|
||||
}
|
||||
}
|
||||
inq = scsi_datain_unmarshall(task);
|
||||
if (inq == NULL) {
|
||||
std_inq = scsi_datain_unmarshall(task);
|
||||
if (std_inq == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("failed to unmarshall inquiry datain blob\n");
|
||||
scsi_free_scsi_task(task);
|
||||
@@ -96,12 +96,12 @@ int T0403_inquiry_supported_vpd(const char *initiator, const char *url)
|
||||
printf("Verify we have all mandatory SPC VPD pages:\n");
|
||||
for (i = 0; i < sizeof(required_spc_pages) / sizeof(enum scsi_inquiry_pagecode); i++) {
|
||||
printf("Verify the target supports page 0x%02x ... ", required_spc_pages[i]);
|
||||
for (j = 0; j < inq->num_pages; j++) {
|
||||
if (required_spc_pages[i] == inq->pages[j]) {
|
||||
for (j = 0; j < std_inq->num_pages; j++) {
|
||||
if (required_spc_pages[i] == std_inq->pages[j]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == inq->num_pages) {
|
||||
if (j == std_inq->num_pages) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Target did not report page 0x%02x. This page is mandatory in SPC.\n", required_spc_pages[i]);
|
||||
ret = -1;
|
||||
|
||||
@@ -26,7 +26,7 @@ int T0404_inquiry_all_reported_vpd(const char *initiator, const char *url)
|
||||
{
|
||||
struct iscsi_context *iscsi;
|
||||
struct scsi_task *task;
|
||||
struct scsi_inquiry_supported_pages *inq;
|
||||
struct scsi_inquiry_supported_pages *sup_inq;
|
||||
int ret, lun, i;
|
||||
int full_size;
|
||||
enum scsi_inquiry_pagecode page_code;
|
||||
@@ -81,8 +81,8 @@ int T0404_inquiry_all_reported_vpd(const char *initiator, const char *url)
|
||||
goto finished;
|
||||
}
|
||||
}
|
||||
inq = scsi_datain_unmarshall(task);
|
||||
if (inq == NULL) {
|
||||
sup_inq = scsi_datain_unmarshall(task);
|
||||
if (sup_inq == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("failed to unmarshall inquiry datain blob\n");
|
||||
scsi_free_scsi_task(task);
|
||||
@@ -92,11 +92,11 @@ int T0404_inquiry_all_reported_vpd(const char *initiator, const char *url)
|
||||
printf("[OK]\n");
|
||||
|
||||
printf("Read each page and verify qualifier, type and page code:\n");
|
||||
for (i = 0; i < inq->num_pages; i++) {
|
||||
for (i = 0; i < sup_inq->num_pages; i++) {
|
||||
struct scsi_task *pc_task;
|
||||
|
||||
printf("Verify page 0x%02x can be read ... ", inq->pages[i]);
|
||||
pc_task = iscsi_inquiry_sync(iscsi, lun, 1, inq->pages[i], 255);
|
||||
printf("Verify page 0x%02x can be read ... ", sup_inq->pages[i]);
|
||||
pc_task = iscsi_inquiry_sync(iscsi, lun, 1, sup_inq->pages[i], 255);
|
||||
if (pc_task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send INQUIRY command : %s\n", iscsi_get_error(iscsi));
|
||||
@@ -112,11 +112,11 @@ int T0404_inquiry_all_reported_vpd(const char *initiator, const char *url)
|
||||
}
|
||||
printf("[OK]\n");
|
||||
|
||||
printf("Verify page 0x%02x qualifier ... ", inq->pages[i]);
|
||||
if ((pc_task->datain.data[0] & 0xe0) >> 5 != inq->qualifier) {
|
||||
printf("Verify page 0x%02x qualifier ... ", sup_inq->pages[i]);
|
||||
if ((pc_task->datain.data[0] & 0xe0) >> 5 != sup_inq->qualifier) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Qualifier differs between VPD pages: %x != %x\n",
|
||||
pc_task->datain.data[0] & 0xe0, inq->qualifier);
|
||||
pc_task->datain.data[0] & 0xe0, sup_inq->qualifier);
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(pc_task);
|
||||
continue;
|
||||
@@ -124,11 +124,11 @@ int T0404_inquiry_all_reported_vpd(const char *initiator, const char *url)
|
||||
printf("[OK]\n");
|
||||
}
|
||||
|
||||
printf("Verify page 0x%02x device type ... ", inq->pages[i]);
|
||||
if ((pc_task->datain.data[0] & 0x1f) != inq->device_type) {
|
||||
printf("Verify page 0x%02x device type ... ", sup_inq->pages[i]);
|
||||
if ((pc_task->datain.data[0] & 0x1f) != sup_inq->device_type) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Device Type differs between VPD pages: %x != %x\n",
|
||||
pc_task->datain.data[0] & 0x1f, inq->device_type);
|
||||
pc_task->datain.data[0] & 0x1f, sup_inq->device_type);
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(pc_task);
|
||||
continue;
|
||||
@@ -136,11 +136,11 @@ int T0404_inquiry_all_reported_vpd(const char *initiator, const char *url)
|
||||
printf("[OK]\n");
|
||||
}
|
||||
|
||||
printf("Verify page 0x%02x page code ... ", inq->pages[i]);
|
||||
if (pc_task->datain.data[1] != inq->pages[i]) {
|
||||
printf("Verify page 0x%02x page code ... ", sup_inq->pages[i]);
|
||||
if (pc_task->datain.data[1] != sup_inq->pages[i]) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Page code is wrong: %x != %x\n",
|
||||
pc_task->datain.data[1], inq->pages[i]);
|
||||
pc_task->datain.data[1], sup_inq->pages[i]);
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(pc_task);
|
||||
continue;
|
||||
|
||||
@@ -26,7 +26,7 @@ int T0410_readtoc_basic(const char *initiator, const char *url)
|
||||
{
|
||||
struct iscsi_context *iscsi;
|
||||
struct scsi_task *task, *task1;
|
||||
struct scsi_inquiry_standard *inq;
|
||||
struct scsi_inquiry_standard *std_inq;
|
||||
struct scsi_readcapacity10 *rc10;
|
||||
struct scsi_readtoc_list *list, *list1;
|
||||
int ret, lun, i, toc_device, full_size;
|
||||
@@ -85,8 +85,8 @@ int T0410_readtoc_basic(const char *initiator, const char *url)
|
||||
goto finished;
|
||||
}
|
||||
}
|
||||
inq = scsi_datain_unmarshall(task);
|
||||
if (inq == NULL) {
|
||||
std_inq = scsi_datain_unmarshall(task);
|
||||
if (std_inq == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("failed to unmarshall inquiry datain blob\n");
|
||||
scsi_free_scsi_task(task);
|
||||
@@ -96,7 +96,7 @@ int T0410_readtoc_basic(const char *initiator, const char *url)
|
||||
printf("[OK]\n");
|
||||
|
||||
printf("Check device-type is either of DISK, TAPE or CD/DVD ... ");
|
||||
switch (inq->device_type) {
|
||||
switch (std_inq->device_type) {
|
||||
case SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_MMC:
|
||||
toc_device = 1;
|
||||
break;
|
||||
|
||||
@@ -46,15 +46,14 @@ const char *initiatorname2 =
|
||||
|
||||
const char *tgt_url;
|
||||
|
||||
struct scsi_inquiry_standard *inq;
|
||||
|
||||
size_t block_size;
|
||||
uint64_t num_blocks;
|
||||
int lbpme;
|
||||
int lbppb;
|
||||
int lbpme;
|
||||
int removable;
|
||||
enum scsi_inquiry_peripheral_device_type device_type;
|
||||
int sccs;
|
||||
int encserv;
|
||||
int data_loss;
|
||||
int lbpws10;
|
||||
int lbpws;
|
||||
|
||||
@@ -47,8 +47,8 @@ do { \
|
||||
if (!data_loss) { \
|
||||
logging(LOG_VERBOSE, "[SKIPPED] --dataloss flag is not " \
|
||||
"set. Skipping test."); \
|
||||
CU_PASS("[SKIPPED] --dataloss flag is not set. " \
|
||||
"Skipping test."); \
|
||||
CU_PASS("[SKIPPED] --dataloss flag is not set." \
|
||||
" Skipping test"); \
|
||||
return; \
|
||||
} \
|
||||
} while (0);
|
||||
@@ -66,7 +66,7 @@ do { \
|
||||
|
||||
#define CHECK_FOR_REMOVABLE \
|
||||
do { \
|
||||
if (!removable) { \
|
||||
if (!inq->rmb) { \
|
||||
logging(LOG_VERBOSE, "[SKIPPED] Logical unit is not " \
|
||||
"removable. Skipping test."); \
|
||||
CU_PASS("[SKIPPED] Logical unit is not removable" \
|
||||
@@ -119,7 +119,7 @@ do { \
|
||||
|
||||
#define CHECK_FOR_SBC \
|
||||
do { \
|
||||
if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {\
|
||||
if (inq->device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {\
|
||||
logging(LOG_VERBOSE, "[SKIPPED] Not SBC device." \
|
||||
" Skipping test"); \
|
||||
CU_PASS("[SKIPPED] Not SBC device." \
|
||||
@@ -128,16 +128,14 @@ do { \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
extern struct scsi_inquiry_standard *inq;
|
||||
|
||||
extern size_t block_size;
|
||||
extern uint64_t num_blocks;
|
||||
extern int lbpme;
|
||||
extern int lbppb;
|
||||
extern int lbpme;
|
||||
extern int data_loss;
|
||||
extern int removable;
|
||||
extern enum scsi_inquiry_peripheral_device_type device_type;
|
||||
extern int sccs;
|
||||
extern int encserv;
|
||||
extern int lbpws10;
|
||||
extern int lbpws;
|
||||
extern int anc_sup;
|
||||
|
||||
@@ -858,7 +858,7 @@ main(int argc, char *argv[])
|
||||
int res;
|
||||
struct scsi_readcapacity10 *rc10;
|
||||
struct scsi_readcapacity16 *rc16;
|
||||
struct scsi_inquiry_standard *inq;
|
||||
struct scsi_task *inq_task;
|
||||
int full_size;
|
||||
int is_usb;
|
||||
static struct option long_opts[] = {
|
||||
@@ -1017,34 +1017,29 @@ main(int argc, char *argv[])
|
||||
scsi_free_scsi_task(task);
|
||||
}
|
||||
|
||||
task = iscsi_inquiry_sync(iscsic, lun, 0, 0, 64);
|
||||
if (task == NULL || task->status != SCSI_STATUS_GOOD) {
|
||||
inq_task = iscsi_inquiry_sync(iscsic, lun, 0, 0, 64);
|
||||
if (inq_task == NULL || inq_task->status != SCSI_STATUS_GOOD) {
|
||||
printf("Inquiry command failed : %s\n", iscsi_get_error(iscsic));
|
||||
return -1;
|
||||
}
|
||||
full_size = scsi_datain_getfullsize(task);
|
||||
if (full_size > task->datain.size) {
|
||||
scsi_free_scsi_task(task);
|
||||
full_size = scsi_datain_getfullsize(inq_task);
|
||||
if (full_size > inq_task->datain.size) {
|
||||
scsi_free_scsi_task(inq_task);
|
||||
|
||||
/* we need more data for the full list */
|
||||
task = iscsi_inquiry_sync(iscsic, lun, 0, 0, full_size);
|
||||
if (task == NULL) {
|
||||
inq_task = iscsi_inquiry_sync(iscsic, lun, 0, 0, full_size);
|
||||
if (inq_task == NULL) {
|
||||
printf("Inquiry command failed : %s\n",
|
||||
iscsi_get_error(iscsic));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
inq = scsi_datain_unmarshall(task);
|
||||
inq = scsi_datain_unmarshall(inq_task);
|
||||
if (inq == NULL) {
|
||||
printf("failed to unmarshall inquiry datain blob\n");
|
||||
scsi_free_scsi_task(task);
|
||||
scsi_free_scsi_task(inq_task);
|
||||
return -1;
|
||||
}
|
||||
removable = inq->rmb;
|
||||
device_type = inq->device_type;
|
||||
sccs = inq->sccs;
|
||||
encserv = inq->encserv;
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
sbc3_support = 0;
|
||||
for (i = 0; i < 8; i++) {
|
||||
@@ -1150,5 +1145,7 @@ main(int argc, char *argv[])
|
||||
free(testname_re);
|
||||
free(discard_const(tgt_url));
|
||||
|
||||
scsi_free_scsi_task(inq_task);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -314,9 +314,9 @@ int main(int argc, char *argv[])
|
||||
int lun;
|
||||
struct iscsi_context *iscsi;
|
||||
struct scsi_task *task;
|
||||
struct scsi_task *inq_task;
|
||||
struct scsi_readcapacity10 *rc10;
|
||||
struct scsi_readcapacity16 *rc16;
|
||||
struct scsi_inquiry_standard *inq;
|
||||
int full_size;
|
||||
int c;
|
||||
|
||||
@@ -461,36 +461,27 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
task = iscsi_inquiry_sync(iscsi, lun, 0, 0, 64);
|
||||
if (task == NULL || task->status != SCSI_STATUS_GOOD) {
|
||||
inq_task = iscsi_inquiry_sync(iscsi, lun, 0, 0, 64);
|
||||
if (inq_task == NULL || inq_task->status != SCSI_STATUS_GOOD) {
|
||||
printf("Inquiry command failed : %s\n", iscsi_get_error(iscsi));
|
||||
return -1;
|
||||
}
|
||||
full_size = scsi_datain_getfullsize(task);
|
||||
if (full_size > task->datain.size) {
|
||||
scsi_free_scsi_task(task);
|
||||
full_size = scsi_datain_getfullsize(inq_task);
|
||||
if (full_size > inq_task->datain.size) {
|
||||
scsi_free_scsi_task(inq_task);
|
||||
|
||||
/* we need more data for the full list */
|
||||
if ((task = iscsi_inquiry_sync(iscsi, lun, 0, 0, full_size)) == NULL) {
|
||||
if ((inq_task = iscsi_inquiry_sync(iscsi, lun, 0, 0, full_size)) == NULL) {
|
||||
printf("Inquiry command failed : %s\n", iscsi_get_error(iscsi));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
inq = scsi_datain_unmarshall(task);
|
||||
inq = scsi_datain_unmarshall(inq_task);
|
||||
if (inq == NULL) {
|
||||
printf("failed to unmarshall inquiry datain blob\n");
|
||||
scsi_free_scsi_task(task);
|
||||
scsi_free_scsi_task(inq_task);
|
||||
return -1;
|
||||
}
|
||||
removable = inq->rmb;
|
||||
device_type = inq->device_type;
|
||||
sccs = inq->sccs;
|
||||
encserv = inq->encserv;
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
|
||||
iscsi_logout_sync(iscsi);
|
||||
iscsi_destroy_context(iscsi);
|
||||
|
||||
|
||||
num_failed = num_skipped = 0;
|
||||
@@ -527,6 +518,10 @@ int main(int argc, char *argv[])
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(inq_task);
|
||||
iscsi_logout_sync(iscsi);
|
||||
iscsi_destroy_context(iscsi);
|
||||
|
||||
free(discard_const(url));
|
||||
|
||||
return num_failed ? num_failed : num_skipped ? 77 : 0;
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#include "iscsi-support.h"
|
||||
|
||||
|
||||
extern int show_info;
|
||||
|
||||
int T0000_testunitready_simple(const char *initiator, const char *url);
|
||||
|
||||
@@ -28,7 +28,7 @@ void
|
||||
test_inquiry_alloc_length(void)
|
||||
{
|
||||
int ret, i;
|
||||
struct scsi_inquiry_standard *inq;
|
||||
struct scsi_inquiry_standard *std_inq;
|
||||
struct scsi_task *task2 = NULL;
|
||||
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
@@ -48,16 +48,16 @@ test_inquiry_alloc_length(void)
|
||||
CU_ASSERT(task->datain.size >= 36);
|
||||
|
||||
logging(LOG_VERBOSE, "Verify we can unmarshall the DATA-IN buffer");
|
||||
inq = scsi_datain_unmarshall(task);
|
||||
CU_ASSERT_NOT_EQUAL(inq, NULL);
|
||||
if (inq == NULL) {
|
||||
std_inq = scsi_datain_unmarshall(task);
|
||||
CU_ASSERT_NOT_EQUAL(std_inq, NULL);
|
||||
if (std_inq == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to unmarshall DATA-IN "
|
||||
"buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Verify peripheral-qualifier is 0");
|
||||
CU_ASSERT_EQUAL(inq->qualifier, 0);
|
||||
CU_ASSERT_EQUAL(std_inq->qualifier, 0);
|
||||
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ test_inquiry_alloc_length(void)
|
||||
target responds properly.
|
||||
*/
|
||||
logging(LOG_VERBOSE, "If version is SPC-3 or later INQUIRY supports 16-bit allocation lengths");
|
||||
switch (inq->version) {
|
||||
switch (std_inq->version) {
|
||||
case 0x5:
|
||||
case 0x6:
|
||||
break;
|
||||
|
||||
@@ -28,7 +28,7 @@ void
|
||||
test_inquiry_standard(void)
|
||||
{
|
||||
int ret, i;
|
||||
struct scsi_inquiry_standard *inq;
|
||||
struct scsi_inquiry_standard *std_inq;
|
||||
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test of the standard INQUIRY page");
|
||||
@@ -41,19 +41,19 @@ test_inquiry_standard(void)
|
||||
CU_ASSERT(task->datain.size >= 36);
|
||||
|
||||
logging(LOG_VERBOSE, "Verify we can unmarshall the DATA-IN buffer");
|
||||
inq = scsi_datain_unmarshall(task);
|
||||
CU_ASSERT_NOT_EQUAL(inq, NULL);
|
||||
if (inq == NULL) {
|
||||
std_inq = scsi_datain_unmarshall(task);
|
||||
CU_ASSERT_NOT_EQUAL(std_inq, NULL);
|
||||
if (std_inq == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to unmarshall DATA-IN "
|
||||
"buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Verify peripheral-qualifier is 0");
|
||||
CU_ASSERT_EQUAL(inq->qualifier, 0);
|
||||
CU_ASSERT_EQUAL(std_inq->qualifier, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Verify version field is either 0x4, 0x5 or 0x6");
|
||||
switch (inq->version) {
|
||||
switch (std_inq->version) {
|
||||
case 0x0:
|
||||
logging(LOG_NORMAL, "[WARNING] Standard INQUIRY data claims "
|
||||
"conformance to no standard. Version==0. "
|
||||
@@ -67,27 +67,27 @@ test_inquiry_standard(void)
|
||||
default:
|
||||
logging(LOG_NORMAL, "[FAILED] Invalid version in standard "
|
||||
"INQUIRY data. Version %d found but only versions "
|
||||
"0x4,0x4,0x6 are valid.", inq->version);
|
||||
"0x4,0x4,0x6 are valid.", std_inq->version);
|
||||
CU_FAIL("Invalid version in INQUIRY data");
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Verify response-data-format is 2 "
|
||||
"(SPC-2 or later)");
|
||||
if (inq->response_data_format != 2) {
|
||||
if (std_inq->response_data_format != 2) {
|
||||
logging(LOG_NORMAL, "[FAILED] Response data format is "
|
||||
"invalid. Must be 2 but device returned %d",
|
||||
inq->response_data_format);
|
||||
std_inq->response_data_format);
|
||||
}
|
||||
CU_ASSERT_EQUAL(inq->response_data_format, 2);
|
||||
CU_ASSERT_EQUAL(std_inq->response_data_format, 2);
|
||||
|
||||
logging(LOG_VERBOSE, "Verify additional-length is correct");
|
||||
if (inq->additional_length != task->datain.size - 5) {
|
||||
if (std_inq->additional_length != task->datain.size - 5) {
|
||||
logging(LOG_NORMAL, "[FAILED] Bad additional length "
|
||||
"returned. Should be %d but device returned %d.",
|
||||
task->datain.size - 5,
|
||||
inq->additional_length);
|
||||
std_inq->additional_length);
|
||||
}
|
||||
CU_ASSERT_EQUAL(inq->additional_length, task->datain.size - 5);
|
||||
CU_ASSERT_EQUAL(std_inq->additional_length, task->datain.size - 5);
|
||||
|
||||
logging(LOG_VERBOSE, "Verify VENDOR_IDENTIFICATION is in ASCII");
|
||||
for (i = 8; i < 16; i++) {
|
||||
@@ -138,14 +138,14 @@ test_inquiry_standard(void)
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Verify AERC is clear in SPC-3 and later");
|
||||
if (task->datain.data[3] & 0x80 && inq->version >= 5) {
|
||||
if (task->datain.data[3] & 0x80 && std_inq->version >= 5) {
|
||||
logging(LOG_NORMAL, "[FAILED] AERC is set but this device "
|
||||
"reports SPC-3 or later.");
|
||||
CU_FAIL("AERC is set but SPC-3+ is claimed");
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Verify TRMTSK is clear in SPC-2 and later");
|
||||
if (task->datain.data[3] & 0x40 && inq->version >= 4) {
|
||||
if (task->datain.data[3] & 0x40 && std_inq->version >= 4) {
|
||||
logging(LOG_NORMAL, "[FAILED] TRMTSK is set but this device "
|
||||
"reports SPC-2 or later.");
|
||||
CU_FAIL("TRMTSK is set but SPC-2+ is claimed");
|
||||
|
||||
@@ -28,7 +28,7 @@ void
|
||||
test_inquiry_supported_vpd(void)
|
||||
{
|
||||
int ret, i;
|
||||
struct scsi_inquiry_supported_pages *inq;
|
||||
struct scsi_inquiry_supported_pages *sup_inq;
|
||||
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test INQUIRY supported VPD pages");
|
||||
@@ -43,21 +43,21 @@ test_inquiry_supported_vpd(void)
|
||||
CU_ASSERT(task->datain.size >= 4);
|
||||
|
||||
logging(LOG_VERBOSE, "Verify we can unmarshall the DATA-IN buffer");
|
||||
inq = scsi_datain_unmarshall(task);
|
||||
CU_ASSERT_NOT_EQUAL(inq, NULL);
|
||||
if (inq == NULL) {
|
||||
sup_inq = scsi_datain_unmarshall(task);
|
||||
CU_ASSERT_NOT_EQUAL(sup_inq, NULL);
|
||||
if (sup_inq == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to unmarshall DATA-IN "
|
||||
"buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Verify we read all the supported pages");
|
||||
for (i = 0; i < inq->num_pages; i++) {
|
||||
for (i = 0; i < sup_inq->num_pages; i++) {
|
||||
logging(LOG_VERBOSE, "Verify we can read page 0x%02x",
|
||||
inq->pages[i]);
|
||||
sup_inq->pages[i]);
|
||||
|
||||
ret = inquiry(iscsic, tgt_lun,
|
||||
1, inq->pages[i],
|
||||
1, sup_inq->pages[i],
|
||||
255, NULL);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ test_nomedia_sbc(void)
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test that Medium commands fail when medium is ejected on SBC devices");
|
||||
|
||||
if (!removable) {
|
||||
if (!inq->rmb) {
|
||||
logging(LOG_VERBOSE, "[SKIPPED] LUN is not removable. "
|
||||
"Skipping test.");
|
||||
return;
|
||||
|
||||
@@ -33,12 +33,7 @@ test_read10_flags(void)
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test READ10 flags");
|
||||
|
||||
/* This test is only valid for SBC devices */
|
||||
if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
CU_PASS("[SKIPPED] LUN is not SBC device. Skipping test");
|
||||
return;
|
||||
}
|
||||
|
||||
CHECK_FOR_SBC;
|
||||
|
||||
logging(LOG_VERBOSE, "Test READ10 with DPO==1");
|
||||
ret = read10(iscsic, tgt_lun, 0,
|
||||
|
||||
@@ -31,17 +31,15 @@ test_read10_rdprotect(void)
|
||||
int i, ret;
|
||||
|
||||
|
||||
if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
CU_PASS("[SKIPPED] LUN is not SBC device. Skipping test");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Try out different non-zero values for RDPROTECT.
|
||||
* They should all fail.
|
||||
*/
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test READ10 with non-zero RDPROTECT");
|
||||
|
||||
CHECK_FOR_SBC;
|
||||
|
||||
for (i = 1; i < 8; i++) {
|
||||
ret = read10_invalidfieldincdb(iscsic, tgt_lun, 0,
|
||||
block_size, block_size,
|
||||
|
||||
@@ -33,12 +33,7 @@ test_read12_flags(void)
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test READ12 flags");
|
||||
|
||||
/* This test is only valid for SBC devices */
|
||||
if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
CU_PASS("[SKIPPED] LUN is not SBC device. Skipping test");
|
||||
return;
|
||||
}
|
||||
|
||||
CHECK_FOR_SBC;
|
||||
|
||||
logging(LOG_VERBOSE, "Test READ12 with DPO==1");
|
||||
ret = read12(iscsic, tgt_lun, 0,
|
||||
|
||||
@@ -30,18 +30,15 @@ test_read12_rdprotect(void)
|
||||
{
|
||||
int i, ret;
|
||||
|
||||
|
||||
if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
CU_PASS("[SKIPPED] LUN is not SBC device. Skipping test");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Try out different non-zero values for RDPROTECT.
|
||||
* They should all fail.
|
||||
*/
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test READ12 with non-zero RDPROTECT");
|
||||
|
||||
CHECK_FOR_SBC;
|
||||
|
||||
for (i = 1; i < 8; i++) {
|
||||
ret = read12_invalidfieldincdb(iscsic, tgt_lun, 0,
|
||||
block_size, block_size,
|
||||
|
||||
@@ -32,7 +32,7 @@ test_startstopunit_noloej(void)
|
||||
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test STARTSTOPUNIT LOEJ==0");
|
||||
if (!removable) {
|
||||
if (!inq->rmb) {
|
||||
logging(LOG_VERBOSE, "[SKIPPED] LUN is not removable. "
|
||||
"Skipping test.");
|
||||
return;
|
||||
|
||||
@@ -32,7 +32,7 @@ test_startstopunit_pwrcnd(void)
|
||||
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test STARTSTOPUNIT PowerCondition");
|
||||
if (!removable) {
|
||||
if (!inq->rmb) {
|
||||
logging(LOG_VERBOSE, "[SKIPPED] LUN is not removable. "
|
||||
"Skipping test.");
|
||||
return;
|
||||
|
||||
@@ -35,7 +35,7 @@ test_startstopunit_simple(void)
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test we can eject removable the media with IMMED==1");
|
||||
if (removable) {
|
||||
if (inq->rmb) {
|
||||
logging(LOG_VERBOSE, "Media is not removable. STARTSTOPUNIT should fail");
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "Media is removable. STARTSTOPUNIT should work");
|
||||
@@ -43,7 +43,7 @@ test_startstopunit_simple(void)
|
||||
|
||||
ret = startstopunit(iscsic, tgt_lun,
|
||||
1, 0, 0, 0, 1, 0);
|
||||
if (!removable) {
|
||||
if (!inq->rmb) {
|
||||
CU_ASSERT_NOT_EQUAL(ret, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user