diff --git a/test-tool/test_read6_simple.c b/test-tool/test_read6_simple.c index cb4a126..1799aaf 100644 --- a/test-tool/test_read6_simple.c +++ b/test-tool/test_read6_simple.c @@ -51,4 +51,31 @@ test_read6_simple(void) i * block_size, block_size, NULL); CU_ASSERT_EQUAL(ret, 0); } + + + + logging(LOG_VERBOSE, "Transfer length == 0 means we want to transfer " + "256 blocks"); + + logging(LOG_VERBOSE, "Test sending a READ6 with transfer length == 0 " + "(meaning 256 blocks)"); + /* 256 is converted to 0 when the CDB is marshalled by the helper */ + task = iscsi_read6_sync(iscsic, tgt_lun, 0, + 256 * block_size, block_size); + if (task->status != SCSI_STATUS_GOOD) { + logging(LOG_NORMAL, "[FAILED] READ6 command: " + "failed with sense. %s", iscsi_get_error(iscsic)); + scsi_free_scsi_task(task); + } + CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); + + logging(LOG_VERBOSE, "Verify that we did get 256 blocks of data back"); + if (task->datain.size == (int)(256 * block_size)) { + logging(LOG_VERBOSE, "[SUCCESS] Target returned 256 blocks of " + "data"); + } else { + logging(LOG_NORMAL, "[FAILED] Target did not return 256 " + "blocks of data"); + } + CU_ASSERT_EQUAL(task->datain.size, (int)(256 * block_size)); }