Commit eb7e1f7e authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

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: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I007290299ab801fbc1b8fd6f633937314d4b1f8c

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476517


Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
parent d7b5ca74
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -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
+8 −0
Original line number Diff line number Diff line
@@ -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,