test/unit/lib/nvme: Add unit test stubs
With some build environments (e.g. clang, see #1613) linking fails with unresolved references. This is caused by the inclusion of 'unused code' which is usually discarded by the linker. The 'unused code' contains references to functions that have not been 'stubbed' out. The failure can be seen by removing 'LDFLAGS += -Wl,--gc-sections' in spdk.unittest.mk Resolved by adding stubs for missing references. These are never called so return an arbtrary default value. Part of a set of independent changes which Fixes #1613 Signed-off-by: Nick Connolly <nick.connolly@mayadata.io> Change-Id: I3960ecc572090348c2ccabfc907b7abee89ed97f Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5083 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
parent
f686aa962c
commit
43b185746f
@ -72,6 +72,14 @@ DEFINE_STUB_V(nvme_qpair_abort_reqs, (struct spdk_nvme_qpair *qpair, uint32_t dn
|
||||
DEFINE_STUB(spdk_nvme_poll_group_remove, int, (struct spdk_nvme_poll_group *group,
|
||||
struct spdk_nvme_qpair *qpair), 0);
|
||||
DEFINE_STUB_V(nvme_io_msg_ctrlr_update, (struct spdk_nvme_ctrlr *ctrlr));
|
||||
DEFINE_STUB(nvme_io_msg_process, int, (struct spdk_nvme_ctrlr *ctrlr), 0);
|
||||
DEFINE_STUB(nvme_transport_ctrlr_reserve_cmb, int, (struct spdk_nvme_ctrlr *ctrlr), 0);
|
||||
DEFINE_STUB(spdk_nvme_ctrlr_cmd_security_receive, int, (struct spdk_nvme_ctrlr *ctrlr,
|
||||
uint8_t secp, uint16_t spsp, uint8_t nssf, void *payload,
|
||||
uint32_t payload_size, spdk_nvme_cmd_cb cb_fn, void *cb_arg), 0);
|
||||
DEFINE_STUB(spdk_nvme_ctrlr_cmd_security_send, int, (struct spdk_nvme_ctrlr *ctrlr,
|
||||
uint8_t secp, uint16_t spsp, uint8_t nssf, void *payload,
|
||||
uint32_t payload_size, spdk_nvme_cmd_cb cb_fn, void *cb_arg), 0);
|
||||
|
||||
struct spdk_nvme_ctrlr *nvme_transport_ctrlr_construct(const struct spdk_nvme_transport_id *trid,
|
||||
const struct spdk_nvme_ctrlr_opts *opts,
|
||||
|
@ -36,6 +36,8 @@
|
||||
|
||||
#include "nvme/nvme_ctrlr_cmd.c"
|
||||
|
||||
#include "spdk_internal/mock.h"
|
||||
|
||||
#define CTRLR_CDATA_ELPE 5
|
||||
|
||||
pid_t g_spdk_nvme_pid;
|
||||
@ -68,6 +70,14 @@ uint32_t expected_feature_cdw12 = 1;
|
||||
typedef void (*verify_request_fn_t)(struct nvme_request *req);
|
||||
verify_request_fn_t verify_fn;
|
||||
|
||||
DEFINE_STUB(nvme_transport_qpair_iterate_requests, int,
|
||||
(struct spdk_nvme_qpair *qpair,
|
||||
int (*iter_fn)(struct nvme_request *req, void *arg),
|
||||
void *arg), 0);
|
||||
|
||||
DEFINE_STUB(nvme_qpair_abort_queued_reqs, uint32_t,
|
||||
(struct spdk_nvme_qpair *qpair, void *cmd_cb_arg), 0);
|
||||
|
||||
static void verify_firmware_log_page(struct nvme_request *req)
|
||||
{
|
||||
uint32_t temp_cdw10;
|
||||
|
@ -44,6 +44,44 @@ static struct nvme_driver _g_nvme_driver = {
|
||||
|
||||
static struct nvme_request *g_request = NULL;
|
||||
|
||||
DEFINE_STUB_V(nvme_io_msg_ctrlr_detach, (struct spdk_nvme_ctrlr *ctrlr));
|
||||
|
||||
DEFINE_STUB_V(nvme_ctrlr_destruct_async,
|
||||
(struct spdk_nvme_ctrlr *ctrlr, struct nvme_ctrlr_detach_ctx *ctx));
|
||||
|
||||
DEFINE_STUB(nvme_ctrlr_destruct_poll_async,
|
||||
int,
|
||||
(struct spdk_nvme_ctrlr *ctrlr, struct nvme_ctrlr_detach_ctx *ctx),
|
||||
0);
|
||||
|
||||
DEFINE_STUB(spdk_nvme_poll_group_process_completions,
|
||||
int64_t,
|
||||
(struct spdk_nvme_poll_group *group, uint32_t completions_per_qpair,
|
||||
spdk_nvme_disconnected_qpair_cb disconnected_qpair_cb),
|
||||
0);
|
||||
|
||||
DEFINE_STUB(spdk_nvme_qpair_process_completions,
|
||||
int32_t,
|
||||
(struct spdk_nvme_qpair *qpair, uint32_t max_completions),
|
||||
0);
|
||||
|
||||
DEFINE_STUB(spdk_nvme_ctrlr_get_regs_csts,
|
||||
union spdk_nvme_csts_register,
|
||||
(struct spdk_nvme_ctrlr *ctrlr),
|
||||
{});
|
||||
|
||||
DEFINE_STUB(nvme_uevent_connect, int, (void), 1);
|
||||
|
||||
DEFINE_STUB(nvme_transport_ctrlr_destruct,
|
||||
int,
|
||||
(struct spdk_nvme_ctrlr *ctrlr),
|
||||
0);
|
||||
|
||||
DEFINE_STUB(nvme_ctrlr_get_current_process,
|
||||
struct spdk_nvme_ctrlr_process *,
|
||||
(struct spdk_nvme_ctrlr *ctrlr),
|
||||
(struct spdk_nvme_ctrlr_process *)(uintptr_t)0x1);
|
||||
|
||||
int
|
||||
spdk_pci_enumerate(struct spdk_pci_driver *driver, spdk_pci_enum_cb enum_cb, void *enum_ctx)
|
||||
{
|
||||
|
@ -47,6 +47,47 @@ static struct nvme_driver _g_nvme_driver = {
|
||||
|
||||
static struct nvme_request *g_request = NULL;
|
||||
|
||||
DEFINE_STUB_V(nvme_io_msg_ctrlr_detach, (struct spdk_nvme_ctrlr *ctrlr));
|
||||
|
||||
DEFINE_STUB_V(nvme_ctrlr_destruct_async,
|
||||
(struct spdk_nvme_ctrlr *ctrlr, struct nvme_ctrlr_detach_ctx *ctx));
|
||||
|
||||
DEFINE_STUB(nvme_ctrlr_destruct_poll_async,
|
||||
int,
|
||||
(struct spdk_nvme_ctrlr *ctrlr, struct nvme_ctrlr_detach_ctx *ctx),
|
||||
0);
|
||||
|
||||
DEFINE_STUB(spdk_nvme_poll_group_process_completions,
|
||||
int64_t,
|
||||
(struct spdk_nvme_poll_group *group, uint32_t completions_per_qpair,
|
||||
spdk_nvme_disconnected_qpair_cb disconnected_qpair_cb),
|
||||
0);
|
||||
|
||||
DEFINE_STUB(spdk_nvme_qpair_process_completions,
|
||||
int32_t,
|
||||
(struct spdk_nvme_qpair *qpair, uint32_t max_completions),
|
||||
0);
|
||||
|
||||
DEFINE_STUB(spdk_nvme_ctrlr_get_regs_csts,
|
||||
union spdk_nvme_csts_register,
|
||||
(struct spdk_nvme_ctrlr *ctrlr),
|
||||
{});
|
||||
|
||||
DEFINE_STUB(nvme_uevent_connect, int, (void), 1);
|
||||
|
||||
DEFINE_STUB_V(nvme_ctrlr_fail,
|
||||
(struct spdk_nvme_ctrlr *ctrlr, bool hotremove));
|
||||
|
||||
DEFINE_STUB(nvme_transport_ctrlr_destruct,
|
||||
int,
|
||||
(struct spdk_nvme_ctrlr *ctrlr),
|
||||
0);
|
||||
|
||||
DEFINE_STUB(nvme_ctrlr_get_current_process,
|
||||
struct spdk_nvme_ctrlr_process *,
|
||||
(struct spdk_nvme_ctrlr *ctrlr),
|
||||
(struct spdk_nvme_ctrlr_process *)(uintptr_t)0x1);
|
||||
|
||||
int
|
||||
nvme_qpair_submit_request(struct spdk_nvme_qpair *qpair, struct nvme_request *req)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user