From fba24e2fdb3edcfe34d376e260771be235c93f43 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Tue, 30 Oct 2018 16:14:27 -0700 Subject: [PATCH] reduce_ut: add test for null backing_dev fn_ptrs Ensure in init_failure() that even after we generate a UUID, the init still fails since the backing_dev function pointers are still NULL. Signed-off-by: Jim Harris Change-Id: I3287da8626152649416b4aaf4285eb9f84f79200 Reviewed-on: https://review.gerrithub.io/433084 Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Changpeng Liu Reviewed-by: Shuhei Matsumoto Tested-by: SPDK CI Jenkins --- test/unit/lib/reduce/reduce.c/reduce_ut.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/unit/lib/reduce/reduce.c/reduce_ut.c b/test/unit/lib/reduce/reduce.c/reduce_ut.c index 9793a579c..235126b90 100644 --- a/test/unit/lib/reduce/reduce.c/reduce_ut.c +++ b/test/unit/lib/reduce/reduce.c/reduce_ut.c @@ -243,6 +243,17 @@ init_failure(void) CU_ASSERT(g_ziperrno == -EINVAL); SPDK_CU_ASSERT_FATAL(g_vol == NULL); + /* uuid is now valid, but backing_dev still has null function pointers. + * This should fail. + */ + spdk_uuid_generate(¶ms.uuid); + + g_vol = NULL; + g_ziperrno = 0; + spdk_reduce_vol_init(¶ms, &backing_dev, &pm_file, init_cb, NULL); + CU_ASSERT(g_ziperrno == -EINVAL); + SPDK_CU_ASSERT_FATAL(g_vol == NULL); + pm_file_close(&pm_file); pm_file_destroy(); }