ut/lvol: add callbacks and asserts for blob_io_* functions

The UT stubs weren't calling the assigned callbacks
and some weren't assering the passed values.

This will come in handy in next patch.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I86eec58a28e40a93ff06b7e7c715c17d25e28818
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1970
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Tomasz Zawadzki 2020-04-22 06:21:49 -04:00
parent 55fe098f9d
commit 3a574c3c13

View File

@ -486,6 +486,11 @@ spdk_blob_io_read(struct spdk_blob *blob, struct spdk_io_channel *channel,
void *payload, uint64_t offset, uint64_t length, void *payload, uint64_t offset, uint64_t length,
spdk_blob_op_complete cb_fn, void *cb_arg) spdk_blob_op_complete cb_fn, void *cb_arg)
{ {
CU_ASSERT(blob == NULL);
CU_ASSERT(channel == g_ch);
CU_ASSERT(offset == g_io->u.bdev.offset_blocks);
CU_ASSERT(length == g_io->u.bdev.num_blocks);
cb_fn(cb_arg, 0);
} }
void void
@ -493,6 +498,11 @@ spdk_blob_io_write(struct spdk_blob *blob, struct spdk_io_channel *channel,
void *payload, uint64_t offset, uint64_t length, void *payload, uint64_t offset, uint64_t length,
spdk_blob_op_complete cb_fn, void *cb_arg) spdk_blob_op_complete cb_fn, void *cb_arg)
{ {
CU_ASSERT(blob == NULL);
CU_ASSERT(channel == g_ch);
CU_ASSERT(offset == g_io->u.bdev.offset_blocks);
CU_ASSERT(length == g_io->u.bdev.num_blocks);
cb_fn(cb_arg, 0);
} }
void void
@ -503,6 +513,7 @@ spdk_blob_io_unmap(struct spdk_blob *blob, struct spdk_io_channel *channel,
CU_ASSERT(channel == g_ch); CU_ASSERT(channel == g_ch);
CU_ASSERT(offset == g_io->u.bdev.offset_blocks); CU_ASSERT(offset == g_io->u.bdev.offset_blocks);
CU_ASSERT(length == g_io->u.bdev.num_blocks); CU_ASSERT(length == g_io->u.bdev.num_blocks);
cb_fn(cb_arg, 0);
} }
void void
@ -513,6 +524,7 @@ spdk_blob_io_write_zeroes(struct spdk_blob *blob, struct spdk_io_channel *channe
CU_ASSERT(channel == g_ch); CU_ASSERT(channel == g_ch);
CU_ASSERT(offset == g_io->u.bdev.offset_blocks); CU_ASSERT(offset == g_io->u.bdev.offset_blocks);
CU_ASSERT(length == g_io->u.bdev.num_blocks); CU_ASSERT(length == g_io->u.bdev.num_blocks);
cb_fn(cb_arg, 0);
} }
void void
@ -524,6 +536,7 @@ spdk_blob_io_writev(struct spdk_blob *blob, struct spdk_io_channel *channel,
CU_ASSERT(channel == g_ch); CU_ASSERT(channel == g_ch);
CU_ASSERT(offset == g_io->u.bdev.offset_blocks); CU_ASSERT(offset == g_io->u.bdev.offset_blocks);
CU_ASSERT(length == g_io->u.bdev.num_blocks); CU_ASSERT(length == g_io->u.bdev.num_blocks);
cb_fn(cb_arg, 0);
} }
void void
@ -535,6 +548,7 @@ spdk_blob_io_readv(struct spdk_blob *blob, struct spdk_io_channel *channel,
CU_ASSERT(channel == g_ch); CU_ASSERT(channel == g_ch);
CU_ASSERT(offset == g_io->u.bdev.offset_blocks); CU_ASSERT(offset == g_io->u.bdev.offset_blocks);
CU_ASSERT(length == g_io->u.bdev.num_blocks); CU_ASSERT(length == g_io->u.bdev.num_blocks);
cb_fn(cb_arg, 0);
} }
void void