Merge branch 'master' of github.com:sahlberg/libiscsi
This commit is contained in:
@@ -32,7 +32,7 @@ SONAME=$(firstword $(subst ., ,$(VERSION)))
|
|||||||
SOREL=$(shell printf "%d%02d%02d" $(subst ., ,$(VERSION)))
|
SOREL=$(shell printf "%d%02d%02d" $(subst ., ,$(VERSION)))
|
||||||
lib_libiscsi_la_LDFLAGS = \
|
lib_libiscsi_la_LDFLAGS = \
|
||||||
-version-info $(SONAME):$(SOREL):0 -bindir $(bindir) -no-undefined \
|
-version-info $(SONAME):$(SOREL):0 -bindir $(bindir) -no-undefined \
|
||||||
-export-symbols lib/libiscsi.syms
|
-export-symbols $(srcdir)/lib/libiscsi.syms
|
||||||
|
|
||||||
# libiscsi utilities
|
# libiscsi utilities
|
||||||
|
|
||||||
|
|||||||
@@ -72,13 +72,13 @@ int T0103_read10_rdprotect(const char *initiator, const char *url, int data_loss
|
|||||||
if (inq->periperal_device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
if (inq->periperal_device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||||
printf("LUN is not SBC device. Skipping test\n");
|
printf("LUN is not SBC device. Skipping test\n");
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
return -1;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inq->protect) {
|
if (inq->protect) {
|
||||||
printf("LUN is formatted with protection information. Skipping test\n");
|
printf("LUN is formatted with protection information. Skipping test\n");
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
return -1;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ int T0104_read10_flags(const char *initiator, const char *url, int data_loss _U_
|
|||||||
{
|
{
|
||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
|
struct scsi_inquiry_standard *inq;
|
||||||
int ret, lun;
|
int ret, lun;
|
||||||
|
|
||||||
printf("0104_read10_flags:\n");
|
printf("0104_read10_flags:\n");
|
||||||
@@ -50,6 +51,24 @@ int T0104_read10_flags(const char *initiator, const char *url, int data_loss _U_
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
|
/* This test is only valid for SBC devices */
|
||||||
|
task = iscsi_inquiry_sync(iscsi, lun, 0, 0, 64);
|
||||||
|
if (task == NULL || task->status != SCSI_STATUS_GOOD) {
|
||||||
|
printf("Inquiry command failed : %s\n", iscsi_get_error(iscsi));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
inq = scsi_datain_unmarshall(task);
|
||||||
|
if (inq == NULL) {
|
||||||
|
printf("failed to unmarshall inquiry datain blob\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (inq->periperal_device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||||
|
printf("LUN is not SBC device. Skipping test\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
/* Try out DPO : 1 */
|
/* Try out DPO : 1 */
|
||||||
printf("Read10 with DPO==1 ... ");
|
printf("Read10 with DPO==1 ... ");
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ int T0170_unmap_simple(const char *initiator, const char *url, int data_loss, in
|
|||||||
|
|
||||||
if (rc16->lbpme == 0){
|
if (rc16->lbpme == 0){
|
||||||
printf("Logical unit is fully provisioned. Skipping test\n");
|
printf("Logical unit is fully provisioned. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ int T0170_unmap_simple(const char *initiator, const char *url, int data_loss, in
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("data_loss flag is not set. Skipping test\n");
|
printf("data_loss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ int T0171_unmap_zero(const char *initiator, const char *url, int data_loss, int
|
|||||||
|
|
||||||
if (rc16->lbpme == 0){
|
if (rc16->lbpme == 0){
|
||||||
printf("Logical unit is fully provisioned. Skipping test\n");
|
printf("Logical unit is fully provisioned. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ int T0171_unmap_zero(const char *initiator, const char *url, int data_loss, int
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("data_loss flag is not set. Skipping test\n");
|
printf("data_loss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ test2:
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ int T0181_writesame10_unmap_unaligned(const char *initiator, const char *url, in
|
|||||||
|
|
||||||
if (rc16->lbpme == 0){
|
if (rc16->lbpme == 0){
|
||||||
printf("Logical unit is fully provisioned. Skipping test\n");
|
printf("Logical unit is fully provisioned. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ int T0181_writesame10_unmap_unaligned(const char *initiator, const char *url, in
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ int T0182_writesame10_beyondeol(const char *initiator, const char *url, int data
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ int T0183_writesame10_wrprotect(const char *initiator, const char *url, int data
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ int T0184_writesame10_0blocks(const char *initiator, const char *url, int data_l
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ test2:
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ int T0191_writesame16_unmap_unaligned(const char *initiator, const char *url, in
|
|||||||
|
|
||||||
if (rc16->lbpme == 0){
|
if (rc16->lbpme == 0){
|
||||||
printf("Logical unit is fully provisioned. Skipping test\n");
|
printf("Logical unit is fully provisioned. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ int T0191_writesame16_unmap_unaligned(const char *initiator, const char *url, in
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ int T0192_writesame16_beyondeol(const char *initiator, const char *url, int data
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ int T0193_writesame16_wrprotect(const char *initiator, const char *url, int data
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ int T0194_writesame16_0blocks(const char *initiator, const char *url, int data_l
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ int T0201_read16_rdprotect(const char *initiator, const char *url, int data_loss
|
|||||||
if(rc16->prot_en != 0) {
|
if(rc16->prot_en != 0) {
|
||||||
printf("device is formatted with protection information, skipping test\n");
|
printf("device is formatted with protection information, skipping test\n");
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ int T0202_read16_flags(const char *initiator, const char *url, int data_loss _U_
|
|||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
struct scsi_readcapacity16 *rc16;
|
struct scsi_readcapacity16 *rc16;
|
||||||
|
struct scsi_inquiry_standard *inq;
|
||||||
int ret = 0, lun;
|
int ret = 0, lun;
|
||||||
uint32_t block_size;
|
uint32_t block_size;
|
||||||
|
|
||||||
@@ -46,6 +47,24 @@ int T0202_read16_flags(const char *initiator, const char *url, int data_loss _U_
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This test is only valid for SBC devices */
|
||||||
|
task = iscsi_inquiry_sync(iscsi, lun, 0, 0, 64);
|
||||||
|
if (task == NULL || task->status != SCSI_STATUS_GOOD) {
|
||||||
|
printf("Inquiry command failed : %s\n", iscsi_get_error(iscsi));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
inq = scsi_datain_unmarshall(task);
|
||||||
|
if (inq == NULL) {
|
||||||
|
printf("failed to unmarshall inquiry datain blob\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (inq->periperal_device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||||
|
printf("LUN is not SBC device. Skipping test\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
/* find the size of the LUN */
|
/* find the size of the LUN */
|
||||||
task = iscsi_readcapacity16_sync(iscsi, lun);
|
task = iscsi_readcapacity16_sync(iscsi, lun);
|
||||||
if (task == NULL) {
|
if (task == NULL) {
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ int T0211_read12_rdprotect(const char *initiator, const char *url, int data_loss
|
|||||||
if(rc16->prot_en != 0) {
|
if(rc16->prot_en != 0) {
|
||||||
printf("device is formatted with protection information, skipping test\n");
|
printf("device is formatted with protection information, skipping test\n");
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ int T0212_read12_flags(const char *initiator, const char *url, int data_loss _U_
|
|||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
struct scsi_readcapacity16 *rc16;
|
struct scsi_readcapacity16 *rc16;
|
||||||
|
struct scsi_inquiry_standard *inq;
|
||||||
int ret = 0, lun;
|
int ret = 0, lun;
|
||||||
uint32_t block_size;
|
uint32_t block_size;
|
||||||
|
|
||||||
@@ -46,6 +47,24 @@ int T0212_read12_flags(const char *initiator, const char *url, int data_loss _U_
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This test is only valid for SBC devices */
|
||||||
|
task = iscsi_inquiry_sync(iscsi, lun, 0, 0, 64);
|
||||||
|
if (task == NULL || task->status != SCSI_STATUS_GOOD) {
|
||||||
|
printf("Inquiry command failed : %s\n", iscsi_get_error(iscsi));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
inq = scsi_datain_unmarshall(task);
|
||||||
|
if (inq == NULL) {
|
||||||
|
printf("failed to unmarshall inquiry datain blob\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (inq->periperal_device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||||
|
printf("LUN is not SBC device. Skipping test\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
/* find the size of the LUN */
|
/* find the size of the LUN */
|
||||||
task = iscsi_readcapacity16_sync(iscsi, lun);
|
task = iscsi_readcapacity16_sync(iscsi, lun);
|
||||||
if (task == NULL) {
|
if (task == NULL) {
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ int T0220_write16_simple(const char *initiator, const char *url, int data_loss,
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,13 +70,14 @@ int T0221_write16_wrprotect(const char *initiator, const char *url, int data_los
|
|||||||
if(rc16->prot_en != 0) {
|
if(rc16->prot_en != 0) {
|
||||||
printf("device is formatted with protection information, skipping test\n");
|
printf("device is formatted with protection information, skipping test\n");
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ int T0222_write16_flags(const char *initiator, const char *url, int data_loss, i
|
|||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
struct scsi_readcapacity16 *rc16;
|
struct scsi_readcapacity16 *rc16;
|
||||||
|
struct scsi_inquiry_standard *inq;
|
||||||
int ret = 0, lun;
|
int ret = 0, lun;
|
||||||
uint32_t block_size;
|
uint32_t block_size;
|
||||||
unsigned char data[256 * 512];
|
unsigned char data[256 * 512];
|
||||||
@@ -47,6 +48,24 @@ int T0222_write16_flags(const char *initiator, const char *url, int data_loss, i
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This test is only valid for SBC devices */
|
||||||
|
task = iscsi_inquiry_sync(iscsi, lun, 0, 0, 64);
|
||||||
|
if (task == NULL || task->status != SCSI_STATUS_GOOD) {
|
||||||
|
printf("Inquiry command failed : %s\n", iscsi_get_error(iscsi));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
inq = scsi_datain_unmarshall(task);
|
||||||
|
if (inq == NULL) {
|
||||||
|
printf("failed to unmarshall inquiry datain blob\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (inq->periperal_device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||||
|
printf("LUN is not SBC device. Skipping test\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
/* find the size of the LUN */
|
/* find the size of the LUN */
|
||||||
task = iscsi_readcapacity16_sync(iscsi, lun);
|
task = iscsi_readcapacity16_sync(iscsi, lun);
|
||||||
if (task == NULL) {
|
if (task == NULL) {
|
||||||
@@ -91,7 +110,7 @@ int T0222_write16_flags(const char *initiator, const char *url, int data_loss, i
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ int T0223_write16_0blocks(const char *initiator, const char *url, int data_loss,
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ int T0224_write16_beyondeol(const char *initiator, const char *url, int data_los
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ int T0230_write12_simple(const char *initiator, const char *url, int data_loss,
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,13 +70,14 @@ int T0231_write12_wrprotect(const char *initiator, const char *url, int data_los
|
|||||||
if(rc16->prot_en != 0) {
|
if(rc16->prot_en != 0) {
|
||||||
printf("device is formatted with protection information, skipping test\n");
|
printf("device is formatted with protection information, skipping test\n");
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ int T0232_write12_flags(const char *initiator, const char *url, int data_loss, i
|
|||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
struct scsi_readcapacity16 *rc16;
|
struct scsi_readcapacity16 *rc16;
|
||||||
|
struct scsi_inquiry_standard *inq;
|
||||||
int ret = 0, lun;
|
int ret = 0, lun;
|
||||||
uint32_t block_size;
|
uint32_t block_size;
|
||||||
unsigned char data[256 * 512];
|
unsigned char data[256 * 512];
|
||||||
@@ -47,6 +48,24 @@ int T0232_write12_flags(const char *initiator, const char *url, int data_loss, i
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This test is only valid for SBC devices */
|
||||||
|
task = iscsi_inquiry_sync(iscsi, lun, 0, 0, 64);
|
||||||
|
if (task == NULL || task->status != SCSI_STATUS_GOOD) {
|
||||||
|
printf("Inquiry command failed : %s\n", iscsi_get_error(iscsi));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
inq = scsi_datain_unmarshall(task);
|
||||||
|
if (inq == NULL) {
|
||||||
|
printf("failed to unmarshall inquiry datain blob\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (inq->periperal_device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||||
|
printf("LUN is not SBC device. Skipping test\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
/* find the size of the LUN */
|
/* find the size of the LUN */
|
||||||
task = iscsi_readcapacity16_sync(iscsi, lun);
|
task = iscsi_readcapacity16_sync(iscsi, lun);
|
||||||
if (task == NULL) {
|
if (task == NULL) {
|
||||||
@@ -91,7 +110,7 @@ int T0232_write12_flags(const char *initiator, const char *url, int data_loss, i
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ int T0233_write12_0blocks(const char *initiator, const char *url, int data_loss,
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ int T0234_write12_beyondeol(const char *initiator, const char *url, int data_los
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ int T0260_get_lba_status_simple(const char *initiator, const char *url, int data
|
|||||||
|
|
||||||
if (rc16->lbpme == 0){
|
if (rc16->lbpme == 0){
|
||||||
printf("Logical unit is fully provisioned. Skipping test\n");
|
printf("Logical unit is fully provisioned. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ int T0264_get_lba_status_beyondeol(const char *initiator, const char *url, int d
|
|||||||
|
|
||||||
if (rc16->lbpme == 0){
|
if (rc16->lbpme == 0){
|
||||||
printf("Logical unit is fully provisioned. Skipping test\n");
|
printf("Logical unit is fully provisioned. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ int T0290_write10_simple(const char *initiator, const char *url, int data_loss,
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,13 +70,14 @@ int T0291_write10_wrprotect(const char *initiator, const char *url, int data_los
|
|||||||
if(rc16->prot_en != 0) {
|
if(rc16->prot_en != 0) {
|
||||||
printf("device is formatted with protection information, skipping test\n");
|
printf("device is formatted with protection information, skipping test\n");
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ int T0292_write10_flags(const char *initiator, const char *url, int data_loss, i
|
|||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
struct scsi_readcapacity16 *rc16;
|
struct scsi_readcapacity16 *rc16;
|
||||||
|
struct scsi_inquiry_standard *inq;
|
||||||
int ret = 0, lun;
|
int ret = 0, lun;
|
||||||
uint32_t block_size;
|
uint32_t block_size;
|
||||||
unsigned char data[256 * 512];
|
unsigned char data[256 * 512];
|
||||||
@@ -47,6 +48,24 @@ int T0292_write10_flags(const char *initiator, const char *url, int data_loss, i
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This test is only valid for SBC devices */
|
||||||
|
task = iscsi_inquiry_sync(iscsi, lun, 0, 0, 64);
|
||||||
|
if (task == NULL || task->status != SCSI_STATUS_GOOD) {
|
||||||
|
printf("Inquiry command failed : %s\n", iscsi_get_error(iscsi));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
inq = scsi_datain_unmarshall(task);
|
||||||
|
if (inq == NULL) {
|
||||||
|
printf("failed to unmarshall inquiry datain blob\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (inq->periperal_device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||||
|
printf("LUN is not SBC device. Skipping test\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
/* find the size of the LUN */
|
/* find the size of the LUN */
|
||||||
task = iscsi_readcapacity16_sync(iscsi, lun);
|
task = iscsi_readcapacity16_sync(iscsi, lun);
|
||||||
if (task == NULL) {
|
if (task == NULL) {
|
||||||
@@ -91,7 +110,7 @@ int T0292_write10_flags(const char *initiator, const char *url, int data_loss, i
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ int T0293_write10_0blocks(const char *initiator, const char *url, int data_loss,
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ int T0294_write10_beyondeol(const char *initiator, const char *url, int data_los
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ int T0300_readonly(const char *initiator, const char *url, int data_loss, int sh
|
|||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
struct scsi_readcapacity16 *rc16;
|
struct scsi_readcapacity16 *rc16;
|
||||||
|
struct scsi_inquiry_standard *inq;
|
||||||
struct scsi_mode_sense *ms;
|
struct scsi_mode_sense *ms;
|
||||||
int ret, lun;
|
int ret, lun;
|
||||||
uint32_t block_size;
|
uint32_t block_size;
|
||||||
@@ -88,11 +89,27 @@ int T0300_readonly(const char *initiator, const char *url, int data_loss, int sh
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This test is only valid for SBC devices */
|
||||||
|
task = iscsi_inquiry_sync(iscsi, lun, 0, 0, 64);
|
||||||
|
if (task == NULL || task->status != SCSI_STATUS_GOOD) {
|
||||||
|
printf("Inquiry command failed : %s\n", iscsi_get_error(iscsi));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
inq = scsi_datain_unmarshall(task);
|
||||||
|
if (inq == NULL) {
|
||||||
|
printf("failed to unmarshall inquiry datain blob\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (inq->periperal_device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||||
|
printf("LUN is not SBC device. Skipping test\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* verify the device is readonly */
|
/* verify the device is readonly */
|
||||||
task = iscsi_modesense6_sync(iscsi, lun, 0, SCSI_MODESENSE_PC_CURRENT,
|
task = iscsi_modesense6_sync(iscsi, lun, 0, SCSI_MODESENSE_PC_CURRENT,
|
||||||
@@ -121,6 +138,7 @@ int T0300_readonly(const char *initiator, const char *url, int data_loss, int sh
|
|||||||
}
|
}
|
||||||
if (!(ms->device_specific_parameter & 0x80)) {
|
if (!(ms->device_specific_parameter & 0x80)) {
|
||||||
printf("Device is not read-only. Skipping test\n");
|
printf("Device is not read-only. Skipping test\n");
|
||||||
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ int T0310_writeverify10_simple(const char *initiator, const char *url, int data_
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ int T0311_writeverify10_wrprotect(const char *initiator, const char *url, int da
|
|||||||
|
|
||||||
if(rc16->prot_en != 0) {
|
if(rc16->prot_en != 0) {
|
||||||
printf("device is formatted with protection information, skipping test\n");
|
printf("device is formatted with protection information, skipping test\n");
|
||||||
|
ret = -2;
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
@@ -76,7 +77,7 @@ int T0311_writeverify10_wrprotect(const char *initiator, const char *url, int da
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ int T0314_writeverify10_beyondeol(const char *initiator, const char *url, int da
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ int T0320_writeverify12_simple(const char *initiator, const char *url, int data_
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,13 +70,14 @@ int T0321_writeverify12_wrprotect(const char *initiator, const char *url, int da
|
|||||||
if(rc16->prot_en != 0) {
|
if(rc16->prot_en != 0) {
|
||||||
printf("device is formatted with protection information, skipping test\n");
|
printf("device is formatted with protection information, skipping test\n");
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ int T0324_writeverify12_beyondeol(const char *initiator, const char *url, int da
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ int T0330_writeverify16_simple(const char *initiator, const char *url, int data_
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,13 +70,14 @@ int T0331_writeverify16_wrprotect(const char *initiator, const char *url, int da
|
|||||||
if(rc16->prot_en != 0) {
|
if(rc16->prot_en != 0) {
|
||||||
printf("device is formatted with protection information, skipping test\n");
|
printf("device is formatted with protection information, skipping test\n");
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ int T0334_writeverify16_beyondeol(const char *initiator, const char *url, int da
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ int T0340_compareandwrite_simple(const char *initiator, const char *url, int dat
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ int T0341_compareandwrite_mismatch(const char *initiator, const char *url, int d
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ int T0343_compareandwrite_beyondeol(const char *initiator, const char *url, int
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ int T0350_orwrite_simple(const char *initiator, const char *url, int data_loss,
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,13 +70,14 @@ int T0351_orwrite_wrprotect(const char *initiator, const char *url, int data_los
|
|||||||
if(rc16->prot_en != 0) {
|
if(rc16->prot_en != 0) {
|
||||||
printf("device is formatted with protection information, skipping test\n");
|
printf("device is formatted with protection information, skipping test\n");
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ int T0354_orwrite_beyondeol(const char *initiator, const char *url, int data_los
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ int T0360_startstopunit_simple(const char *initiator, const char *url, int data_
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ int T0361_startstopunit_pwrcnd(const char *initiator, const char *url, int data_
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ int T0370_nomedia(const char *initiator, const char *url, int data_loss, int sho
|
|||||||
|
|
||||||
if (!removable) {
|
if (!removable) {
|
||||||
printf("Media is not removable. Skipping test.\n");
|
printf("Media is not removable. Skipping test.\n");
|
||||||
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -538,6 +539,7 @@ test16:
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping all WRITE tests\n");
|
printf("--dataloss flag is not set. Skipping all WRITE tests\n");
|
||||||
|
ret = -2;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ int T0380_preventallow_simple(const char *initiator, const char *url, int data_l
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ int T0381_preventallow_eject(const char *initiator, const char *url, int data_lo
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,6 +112,7 @@ int T0381_preventallow_eject(const char *initiator, const char *url, int data_lo
|
|||||||
|
|
||||||
if (!removable) {
|
if (!removable) {
|
||||||
printf("Media is not removable. Skipping tests\n");
|
printf("Media is not removable. Skipping tests\n");
|
||||||
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ int T0382_preventallow_itnexus_loss(const char *initiator, const char *url, int
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,6 +114,7 @@ int T0382_preventallow_itnexus_loss(const char *initiator, const char *url, int
|
|||||||
|
|
||||||
if (!removable) {
|
if (!removable) {
|
||||||
printf("Media is not removable. Skipping tests\n");
|
printf("Media is not removable. Skipping tests\n");
|
||||||
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ int T0383_preventallow_target_warm_reset(const char *initiator, const char *url,
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,6 +132,7 @@ int T0383_preventallow_target_warm_reset(const char *initiator, const char *url,
|
|||||||
|
|
||||||
if (!removable) {
|
if (!removable) {
|
||||||
printf("Media is not removable. Skipping tests\n");
|
printf("Media is not removable. Skipping tests\n");
|
||||||
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ int T0384_preventallow_target_cold_reset(const char *initiator, const char *url,
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,6 +132,7 @@ int T0384_preventallow_target_cold_reset(const char *initiator, const char *url,
|
|||||||
|
|
||||||
if (!removable) {
|
if (!removable) {
|
||||||
printf("Media is not removable. Skipping tests\n");
|
printf("Media is not removable. Skipping tests\n");
|
||||||
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ int T0385_preventallow_lun_reset(const char *initiator, const char *url, int dat
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,6 +132,7 @@ int T0385_preventallow_lun_reset(const char *initiator, const char *url, int dat
|
|||||||
|
|
||||||
if (!removable) {
|
if (!removable) {
|
||||||
printf("Media is not removable. Skipping tests\n");
|
printf("Media is not removable. Skipping tests\n");
|
||||||
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ int T0386_preventallow_2_itl_nexuses(const char *initiator, const char *url, int
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,6 +115,7 @@ int T0386_preventallow_2_itl_nexuses(const char *initiator, const char *url, int
|
|||||||
|
|
||||||
if (!removable) {
|
if (!removable) {
|
||||||
printf("Media is not removable. Skipping tests\n");
|
printf("Media is not removable. Skipping tests\n");
|
||||||
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ int T0390_mandatory_opcodes_sbc(const char *initiator, const char *url, int data
|
|||||||
if (inq->periperal_device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
if (inq->periperal_device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||||
printf("Not a SBC device. Skipping test\n");
|
printf("Not a SBC device. Skipping test\n");
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +127,7 @@ int T0390_mandatory_opcodes_sbc(const char *initiator, const char *url, int data
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ int T1000_cmdsn_invalid(const char *initiator, const char *url, int data_loss, i
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ int T1010_datasn_invalid(const char *initiator, const char *url, int data_loss,
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ int T1020_bufferoffset_invalid(const char *initiator, const char *url, int data_
|
|||||||
|
|
||||||
if (!data_loss) {
|
if (!data_loss) {
|
||||||
printf("--dataloss flag is not set. Skipping test\n");
|
printf("--dataloss flag is not set. Skipping test\n");
|
||||||
ret = -1;
|
ret = -2;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ int main(int argc, const char *argv[])
|
|||||||
int extra_argc = 0;
|
int extra_argc = 0;
|
||||||
const char *url = NULL;
|
const char *url = NULL;
|
||||||
int show_help = 0, show_usage = 0, list_tests = 0;
|
int show_help = 0, show_usage = 0, list_tests = 0;
|
||||||
int res, ret;
|
int res, num_failed, num_skipped;
|
||||||
struct scsi_test *test;
|
struct scsi_test *test;
|
||||||
char *testname = NULL;
|
char *testname = NULL;
|
||||||
|
|
||||||
@@ -390,7 +390,7 @@ int main(int argc, const char *argv[])
|
|||||||
exit(10);
|
exit(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
num_failed = num_skipped = 0;
|
||||||
for (test = &tests[0]; test->name; test++) {
|
for (test = &tests[0]; test->name; test++) {
|
||||||
if (testname != NULL && fnmatch(testname, test->name, 0)) {
|
if (testname != NULL && fnmatch(testname, test->name, 0)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -399,13 +399,16 @@ int main(int argc, const char *argv[])
|
|||||||
res = test->test(initiator, url, data_loss, show_info);
|
res = test->test(initiator, url, data_loss, show_info);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
printf("TEST %s [OK]\n", test->name);
|
printf("TEST %s [OK]\n", test->name);
|
||||||
|
} else if (res == -2) {
|
||||||
|
printf("TEST %s [SKIPPED]\n", test->name);
|
||||||
|
num_skipped++;
|
||||||
} else {
|
} else {
|
||||||
printf("TEST %s [FAILED]\n", test->name);
|
printf("TEST %s [FAILED]\n", test->name);
|
||||||
ret++;
|
num_failed++;
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return num_failed ? num_failed : num_skipped ? 77 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ struct iscsi_async_state {
|
|||||||
int finished;
|
int finished;
|
||||||
};
|
};
|
||||||
void wait_until_test_finished(struct iscsi_context *iscsi, struct iscsi_async_state *test_state);
|
void wait_until_test_finished(struct iscsi_context *iscsi, struct iscsi_async_state *test_state);
|
||||||
|
|
||||||
|
struct iscsi_pdu;
|
||||||
void (*local_iscsi_queue_pdu)(struct iscsi_context *iscsi, struct iscsi_pdu *pdu);
|
void (*local_iscsi_queue_pdu)(struct iscsi_context *iscsi, struct iscsi_pdu *pdu);
|
||||||
|
|
||||||
int T0100_read10_simple(const char *initiator, const char *url, int data_loss, int show_info);
|
int T0100_read10_simple(const char *initiator, const char *url, int data_loss, int show_info);
|
||||||
|
|||||||
Reference in New Issue
Block a user