TESTS: create helpers for VERIFY10 and switch all tests over to use it.
This commit is contained in:
@@ -350,34 +350,24 @@ int T0370_nomedia(const char *initiator, const char *url, int data_loss, int sho
|
||||
|
||||
|
||||
printf("Test PREFETCH10.\n");
|
||||
prefetch10_nomedium(iscsi, lun, 0, 1, 1, 0);
|
||||
ret = prefetch10_nomedium(iscsi, lun, 0, 1, 1, 0);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
|
||||
|
||||
printf("Test PREFETCH16.\n");
|
||||
prefetch16_nomedium(iscsi, lun, 0, 1, 1, 0);
|
||||
|
||||
|
||||
printf("Test VERIFY10 ... ");
|
||||
task = iscsi_verify10_sync(iscsi, lun, buf, block_size, 0, 0, 0, 1, block_size);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send VERIFY10 command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
ret = prefetch16_nomedium(iscsi, lun, 0, 1, 1, 0);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
||||
|| task->sense.key != SCSI_SENSE_NOT_READY
|
||||
|| (task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT
|
||||
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_OPEN
|
||||
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_CLOSED)) {
|
||||
printf("[FAILED]\n");
|
||||
printf("VERIFY10 after eject failed with the wrong sense code. Should fail with NOT_READY/MEDIUM_NOT_PRESENT*\n");
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
|
||||
printf("Test VERIFY10.\n");
|
||||
ret = verify10_nomedium(iscsi, lun, buf, block_size, 0, 0, 0, 1, block_size);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
}
|
||||
|
||||
|
||||
printf("Test VERIFY12 ... ");
|
||||
|
||||
Reference in New Issue
Block a user