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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476517
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
This commit is contained in:
Jim Harris 2019-12-02 12:05:06 -07:00 committed by Tomasz Zawadzki
parent d7b5ca749b
commit eb7e1f7e97
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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,