TESTS: update main program to use helpers instead of calling directly to libiscsi
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
@@ -1331,16 +1331,24 @@ out:
|
||||
* Returns -1 if allocating a SCSI task failed or if a communication error
|
||||
* occurred and a SCSI status if a SCSI response has been received.
|
||||
*/
|
||||
int mode_sense(struct scsi_device *sdev)
|
||||
int modesense6(struct scsi_device *sdev, struct scsi_task **out_task, int dbd, enum scsi_modesense_page_control pc, enum scsi_modesense_page_code page_code, int sub_page_code, unsigned char alloc_len, int status, enum scsi_sense_key key, int *ascq, int num_ascq)
|
||||
{
|
||||
struct scsi_task *t;
|
||||
enum scsi_status ret = -1;
|
||||
struct scsi_task *task;
|
||||
int ret;
|
||||
|
||||
t = iscsi_modesense6_sync(sdev->iscsi_ctx, sdev->iscsi_lun, 0, SCSI_MODESENSE_PC_CURRENT,
|
||||
SCSI_MODEPAGE_RETURN_ALL_PAGES, 0, 255);
|
||||
if (t) {
|
||||
ret = t->status;
|
||||
scsi_free_scsi_task(t);
|
||||
logging(LOG_VERBOSE, "Send MODESENSE6 (Expecting %s) ",
|
||||
scsi_status_str(status));
|
||||
|
||||
task = scsi_cdb_modesense6(dbd, pc, page_code, sub_page_code, alloc_len);
|
||||
assert(task != NULL);
|
||||
|
||||
task = send_scsi_command(sdev, task, NULL);
|
||||
|
||||
ret = check_result("MODESENSE6", sdev, task, status, key, ascq, num_ascq);
|
||||
if (out_task) {
|
||||
*out_task = task;
|
||||
} else if (task) {
|
||||
scsi_free_scsi_task(task);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -1609,7 +1617,7 @@ read16(struct scsi_device *sdev, uint64_t lba,
|
||||
}
|
||||
|
||||
int
|
||||
readcapacity10(struct scsi_device *sdev, uint32_t lba, int pmi, int status, enum scsi_sense_key key, int *ascq, int num_ascq)
|
||||
readcapacity10(struct scsi_device *sdev, struct scsi_task **out_task, uint32_t lba, int pmi, int status, enum scsi_sense_key key, int *ascq, int num_ascq)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
int ret;
|
||||
@@ -1625,14 +1633,16 @@ readcapacity10(struct scsi_device *sdev, uint32_t lba, int pmi, int status, enum
|
||||
task = send_scsi_command(sdev, task, NULL);
|
||||
|
||||
ret = check_result("READCAPACITY10", sdev, task, status, key, ascq, num_ascq);
|
||||
if (task) {
|
||||
if (out_task) {
|
||||
*out_task = task;
|
||||
} else if (task) {
|
||||
scsi_free_scsi_task(task);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
readcapacity16(struct scsi_device *sdev, int alloc_len, int status, enum scsi_sense_key key, int *ascq, int num_ascq)
|
||||
readcapacity16(struct scsi_device *sdev, struct scsi_task **out_task, int alloc_len, int status, enum scsi_sense_key key, int *ascq, int num_ascq)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
int ret;
|
||||
@@ -1646,7 +1656,9 @@ readcapacity16(struct scsi_device *sdev, int alloc_len, int status, enum scsi_se
|
||||
task = send_scsi_command(sdev, task, NULL);
|
||||
|
||||
ret = check_result("READCAPACITY16", sdev, task, status, key, ascq, num_ascq);
|
||||
if (task) {
|
||||
if (out_task) {
|
||||
*out_task = task;
|
||||
} else if (task) {
|
||||
scsi_free_scsi_task(task);
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -266,9 +266,11 @@ int verify_read_works(struct scsi_device *sdev, unsigned char *buf);
|
||||
int verify_write_works(struct scsi_device *sdev, unsigned char *buf);
|
||||
int verify_read_fails(struct scsi_device *sdev, unsigned char *buf);
|
||||
int verify_write_fails(struct scsi_device *sdev, unsigned char *buf);
|
||||
int inquiry(struct scsi_device *sdev, struct scsi_task **task, int evpd, int page_code, int maxsize, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
|
||||
int compareandwrite(struct scsi_device *sdev, uint64_t lba, unsigned char *data, uint32_t len, int blocksize, int wrprotect, int dpo, int fua, int group_number, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int get_lba_status(struct scsi_device *sdev, struct scsi_task **task, uint64_t lba, uint32_t len, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int inquiry(struct scsi_device *sdev, struct scsi_task **task, int evpd, int page_code, int maxsize, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int modesense6(struct scsi_device *sdev, struct scsi_task **task, int dbd, enum scsi_modesense_page_control pc, enum scsi_modesense_page_code page_code, int sub_page_code, unsigned char alloc_len, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int orwrite(struct scsi_device *sdev, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int prefetch10(struct scsi_device *sdev, uint32_t lba, int num_blocks, int immed, int group, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int prefetch16(struct scsi_device *sdev, uint64_t lba, int num_blocks, int immed, int group, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
@@ -277,8 +279,8 @@ int read6(struct scsi_device *sdev, uint32_t lba, uint32_t datalen, int blocksiz
|
||||
int read10(struct scsi_device *sdev, struct scsi_task **task, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int read12(struct scsi_device *sdev, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int read16(struct scsi_device *sdev, uint64_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int readcapacity10(struct scsi_device *sdev, uint32_t lba, int pmi, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int readcapacity16(struct scsi_device *sdev, int alloc_len, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int readcapacity10(struct scsi_device *sdev, struct scsi_task **task, uint32_t lba, int pmi, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int readcapacity16(struct scsi_device *sdev, struct scsi_task **task, int alloc_len, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int report_supported_opcodes(struct scsi_device *sdev, struct scsi_task **save_task, int rctd, int options, int opcode, int sa, int alloc_len, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int release6(struct scsi_device *sdev);
|
||||
int reserve6(struct scsi_device *sdev);
|
||||
@@ -292,7 +294,6 @@ int synchronizecache10(struct scsi_device *sdev, uint32_t lba, int num_blocks, i
|
||||
int synchronizecache16(struct scsi_device *sdev, uint64_t lba, int num_blocks, int sync_nv, int immed, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int testunitready_clear_ua(struct scsi_device *sdev);
|
||||
int testunitready(struct scsi_device *sdev, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int mode_sense(struct scsi_device *sdev);
|
||||
int unmap(struct scsi_device *sdev, int anchor, struct unmap_list *list, int list_len, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int verify10(struct scsi_device *sdev, uint32_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int verify12(struct scsi_device *sdev, uint32_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
|
||||
@@ -673,6 +673,10 @@ test_teardown(void)
|
||||
int
|
||||
suite_init(void)
|
||||
{
|
||||
if (sd->iscsi_ctx) {
|
||||
iscsi_logout_sync(sd->iscsi_ctx);
|
||||
iscsi_destroy_context(sd->iscsi_ctx);
|
||||
}
|
||||
sd->iscsi_ctx = iscsi_context_login(initiatorname1, sd->iscsi_url, &sd->iscsi_lun);
|
||||
if (sd->iscsi_ctx == NULL) {
|
||||
fprintf(stderr,
|
||||
@@ -857,6 +861,24 @@ static void parse_and_add_tests(char *testname_re)
|
||||
parse_and_add_test(testname_re);
|
||||
}
|
||||
|
||||
static void free_scsi_device(struct scsi_device *sdev)
|
||||
{
|
||||
if (sdev->error_str) {
|
||||
free(discard_const(sdev->error_str));
|
||||
sdev->error_str = NULL;
|
||||
}
|
||||
if (sdev->iscsi_url) {
|
||||
free(discard_const(sdev->iscsi_url));
|
||||
sdev->iscsi_url = NULL;
|
||||
}
|
||||
if (sdev->iscsi_ctx) {
|
||||
iscsi_logout_sync(sdev->iscsi_ctx);
|
||||
iscsi_destroy_context(sdev->iscsi_ctx);
|
||||
sdev->iscsi_ctx = NULL;
|
||||
}
|
||||
free(sd);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
@@ -897,6 +919,7 @@ main(int argc, char *argv[])
|
||||
int opt_idx = 0;
|
||||
|
||||
sd = malloc(sizeof(struct scsi_device));
|
||||
memset(sd, '\0', sizeof(struct scsi_device));
|
||||
|
||||
while ((c = getopt_long(argc, argv, "?hli:I:t:sdgfAsSnuvxV", long_opts,
|
||||
&opt_idx)) > 0) {
|
||||
@@ -989,33 +1012,35 @@ main(int argc, char *argv[])
|
||||
* All devices support readcapacity10 but only some support
|
||||
* readcapacity16
|
||||
*/
|
||||
task = iscsi_readcapacity10_sync(sd->iscsi_ctx, sd->iscsi_lun, 0, 0);
|
||||
task = NULL;
|
||||
readcapacity10(sd, &task, 0, 0, EXPECT_STATUS_GOOD);
|
||||
if (task == NULL) {
|
||||
printf("Failed to send READCAPACITY10 command: %s\n", sd->error_str);
|
||||
iscsi_destroy_context(sd->iscsi_ctx);
|
||||
free_scsi_device(sd);
|
||||
return -1;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("READCAPACITY10 command: failed with sense. %s\n", sd->error_str);
|
||||
scsi_free_scsi_task(task);
|
||||
iscsi_destroy_context(sd->iscsi_ctx);
|
||||
free_scsi_device(sd);
|
||||
return -1;
|
||||
}
|
||||
rc10 = scsi_datain_unmarshall(task);
|
||||
if (rc10 == NULL) {
|
||||
printf("failed to unmarshall READCAPACITY10 data.\n");
|
||||
scsi_free_scsi_task(task);
|
||||
iscsi_destroy_context(sd->iscsi_ctx);
|
||||
free_scsi_device(sd);
|
||||
return -1;
|
||||
}
|
||||
block_size = rc10->block_size;
|
||||
num_blocks = rc10->lba + 1;
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
rc16_task = iscsi_readcapacity16_sync(sd->iscsi_ctx, sd->iscsi_lun);
|
||||
rc16_task = NULL;
|
||||
readcapacity16(sd, &rc16_task, 96, EXPECT_STATUS_GOOD);
|
||||
if (rc16_task == NULL) {
|
||||
printf("Failed to send READCAPACITY16 command: %s\n", sd->error_str);
|
||||
iscsi_destroy_context(sd->iscsi_ctx);
|
||||
free_scsi_device(sd);
|
||||
return -1;
|
||||
}
|
||||
if (rc16_task->status == SCSI_STATUS_GOOD) {
|
||||
@@ -1023,7 +1048,7 @@ main(int argc, char *argv[])
|
||||
if (rc16 == NULL) {
|
||||
printf("failed to unmarshall READCAPACITY16 data. %s\n", sd->error_str);
|
||||
scsi_free_scsi_task(rc16_task);
|
||||
iscsi_destroy_context(sd->iscsi_ctx);
|
||||
free_scsi_device(sd);
|
||||
return -1;
|
||||
}
|
||||
block_size = rc16->block_length;
|
||||
@@ -1031,7 +1056,8 @@ main(int argc, char *argv[])
|
||||
lbppb = 1 << rc16->lbppbe;
|
||||
}
|
||||
|
||||
inq_task = iscsi_inquiry_sync(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 64);
|
||||
inq_task = NULL;
|
||||
inquiry(sd, &inq_task, 0, 0, 64, EXPECT_STATUS_GOOD);
|
||||
if (inq_task == NULL || inq_task->status != SCSI_STATUS_GOOD) {
|
||||
printf("Inquiry command failed : %s\n", sd->error_str);
|
||||
return -1;
|
||||
@@ -1041,7 +1067,8 @@ main(int argc, char *argv[])
|
||||
scsi_free_scsi_task(inq_task);
|
||||
|
||||
/* we need more data for the full list */
|
||||
inq_task = iscsi_inquiry_sync(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, full_size);
|
||||
inq_task = NULL;
|
||||
inquiry(sd, &inq_task, 0, 0, full_size, EXPECT_STATUS_GOOD);
|
||||
if (inq_task == NULL) {
|
||||
printf("Inquiry command failed : %s\n", sd->error_str);
|
||||
return -1;
|
||||
@@ -1062,7 +1089,8 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* try reading block limits vpd */
|
||||
inq_bl_task = iscsi_inquiry_sync(sd->iscsi_ctx, sd->iscsi_lun, 1, SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS, 64);
|
||||
inq_bl_task = NULL;
|
||||
inquiry(sd, &inq_bl_task, 1, SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS, 64, EXPECT_STATUS_GOOD);
|
||||
if (inq_bl_task && inq_bl_task->status != SCSI_STATUS_GOOD) {
|
||||
scsi_free_scsi_task(inq_bl_task);
|
||||
inq_bl_task = NULL;
|
||||
@@ -1072,7 +1100,10 @@ main(int argc, char *argv[])
|
||||
if (full_size > inq_bl_task->datain.size) {
|
||||
scsi_free_scsi_task(inq_bl_task);
|
||||
|
||||
if ((inq_bl_task = iscsi_inquiry_sync(sd->iscsi_ctx, sd->iscsi_lun, 1, SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS, full_size)) == NULL) {
|
||||
inq_bl_task = NULL;
|
||||
inquiry(sd, &inq_bl_task, 1, SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS, full_size,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (inq_bl_task == NULL) {
|
||||
printf("Inquiry command failed : %s\n", sd->error_str);
|
||||
return -1;
|
||||
}
|
||||
@@ -1086,7 +1117,9 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* try reading block device characteristics vpd */
|
||||
inq_bdc_task = iscsi_inquiry_sync(sd->iscsi_ctx, sd->iscsi_lun, 1, SCSI_INQUIRY_PAGECODE_BLOCK_DEVICE_CHARACTERISTICS, 255);
|
||||
inq_bdc_task = NULL;
|
||||
inquiry(sd, &inq_bdc_task, 1, SCSI_INQUIRY_PAGECODE_BLOCK_DEVICE_CHARACTERISTICS, 255,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (inq_bdc_task == NULL) {
|
||||
printf("Failed to read Block Device Characteristics page\n");
|
||||
}
|
||||
@@ -1100,7 +1133,9 @@ main(int argc, char *argv[])
|
||||
|
||||
/* if thin provisioned we also need to read the VPD page for it */
|
||||
if (rc16 && rc16->lbpme != 0){
|
||||
inq_lbp_task = iscsi_inquiry_sync(sd->iscsi_ctx, sd->iscsi_lun, 1, SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING, 64);
|
||||
inq_lbp_task = NULL;
|
||||
inquiry(sd, &inq_lbp_task, 1, SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING, 64,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (inq_lbp_task == NULL || inq_lbp_task->status != SCSI_STATUS_GOOD) {
|
||||
printf("Inquiry command failed : %s\n", sd->error_str);
|
||||
return -1;
|
||||
@@ -1110,7 +1145,10 @@ main(int argc, char *argv[])
|
||||
scsi_free_scsi_task(inq_lbp_task);
|
||||
|
||||
/* we need more data for the full list */
|
||||
if ((inq_lbp_task = iscsi_inquiry_sync(sd->iscsi_ctx, sd->iscsi_lun, 1, SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING, full_size)) == NULL) {
|
||||
inq_lbp_task = NULL;
|
||||
inquiry(sd, &inq_lbp_task, 1, SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING,
|
||||
full_size, EXPECT_STATUS_GOOD);
|
||||
if (inq_lbp_task == NULL) {
|
||||
printf("Inquiry command failed : %s\n", sd->error_str);
|
||||
return -1;
|
||||
}
|
||||
@@ -1123,11 +1161,12 @@ main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
rsop_task = iscsi_report_supported_opcodes_sync(sd->iscsi_ctx, sd->iscsi_lun,
|
||||
1, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0, 65535);
|
||||
rsop_task = NULL;
|
||||
report_supported_opcodes(sd, &rsop_task, 1, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0, 65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (rsop_task == NULL) {
|
||||
printf("Failed to send REPORT_SUPPORTED_OPCODES command: %s\n", sd->error_str);
|
||||
iscsi_destroy_context(sd->iscsi_ctx);
|
||||
free_scsi_device(sd);
|
||||
return -1;
|
||||
}
|
||||
if (rsop_task->status == SCSI_STATUS_GOOD) {
|
||||
@@ -1139,12 +1178,12 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* check if the device is write protected or not */
|
||||
task = iscsi_modesense6_sync(sd->iscsi_ctx, sd->iscsi_lun, 0, SCSI_MODESENSE_PC_CURRENT,
|
||||
SCSI_MODEPAGE_RETURN_ALL_PAGES,
|
||||
0, 255);
|
||||
task = NULL;
|
||||
modesense6(sd, &task, 0, SCSI_MODESENSE_PC_CURRENT, SCSI_MODEPAGE_RETURN_ALL_PAGES, 0, 255,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (task == NULL) {
|
||||
printf("Failed to send MODE_SENSE6 command: %s\n", sd->error_str);
|
||||
iscsi_destroy_context(sd->iscsi_ctx);
|
||||
free_scsi_device(sd);
|
||||
return -1;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
@@ -1160,9 +1199,6 @@ main(int argc, char *argv[])
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
iscsi_logout_sync(sd->iscsi_ctx);
|
||||
iscsi_destroy_context(sd->iscsi_ctx);
|
||||
|
||||
if (is_usb) {
|
||||
printf("USB device. Clamping maximum transfer length to 120k\n");
|
||||
maximum_transfer_length = 120 *1024 / block_size;
|
||||
@@ -1198,7 +1234,6 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
CU_cleanup_registry();
|
||||
free(discard_const(sd->iscsi_url));
|
||||
|
||||
if (inq_task != NULL) {
|
||||
scsi_free_scsi_task(inq_task);
|
||||
@@ -1218,8 +1253,7 @@ main(int argc, char *argv[])
|
||||
if (rsop_task != NULL) {
|
||||
scsi_free_scsi_task(rsop_task);
|
||||
}
|
||||
if (sd != NULL) {
|
||||
free(sd);
|
||||
}
|
||||
free_scsi_device(sd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -42,13 +42,13 @@ test_mandatory_sbc(void)
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test READCAPACITY10.");
|
||||
ret = readcapacity10(sd, 0, 0,
|
||||
ret = readcapacity10(sd, NULL, 0, 0,
|
||||
EXPECT_STATUS_GOOD);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
if (sbc3_support) {
|
||||
logging(LOG_VERBOSE, "Test READCAPACITY16. The device claims SBC-3 support.");
|
||||
ret = readcapacity16(sd, 15,
|
||||
ret = readcapacity16(sd, NULL, 15,
|
||||
EXPECT_STATUS_GOOD);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
@@ -91,12 +91,12 @@ test_nomedia_sbc(void)
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test READCAPACITY10 when medium is ejected.");
|
||||
ret = readcapacity10(sd, 0, 0,
|
||||
ret = readcapacity10(sd, NULL, 0, 0,
|
||||
EXPECT_NO_MEDIUM);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test READCAPACITY16 when medium is ejected.");
|
||||
ret = readcapacity16(sd, 15,
|
||||
ret = readcapacity16(sd, NULL, 15,
|
||||
EXPECT_NO_MEDIUM);
|
||||
if (ret == -2) {
|
||||
if (sbc3_support) {
|
||||
|
||||
@@ -34,7 +34,7 @@ test_readcapacity10_simple(void)
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test basic READCAPACITY10");
|
||||
|
||||
ret = readcapacity10(sd, 0, 0,
|
||||
ret = readcapacity10(sd, NULL, 0, 0,
|
||||
EXPECT_STATUS_GOOD);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ test_readcapacity16_alloclen(void)
|
||||
logging(LOG_VERBOSE, "Test that READCAPACITY16 with alloc_len 0-15 is not an error");
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
ret = readcapacity16(sd, i,
|
||||
ret = readcapacity16(sd, NULL, i,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] READCAPACITY16 is not implemented on this target and it does not claim SBC-3 support.");
|
||||
|
||||
@@ -34,7 +34,7 @@ test_readcapacity16_simple(void)
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test that READCAPACITY16 works");
|
||||
|
||||
ret = readcapacity16(sd, 16,
|
||||
ret = readcapacity16(sd, NULL, 16,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] READCAPACITY16 is not implemented on this target and it does not claim support.");
|
||||
|
||||
@@ -68,11 +68,13 @@ test_reserve6_2initiators(void)
|
||||
|
||||
|
||||
logging(LOG_NORMAL, "Test we can still send MODE SENSE from the first initiator");
|
||||
ret = mode_sense(sd);
|
||||
ret = modesense6(sd, NULL, 0, SCSI_MODESENSE_PC_CURRENT, SCSI_MODEPAGE_RETURN_ALL_PAGES, 0, 255,
|
||||
EXPECT_STATUS_GOOD);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_NORMAL, "MODE SENSE should fail from the second initiator");
|
||||
ret = mode_sense(&sd2);
|
||||
ret = modesense6(&sd2, NULL, 0, SCSI_MODESENSE_PC_CURRENT, SCSI_MODEPAGE_RETURN_ALL_PAGES, 0, 255,
|
||||
EXPECT_STATUS_GOOD);
|
||||
CU_ASSERT_EQUAL(ret, SCSI_STATUS_RESERVATION_CONFLICT);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user