unit_test: check for creating the same lun twice
This patch adds new unit test for scsi lun: - creates the same lun twice As noted in code, one assert is incorrectly set to show functionality that is not working currently. Next patch in series implements that functionality and changes that assert in the unit test. Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: Ie1ea6034ba295bc1c24d21529c6adcf20ac10c53
This commit is contained in:
parent
095c690ebd
commit
da48e8390d
@ -607,6 +607,27 @@ lun_construct_success(void)
|
||||
CU_ASSERT_EQUAL(g_task_count, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
lun_construct_same_same_twice(void)
|
||||
{
|
||||
struct spdk_scsi_lun *lun, *lun2;
|
||||
struct spdk_bdev bdev, bdev2;
|
||||
|
||||
lun = spdk_scsi_lun_construct("lun0", &bdev);
|
||||
|
||||
/* Successfully constructs and returns lun */
|
||||
CU_ASSERT(lun != NULL);
|
||||
|
||||
lun2 = spdk_scsi_lun_construct("lun0", &bdev2);
|
||||
|
||||
/* Fails to construct the same lun on another bdev and returns NULL */
|
||||
CU_ASSERT(lun2 != NULL); /* lun2 should be NULL, this shows it is not currently working */
|
||||
|
||||
lun_destruct(lun);
|
||||
|
||||
CU_ASSERT_EQUAL(g_task_count, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
lun_deletable(void)
|
||||
{
|
||||
@ -669,6 +690,7 @@ main(int argc, char **argv)
|
||||
|| CU_add_test(suite, "destruct task - success", lun_destruct_success) == NULL
|
||||
|| CU_add_test(suite, "construct - null ctx", lun_construct_null_ctx) == NULL
|
||||
|| CU_add_test(suite, "construct - success", lun_construct_success) == NULL
|
||||
|| CU_add_test(suite, "construct - same lun twice", lun_construct_same_same_twice) == NULL
|
||||
|| CU_add_test(suite, "deletable", lun_deletable) == NULL
|
||||
) {
|
||||
CU_cleanup_registry();
|
||||
|
Loading…
Reference in New Issue
Block a user