test/io_channel: use SPDK_CU_ASSERT_FATAL for NULL checks

The test can't continue if a NULL pointer would be dereferenced.

Change-Id: If857057c69679de3be08c4605d15bc2b3892210a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-09-27 10:46:24 -07:00
parent a8cfc54e14
commit 93c986865f

View File

@ -112,13 +112,13 @@ channel(void)
g_create_cb_calls = 0; g_create_cb_calls = 0;
ch1 = spdk_get_io_channel(&device1, SPDK_IO_PRIORITY_DEFAULT); ch1 = spdk_get_io_channel(&device1, SPDK_IO_PRIORITY_DEFAULT);
CU_ASSERT(g_create_cb_calls == 1); CU_ASSERT(g_create_cb_calls == 1);
CU_ASSERT(ch1 != NULL); SPDK_CU_ASSERT_FATAL(ch1 != NULL);
g_create_cb_calls = 0; g_create_cb_calls = 0;
ch2 = spdk_get_io_channel(&device1, SPDK_IO_PRIORITY_DEFAULT); ch2 = spdk_get_io_channel(&device1, SPDK_IO_PRIORITY_DEFAULT);
CU_ASSERT(g_create_cb_calls == 0); CU_ASSERT(g_create_cb_calls == 0);
CU_ASSERT(ch1 == ch2); CU_ASSERT(ch1 == ch2);
CU_ASSERT(ch2 != NULL); SPDK_CU_ASSERT_FATAL(ch2 != NULL);
g_destroy_cb_calls = 0; g_destroy_cb_calls = 0;
spdk_put_io_channel(ch2); spdk_put_io_channel(ch2);
@ -128,7 +128,7 @@ channel(void)
ch2 = spdk_get_io_channel(&device2, SPDK_IO_PRIORITY_DEFAULT); ch2 = spdk_get_io_channel(&device2, SPDK_IO_PRIORITY_DEFAULT);
CU_ASSERT(g_create_cb_calls == 1); CU_ASSERT(g_create_cb_calls == 1);
CU_ASSERT(ch1 != ch2); CU_ASSERT(ch1 != ch2);
CU_ASSERT(ch2 != NULL); SPDK_CU_ASSERT_FATAL(ch2 != NULL);
ctx = spdk_io_channel_get_ctx(ch2); ctx = spdk_io_channel_get_ctx(ch2);
CU_ASSERT(*(uint64_t *)ctx == ctx2); CU_ASSERT(*(uint64_t *)ctx == ctx2);