From 08cd206c4a5c1136080608795e8143530df83173 Mon Sep 17 00:00:00 2001 From: Khazhismel Kumykov Date: Fri, 12 Jul 2019 18:03:14 -0700 Subject: [PATCH] test-tool: fix async read/write test for bs != 512 Signed-off-by: Khazhismel Kumykov --- test-tool/test_async_read.c | 11 +++++------ test-tool/test_async_write.c | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/test-tool/test_async_read.c b/test-tool/test_async_read.c index 45850ac..d2d7b72 100644 --- a/test-tool/test_async_read.c +++ b/test-tool/test_async_read.c @@ -60,11 +60,10 @@ test_async_read(void) { int i, ret; struct tests_async_read_state state = { 0, 0, 0 }; - const int blocksize = 512; const int blocks_per_io = 8; const int num_ios = 1000; /* IOs in flight concurrently, so need a buffer large enough for all */ - unsigned char *buf = calloc(blocksize * blocks_per_io, num_ios); + unsigned char *buf = calloc(block_size * blocks_per_io, num_ios); CU_ASSERT_NOT_EQUAL(buf, NULL); if (!buf) @@ -87,13 +86,13 @@ test_async_read(void) uint32_t lba = i * blocks_per_io; struct scsi_task *atask; - atask = scsi_cdb_read10(lba, blocks_per_io * blocksize, - blocksize, 0, 0, 0, 0, 0); + atask = scsi_cdb_read10(lba, blocks_per_io * block_size, + block_size, 0, 0, 0, 0, 0); CU_ASSERT_PTR_NOT_NULL_FATAL(atask); ret = scsi_task_add_data_in_buffer(atask, - blocks_per_io * blocksize, - &buf[lba * blocksize]); + blocks_per_io * block_size, + &buf[lba * block_size]); CU_ASSERT_EQUAL(ret, 0); ret = iscsi_scsi_command_async(sd->iscsi_ctx, sd->iscsi_lun, diff --git a/test-tool/test_async_write.c b/test-tool/test_async_write.c index 06efc17..f68dbb5 100644 --- a/test-tool/test_async_write.c +++ b/test-tool/test_async_write.c @@ -59,11 +59,10 @@ test_async_write(void) { int i, ret; struct tests_async_write_state state = { 0, 0, 0 }; - int blocksize = 512; int blocks_per_io = 8; int num_ios = 1000; /* IOs in flight concurrently, but all using the same src buffer */ - unsigned char buf[blocksize * blocks_per_io]; + unsigned char buf[block_size * blocks_per_io]; CHECK_FOR_DATALOSS; CHECK_FOR_SBC; @@ -78,18 +77,18 @@ test_async_write(void) return; } - memset(buf, 0, blocksize * blocks_per_io); + memset(buf, 0, block_size * blocks_per_io); for (i = 0; i < num_ios; i++) { uint32_t lba = i * blocks_per_io; struct scsi_task *atask; - atask = scsi_cdb_write10(lba, blocks_per_io * blocksize, - blocksize, 0, 0, 0, 0, 0); + atask = scsi_cdb_write10(lba, blocks_per_io * block_size, + block_size, 0, 0, 0, 0, 0); CU_ASSERT_PTR_NOT_NULL_FATAL(atask); ret = scsi_task_add_data_out_buffer(atask, - blocks_per_io * blocksize, + blocks_per_io * block_size, buf); CU_ASSERT_EQUAL(ret, 0);