From eb7e1f7e973384e329e6e4b6834872575dea3c6c Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Mon, 2 Dec 2019 12:05:06 -0700 Subject: [PATCH] test/env: don't link env libraries for memory unit tests We don't really need to link the env for these unit tests. We were doing it mostly for convenience. We can easily leave out the env library, and just define a few stubs for the functions that the memory unit tests call. This helps prepare for the next patch that will use rte_malloc/rte_free to allocate mapping structures. By not linking the env libraries, we can just stub rte_malloc/rte_free with simple malloc/free, rather than doing a full env initialization to get rte_malloc/rte_free working. Signed-off-by: Jim Harris Change-Id: I007290299ab801fbc1b8fd6f633937314d4b1f8c Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476517 Reviewed-by: Changpeng Liu Reviewed-by: Shuhei Matsumoto Reviewed-by: Tomasz Zawadzki Tested-by: SPDK CI Jenkins Community-CI: Broadcom SPDK FC-NVMe CI --- test/env/memory/Makefile | 1 - test/env/memory/memory_ut.c | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/test/env/memory/Makefile b/test/env/memory/Makefile index 7662fd8ff..623a81cb9 100644 --- a/test/env/memory/Makefile +++ b/test/env/memory/Makefile @@ -35,7 +35,6 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..) CFLAGS += $(ENV_CFLAGS) CFLAGS += -I$(SPDK_ROOT_DIR)/test/lib -UNIT_TEST_LINK_ENV = 1 TEST_FILE = memory_ut.c include $(SPDK_ROOT_DIR)/mk/spdk.unittest.mk diff --git a/test/env/memory/memory_ut.c b/test/env/memory/memory_ut.c index f3559fb72..0f7e036df 100644 --- a/test/env/memory/memory_ut.c +++ b/test/env/memory/memory_ut.c @@ -44,6 +44,14 @@ static struct spdk_bit_array *g_page_array; static void *g_vaddr_to_fail = (void *)UINT64_MAX; +DEFINE_STUB(rte_memseg_contig_walk, int, (rte_memseg_contig_walk_t func, void *arg), 0); +DEFINE_STUB(rte_mem_virt2memseg, struct rte_memseg *, + (const void *virt, const struct rte_memseg_list *msl), NULL); +DEFINE_STUB(spdk_env_dpdk_external_init, bool, (void), true); +DEFINE_STUB(rte_mem_event_callback_register, int, + (const char *name, rte_mem_event_callback_t clb, void *arg), 0); +DEFINE_STUB(rte_mem_virt2iova, rte_iova_t, (const void *virtaddr), 0); + static int test_mem_map_notify(void *cb_ctx, struct spdk_mem_map *map, enum spdk_mem_map_notify_action action,