test/unit/lib/scsi: 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: I0a8606f9ec1743f7ca430f68c90b59f5699155b6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5081
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:
Nick Connolly 2020-11-11 14:05:47 +00:00 committed by Tomasz Zawadzki
parent a414e7bbf6
commit f4b818434b
2 changed files with 7 additions and 0 deletions

View File

@ -43,6 +43,9 @@
#include "spdk_internal/mock.h"
DEFINE_STUB(spdk_scsi_lun_is_removing, bool,
(const struct spdk_scsi_lun *lun), false);
static char *g_bdev_names[] = {
"malloc0",
"malloc1",

View File

@ -63,6 +63,10 @@ DEFINE_STUB_V(_spdk_trace_record,
(uint64_t tsc, uint16_t tpoint_id, uint16_t poller_id,
uint32_t size, uint64_t object_id, uint64_t arg1));
DEFINE_STUB(bdev_scsi_get_dif_ctx, bool,
(struct spdk_bdev *bdev, struct spdk_scsi_task *task,
struct spdk_dif_ctx *dif_ctx), false);
static void
spdk_lun_ut_cpl_task(struct spdk_scsi_task *task)
{