From 8c5c2c56b97c1cd0d8cbea5ee18d60c8b465ce5d Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Fri, 31 Aug 2018 13:20:45 +0900 Subject: [PATCH] ut/bdev_raid: Remove raid_bdev_send_passthru dependent test Cleverly, UT for raid bdev sets number of base bdevs by using the random number generator. When the random number generator outputs 1, test code especially for single base bdev case failed. When removing raid_bdev_send_passthru from library, the corresponding test code was not removed. This patch removes the test code. Change-Id: I23be88358fe364bc757979a26398b80339e19910 Signed-off-by: Shuhei Matsumoto Reviewed-on: https://review.gerrithub.io/424159 Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Kunal Sablok Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- test/unit/lib/bdev/bdev_raid.c/bdev_raid_ut.c | 55 ++++++++----------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/test/unit/lib/bdev/bdev_raid.c/bdev_raid_ut.c b/test/unit/lib/bdev/bdev_raid.c/bdev_raid_ut.c index 9505d5f60..53e900147 100644 --- a/test/unit/lib/bdev/bdev_raid.c/bdev_raid_ut.c +++ b/test/unit/lib/bdev/bdev_raid.c/bdev_raid_ut.c @@ -704,42 +704,33 @@ verify_io(struct spdk_bdev_io *bdev_io, uint8_t num_base_drives, SPDK_CU_ASSERT_FATAL(raid_bdev != NULL); SPDK_CU_ASSERT_FATAL(num_base_drives != 0); - if (raid_bdev->num_base_bdevs > 1) { - CU_ASSERT(splits_reqd == g_io_output_index); - for (strip = start_strip; strip <= end_strip; strip++, index++) { - pd_strip = strip / num_base_drives; - pd_idx = strip % num_base_drives; - if (strip == start_strip) { - offset_in_strip = bdev_io->u.bdev.offset_blocks & (g_strip_size - 1); - pd_lba = (pd_strip << strip_shift) + offset_in_strip; - if (strip == end_strip) { - pd_blocks = bdev_io->u.bdev.num_blocks; - } else { - pd_blocks = g_strip_size - offset_in_strip; - } - } else if (strip == end_strip) { - pd_lba = pd_strip << strip_shift; - pd_blocks = ((bdev_io->u.bdev.offset_blocks + bdev_io->u.bdev.num_blocks - 1) & - (g_strip_size - 1)) + 1; + CU_ASSERT(splits_reqd == g_io_output_index); + for (strip = start_strip; strip <= end_strip; strip++, index++) { + pd_strip = strip / num_base_drives; + pd_idx = strip % num_base_drives; + if (strip == start_strip) { + offset_in_strip = bdev_io->u.bdev.offset_blocks & (g_strip_size - 1); + pd_lba = (pd_strip << strip_shift) + offset_in_strip; + if (strip == end_strip) { + pd_blocks = bdev_io->u.bdev.num_blocks; } else { - pd_lba = pd_strip << raid_bdev->strip_size_shift; - pd_blocks = raid_bdev->strip_size; + pd_blocks = g_strip_size - offset_in_strip; } - CU_ASSERT(pd_lba == g_io_output[index].offset_blocks); - CU_ASSERT(pd_blocks == g_io_output[index].num_blocks); - CU_ASSERT(ch_ctx->base_channel[pd_idx] == g_io_output[index].ch); - CU_ASSERT(raid_bdev->base_bdev_info[pd_idx].desc == g_io_output[index].desc); - CU_ASSERT(buf == g_io_output[index].buf); - CU_ASSERT(bdev_io->type == g_io_output[index].iotype); - buf += (pd_blocks << spdk_u32log2(g_block_len)); + } else if (strip == end_strip) { + pd_lba = pd_strip << strip_shift; + pd_blocks = ((bdev_io->u.bdev.offset_blocks + bdev_io->u.bdev.num_blocks - 1) & + (g_strip_size - 1)) + 1; + } else { + pd_lba = pd_strip << raid_bdev->strip_size_shift; + pd_blocks = raid_bdev->strip_size; } - } else { - CU_ASSERT(g_io_output_index == 1); - CU_ASSERT(bdev_io->u.bdev.offset_blocks == g_io_output[0].offset_blocks); - CU_ASSERT(bdev_io->u.bdev.num_blocks == g_io_output[0].num_blocks); - CU_ASSERT(ch_ctx->base_channel[0] == g_io_output[0].ch); - CU_ASSERT(raid_bdev->base_bdev_info[0].desc == g_io_output[0].desc); + CU_ASSERT(pd_lba == g_io_output[index].offset_blocks); + CU_ASSERT(pd_blocks == g_io_output[index].num_blocks); + CU_ASSERT(ch_ctx->base_channel[pd_idx] == g_io_output[index].ch); + CU_ASSERT(raid_bdev->base_bdev_info[pd_idx].desc == g_io_output[index].desc); CU_ASSERT(buf == g_io_output[index].buf); + CU_ASSERT(bdev_io->type == g_io_output[index].iotype); + buf += (pd_blocks << spdk_u32log2(g_block_len)); } CU_ASSERT(g_io_comp_status == io_status); }