Commit f4b81843 authored by Nick Connolly's avatar Nick Connolly Committed by Tomasz Zawadzki
Browse files

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: default avatarNick Connolly <nick.connolly@mayadata.io>
Change-Id: I0a8606f9ec1743f7ca430f68c90b59f5699155b6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5081


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent a414e7bb
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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",
+4 −0
Original line number Diff line number Diff line
@@ -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)
{