test/log: verify that log facility is not NULL

Make the static analyzer happy.

Change-Id: I431b98af167d268f7e91c1f6d507c2c19d10ae25
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2017-01-18 10:58:38 -07:00
parent b23409854c
commit c2721e8ebe
2 changed files with 4 additions and 1 deletions

View File

@ -37,6 +37,7 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
APP = log_ut APP = log_ut
C_SRCS := log_ut.c C_SRCS := log_ut.c
CFLAGS += -I$(SPDK_ROOT_DIR)/test
CFLAGS += -I$(SPDK_ROOT_DIR)/lib/log CFLAGS += -I$(SPDK_ROOT_DIR)/lib/log
LIBS += $(SPDK_LIBS) -lcunit LIBS += $(SPDK_LIBS) -lcunit

View File

@ -36,7 +36,7 @@
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include "CUnit/Basic.h" #include "spdk_cunit.h"
#include "spdk/log.h" #include "spdk/log.h"
#include "log.c" #include "log.c"
@ -56,9 +56,11 @@ log_test(void)
spdk_g_log_facility = -1; spdk_g_log_facility = -1;
buf = spdk_get_log_facility(); buf = spdk_get_log_facility();
SPDK_CU_ASSERT_FATAL(buf != NULL);
CU_ASSERT_STRING_EQUAL(buf, "daemon"); CU_ASSERT_STRING_EQUAL(buf, "daemon");
spdk_g_log_facility = LOG_LOCAL7; spdk_g_log_facility = LOG_LOCAL7;
buf = spdk_get_log_facility(); buf = spdk_get_log_facility();
SPDK_CU_ASSERT_FATAL(buf != NULL);
CU_ASSERT_STRING_EQUAL(buf, "local7"); CU_ASSERT_STRING_EQUAL(buf, "local7");
rc = spdk_set_log_priority("test"); rc = spdk_set_log_priority("test");