TESTS: keep the unmarshalled std inq structure around

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