Commit df00a867 authored by KanKuo's avatar KanKuo Committed by Tomasz Zawadzki
Browse files

UT/bdev/bdev_zone.c:add the test of zone_appendv_with_md



Signed-off-by: default avatarKanKuo <kuox.kan@intel.com>
Change-Id: I8e669ac94a2df2e0e6c204413b30cd04d6f7e685
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15097


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Community-CI: Mellanox Build Bot
parent 91916654
Loading
Loading
Loading
Loading
+25 −5
Original line number Diff line number Diff line
@@ -62,7 +62,6 @@ static uint64_t g_start_lba;
static uint64_t g_unexpected_start_lba;
static uint64_t g_bdev_blocklen;
static uint64_t g_unexpected_bdev_blocklen;
static bool g_append_with_md;
static int g_unexpected_iovcnt;
static void *g_md_buf;
static void *g_unexpected_md_buf;
@@ -83,7 +82,6 @@ test_setup(void)
	g_unexpected_start_lba = 0;
	g_bdev_blocklen = 4096;
	g_unexpected_bdev_blocklen = 0;
	g_append_with_md = false;
	g_unexpected_iovcnt = 1000;
	g_md_buf = (void *)0xEFDCFEDE;
	g_unexpected_md_buf = (void *)0xFECDEFDC;
@@ -385,7 +383,6 @@ test_bdev_zone_append(void)
	DECLARE_VIRTUAL_BDEV_START();

	g_io_type = SPDK_BDEV_IO_TYPE_ZONE_APPEND;
	g_append_with_md = false;

	start_operation();

@@ -410,7 +407,6 @@ test_bdev_zone_append_with_md(void)
	DECLARE_VIRTUAL_BDEV_START();

	g_io_type = SPDK_BDEV_IO_TYPE_ZONE_APPEND;
	g_append_with_md = true;

	start_operation();

@@ -436,7 +432,6 @@ test_bdev_zone_appendv(void)
	DECLARE_VIRTUAL_BDEV_START();

	g_io_type = SPDK_BDEV_IO_TYPE_ZONE_APPEND;
	g_append_with_md = true;

	start_operation();

@@ -455,6 +450,30 @@ test_bdev_zone_appendv(void)
	stop_operation();
}

static void
test_bdev_zone_appendv_with_md(void)
{
	DECLARE_VIRTUAL_BDEV_START();

	g_io_type = SPDK_BDEV_IO_TYPE_ZONE_APPEND;

	start_operation();

	rc = spdk_bdev_zone_appendv_with_md(desc, ch, g_zone_op->bdev.iovs, g_unexpected_iovcnt, g_md_buf,
					    g_start_lba, g_num_blocks, NULL, NULL);

	CU_ASSERT(rc == 0);
	CU_ASSERT(g_bdev_io->internal.desc == desc);
	CU_ASSERT(g_bdev_io->type == SPDK_BDEV_IO_TYPE_ZONE_APPEND);
	CU_ASSERT(g_bdev_io->u.bdev.iovs == g_zone_op->bdev.iovs);
	CU_ASSERT(g_bdev_io->u.bdev.iovcnt == g_unexpected_iovcnt);
	CU_ASSERT(g_bdev_io->u.bdev.md_buf == g_md_buf);
	CU_ASSERT(g_bdev_io->u.bdev.num_blocks == g_num_blocks);
	CU_ASSERT(g_bdev_io->u.bdev.offset_blocks == g_expected_zone_id);

	stop_operation();
}

int
main(int argc, char **argv)
{
@@ -471,6 +490,7 @@ main(int argc, char **argv)
	CU_ADD_TEST(suite, test_bdev_zone_append);
	CU_ADD_TEST(suite, test_bdev_zone_append_with_md);
	CU_ADD_TEST(suite, test_bdev_zone_appendv);
	CU_ADD_TEST(suite, test_bdev_zone_appendv_with_md);
	CU_ADD_TEST(suite, test_bdev_io_get_append_location);

	CU_basic_set_mode(CU_BRM_VERBOSE);