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:
Ronnie Sahlberg
2012-12-26 18:34:12 -08:00
parent 3c960c1d42
commit 5ad957b873
126 changed files with 1096 additions and 3554 deletions
+1 -26
View File
@@ -22,14 +22,12 @@
#include "scsi-lowlevel.h"
#include "iscsi-test.h"
int T0103_read10_rdprotect(const char *initiator, const char *url, int data_loss _U_, int show_info)
int T0103_read10_rdprotect(const char *initiator, const char *url)
{
struct iscsi_context *iscsi;
struct scsi_task *task;
int full_size;
struct scsi_inquiry_standard *inq;
struct scsi_readcapacity10 *rc10;
uint32_t block_size;
int ret, i, lun;
printf("0103_read10_rdprotect:\n");
@@ -85,29 +83,6 @@ int T0103_read10_rdprotect(const char *initiator, const char *url, int data_loss
scsi_free_scsi_task(task);
/* find the size of the LUN */
task = iscsi_readcapacity10_sync(iscsi, lun, 0, 0);
if (task == NULL) {
printf("Failed to send readcapacity10 command: %s\n", iscsi_get_error(iscsi));
ret = -1;
goto finished;
}
if (task->status != SCSI_STATUS_GOOD) {
printf("Readcapacity command: failed with sense. %s\n", iscsi_get_error(iscsi));
ret = -1;
scsi_free_scsi_task(task);
goto finished;
}
rc10 = scsi_datain_unmarshall(task);
if (rc10 == NULL) {
printf("failed to unmarshall readcapacity10 data. %s\n", iscsi_get_error(iscsi));
ret = -1;
scsi_free_scsi_task(task);
goto finished;
}
block_size = rc10->block_size;
scsi_free_scsi_task(task);
ret = 0;