From acc2871ab04c2c6ab61dd83f5519a65a554f96a3 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Mon, 18 Apr 2011 17:38:50 +1000 Subject: [PATCH] Fix the 4 residual tests for read10 --- test-tool/0105_read10_invalid.c | 47 ++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/test-tool/0105_read10_invalid.c b/test-tool/0105_read10_invalid.c index a2eb09d..cd1836e 100644 --- a/test-tool/0105_read10_invalid.c +++ b/test-tool/0105_read10_invalid.c @@ -63,13 +63,20 @@ int T0105_read10_invalid(const char *initiator, const char *url) goto finished; } - if (task->status == SCSI_STATUS_GOOD) { + if (task->status != SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("Read10 of 1 block with iscsi ExpectedDataTransferLength==0 should fail.\n"); + printf("Read10 of 1 block with iscsi ExpectedDataTransferLength==0 should not fail.\n"); ret = -1; scsi_free_scsi_task(task); goto test2; } + if (task->residual_status != SCSI_RESIDUAL_OVERFLOW || task->residual != 512) { + printf("[FAILED]\n"); + printf("Read10 returned incorrect residual overflow.\n"); + ret = -1; + scsi_free_scsi_task(task); + goto test5; + } scsi_free_scsi_task(task); printf("[OK]\n"); @@ -99,13 +106,20 @@ test2: goto finished; } - if (task->status == SCSI_STATUS_GOOD) { + if (task->status != SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("Read10 of 1 block with iscsi ExpectedDataTransferLength==1024 should fail.\n"); + printf("Read10 of 1 block with iscsi ExpectedDataTransferLength==1024 should not fail.\n"); ret = -1; scsi_free_scsi_task(task); goto test3; } + if (task->residual_status != SCSI_RESIDUAL_UNDERFLOW || task->residual != 512) { + printf("[FAILED]\n"); + printf("Read10 returned incorrect residual underflow.\n"); + ret = -1; + scsi_free_scsi_task(task); + goto test5; + } scsi_free_scsi_task(task); printf("[OK]\n"); @@ -135,17 +149,23 @@ test3: goto finished; } - if (task->status == SCSI_STATUS_GOOD) { + if (task->status != SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("Read10 of 1 block with iscsi ExpectedDataTransferLength==200 should fail.\n"); + printf("Read10 of 1 block with iscsi ExpectedDataTransferLength==200 should not fail.\n"); ret = -1; scsi_free_scsi_task(task); goto test4; } + if (task->residual_status != SCSI_RESIDUAL_OVERFLOW || task->residual != 312) { + printf("[FAILED]\n"); + printf("Read10 returned incorrect residual overflow.\n"); + ret = -1; + scsi_free_scsi_task(task); + goto test5; + } scsi_free_scsi_task(task); printf("[OK]\n"); - test4: /* Try a read of 2 blocks but xferlength == 512 */ printf("Read10 2 blocks but with iscsi ExpectedDataTransferLength==512 ... "); @@ -171,13 +191,21 @@ test4: goto finished; } - if (task->status == SCSI_STATUS_GOOD) { + if (task->status != SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("Read10 of 2 blocks with iscsi ExpectedDataTransferLength==512 should fail.\n"); + printf("Read10 of 2 blocks with iscsi ExpectedDataTransferLength==512 should succeed.\n"); ret = -1; scsi_free_scsi_task(task); goto test5; } + if (task->residual_status != SCSI_RESIDUAL_OVERFLOW || task->residual != 512) { + printf("[FAILED]\n"); + printf("Read10 returned incorrect residual overflow.\n"); + ret = -1; + scsi_free_scsi_task(task); + goto test5; + } + scsi_free_scsi_task(task); printf("[OK]\n"); @@ -220,7 +248,6 @@ test5: scsi_free_scsi_task(task); printf("[OK]\n"); - finished: iscsi_logout_sync(iscsi); iscsi_destroy_context(iscsi);