TESTS: Convert 0361 and 0362 to use testunitready helpers
This commit is contained in:
@@ -111,24 +111,14 @@ int T0362_startstopunit_noloej(const char *initiator, const char *url, int data_
|
||||
goto test2;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
task = iscsi_testunitready_sync(iscsi, lun);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send TESTUNITREADY command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto test2;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("TESTUNITREADY command: failed with sense after STARTSTOPUNIT %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto test2;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
|
||||
printf("Check with TESTUNITREADY that the medium is still present.\n");
|
||||
ret = testunitready(iscsi, lun);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
|
||||
|
||||
test2:
|
||||
/* in case the previous command did eject the media */
|
||||
@@ -150,24 +140,14 @@ test2:
|
||||
goto test3;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
task = iscsi_testunitready_sync(iscsi, lun);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send TESTUNITREADY command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto test3;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("TESTUNITREADY command: failed with sense after STARTSTOPUNIT %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto test3;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
|
||||
printf("Check with TESTUNITREADY that the medium is still present.\n");
|
||||
ret = testunitready(iscsi, lun);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
|
||||
|
||||
test3:
|
||||
/* in case the previous command did eject the media */
|
||||
@@ -189,24 +169,15 @@ test3:
|
||||
goto test4;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
task = iscsi_testunitready_sync(iscsi, lun);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send TESTUNITREADY command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto test4;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("TESTUNITREADY command: failed with sense after STARTSTOPUNIT %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto test4;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
|
||||
printf("Check with TESTUNITREADY that the medium is still present.\n");
|
||||
ret = testunitready(iscsi, lun);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
|
||||
|
||||
|
||||
test4:
|
||||
/* in case the previous command did eject the media */
|
||||
@@ -228,24 +199,14 @@ test4:
|
||||
goto test5;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
task = iscsi_testunitready_sync(iscsi, lun);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send TESTUNITREADY command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto test5;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("TESTUNITREADY command: failed with sense after STARTSTOPUNIT %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto test5;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
|
||||
printf("Check with TESTUNITREADY that the medium is still present.\n");
|
||||
ret = testunitready(iscsi, lun);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
|
||||
|
||||
test5:
|
||||
/* in case the previous command did eject the media */
|
||||
@@ -267,24 +228,14 @@ test5:
|
||||
goto test6;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
task = iscsi_testunitready_sync(iscsi, lun);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send TESTUNITREADY command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto test6;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("TESTUNITREADY command: failed with sense after STARTSTOPUNIT %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto test6;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
|
||||
printf("Check with TESTUNITREADY that the medium is still present.\n");
|
||||
ret = testunitready(iscsi, lun);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
|
||||
|
||||
test6:
|
||||
/* in case the previous command did eject the media */
|
||||
@@ -306,24 +257,14 @@ test6:
|
||||
goto test7;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
task = iscsi_testunitready_sync(iscsi, lun);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send TESTUNITREADY command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto test7;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("TESTUNITREADY command: failed with sense after STARTSTOPUNIT %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto test7;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
|
||||
printf("Check with TESTUNITREADY that the medium is still present.\n");
|
||||
ret = testunitready(iscsi, lun);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
|
||||
|
||||
test7:
|
||||
/* in case the previous command did eject the media */
|
||||
@@ -345,24 +286,14 @@ test7:
|
||||
goto test8;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
task = iscsi_testunitready_sync(iscsi, lun);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send TESTUNITREADY command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto test8;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("TESTUNITREADY command: failed with sense after STARTSTOPUNIT %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto test8;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
|
||||
printf("Check with TESTUNITREADY that the medium is still present.\n");
|
||||
ret = testunitready(iscsi, lun);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
|
||||
|
||||
test8:
|
||||
/* in case the previous command did eject the media */
|
||||
@@ -384,24 +315,14 @@ test8:
|
||||
goto test9;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
task = iscsi_testunitready_sync(iscsi, lun);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send TESTUNITREADY command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto test9;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("TESTUNITREADY command: failed with sense after STARTSTOPUNIT %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto test9;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
|
||||
printf("Check with TESTUNITREADY that the medium is still present.\n");
|
||||
ret = testunitready(iscsi, lun);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
|
||||
|
||||
test9:
|
||||
/* in case the previous command did eject the media */
|
||||
|
||||
Reference in New Issue
Block a user