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 <james.r.harris@intel.com>
Change-Id: I3287da8626152649416b4aaf4285eb9f84f79200

Reviewed-on: https://review.gerrithub.io/433084
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Jim Harris 2018-10-30 16:14:27 -07:00 committed by Changpeng Liu
parent df79ac6891
commit fba24e2fdb

View File

@ -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(&params.uuid);
g_vol = NULL;
g_ziperrno = 0;
spdk_reduce_vol_init(&params, &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();
}