TESTS: Create helpers for verify12 and switch all tests to use them

This commit is contained in:
Ronnie Sahlberg
2012-12-25 16:14:45 -08:00
parent 12179de245
commit 61ad9b1972
7 changed files with 252 additions and 212 deletions

View File

@@ -370,27 +370,11 @@ int T0370_nomedia(const char *initiator, const char *url, int data_loss, int sho
}
printf("Test VERIFY12 ... ");
task = iscsi_verify12_sync(iscsi, lun, buf, block_size, 0, 0, 0, 1, block_size);
if (task == NULL) {
printf("[FAILED]\n");
printf("Failed to send VERIFY12 command: %s\n", iscsi_get_error(iscsi));
ret = -1;
printf("Test VERIFY12.\n");
ret = verify12_nomedium(iscsi, lun, buf, block_size, 0, 0, 0, 1, block_size);
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("VERIFY12 after eject failed with the wrong sense code. Should fail with NOT_READY/MEDIUM_NOT_PRESENT*\n");
ret = -1;
scsi_free_scsi_task(task);
goto finished;
}
scsi_free_scsi_task(task);
printf("[OK]\n");
printf("Test VERIFY16 ... ");