TESTS: Start fixing up the tests so we can test-suite them properly
Dont call READCAPACITY from every single test. Remove two arguments from the test signatures and turn them into globals. remove the ret++ silliness. Tests return 0 : all ok, -2, skipped or -1 : test failed
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
#include "scsi-lowlevel.h"
|
||||
#include "iscsi-test.h"
|
||||
|
||||
int T0362_startstopunit_noloej(const char *initiator, const char *url, int data_loss, int show_info)
|
||||
int T0362_startstopunit_noloej(const char *initiator, const char *url)
|
||||
{
|
||||
struct iscsi_context *iscsi;
|
||||
struct scsi_task *task;
|
||||
@@ -101,14 +101,14 @@ int T0362_startstopunit_noloej(const char *initiator, const char *url, int data_
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send STARTSTOPUNIT command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto test2;
|
||||
goto finished;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("STARTSTOPUNIT command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto test2;
|
||||
goto finished;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
@@ -120,7 +120,6 @@ int T0362_startstopunit_noloej(const char *initiator, const char *url, int data_
|
||||
}
|
||||
|
||||
|
||||
test2:
|
||||
/* in case the previous command did eject the media */
|
||||
iscsi_startstopunit_sync(iscsi, lun, 1, 0, 0, 0, 1, 1);
|
||||
|
||||
@@ -130,14 +129,14 @@ test2:
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send STARTSTOPUNIT command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto test3;
|
||||
goto finished;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("STARTSTOPUNIT command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto test3;
|
||||
goto finished;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
@@ -149,7 +148,6 @@ test2:
|
||||
}
|
||||
|
||||
|
||||
test3:
|
||||
/* in case the previous command did eject the media */
|
||||
iscsi_startstopunit_sync(iscsi, lun, 1, 0, 0, 0, 1, 1);
|
||||
|
||||
@@ -159,14 +157,14 @@ test3:
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send STARTSTOPUNIT command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto test4;
|
||||
goto finished;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("STARTSTOPUNIT command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto test4;
|
||||
goto finished;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
@@ -178,8 +176,6 @@ test3:
|
||||
}
|
||||
|
||||
|
||||
|
||||
test4:
|
||||
/* in case the previous command did eject the media */
|
||||
iscsi_startstopunit_sync(iscsi, lun, 1, 0, 0, 0, 1, 1);
|
||||
|
||||
@@ -189,14 +185,14 @@ test4:
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send STARTSTOPUNIT command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto test5;
|
||||
goto finished;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("STARTSTOPUNIT command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto test5;
|
||||
goto finished;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
@@ -208,7 +204,6 @@ test4:
|
||||
}
|
||||
|
||||
|
||||
test5:
|
||||
/* in case the previous command did eject the media */
|
||||
iscsi_startstopunit_sync(iscsi, lun, 1, 0, 0, 0, 1, 1);
|
||||
|
||||
@@ -218,14 +213,14 @@ test5:
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send STARTSTOPUNIT command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto test6;
|
||||
goto finished;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("STARTSTOPUNIT command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto test6;
|
||||
goto finished;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
@@ -237,7 +232,6 @@ test5:
|
||||
}
|
||||
|
||||
|
||||
test6:
|
||||
/* in case the previous command did eject the media */
|
||||
iscsi_startstopunit_sync(iscsi, lun, 1, 0, 0, 0, 1, 1);
|
||||
|
||||
@@ -247,14 +241,14 @@ test6:
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send STARTSTOPUNIT command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto test7;
|
||||
goto finished;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("STARTSTOPUNIT command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto test7;
|
||||
goto finished;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
@@ -266,7 +260,6 @@ test6:
|
||||
}
|
||||
|
||||
|
||||
test7:
|
||||
/* in case the previous command did eject the media */
|
||||
iscsi_startstopunit_sync(iscsi, lun, 1, 0, 0, 0, 1, 1);
|
||||
|
||||
@@ -276,14 +269,14 @@ test7:
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send STARTSTOPUNIT command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto test8;
|
||||
goto finished;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("STARTSTOPUNIT command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto test8;
|
||||
goto finished;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
@@ -295,7 +288,6 @@ test7:
|
||||
}
|
||||
|
||||
|
||||
test8:
|
||||
/* in case the previous command did eject the media */
|
||||
iscsi_startstopunit_sync(iscsi, lun, 1, 0, 0, 0, 1, 1);
|
||||
|
||||
@@ -305,14 +297,14 @@ test8:
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send STARTSTOPUNIT command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto test9;
|
||||
goto finished;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("STARTSTOPUNIT command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto test9;
|
||||
goto finished;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
@@ -324,7 +316,6 @@ test8:
|
||||
}
|
||||
|
||||
|
||||
test9:
|
||||
/* in case the previous command did eject the media */
|
||||
iscsi_startstopunit_sync(iscsi, lun, 1, 0, 0, 0, 1, 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user