From 144ba3a1cb1b8dc79da6c1e5488bdb6b343ed8e2 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Fri, 23 Jun 2017 17:05:41 -0700 Subject: [PATCH] test: move iSCSI unit tests to test/unit Change-Id: Ibe282aa67de22e062de9d88c3b157c766be9dfae Signed-off-by: Daniel Verkamp Reviewed-on: https://review.gerrithub.io/366910 Tested-by: SPDK Automated Test System Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- test/lib/Makefile | 2 +- test/lib/iscsi/pdu/.gitignore | 1 - test/lib/iscsi/target_node/.gitignore | 1 - test/unit/lib/Makefile | 2 +- test/{ => unit}/lib/iscsi/Makefile | 4 ++-- test/{ => unit}/lib/iscsi/common.c | 0 test/unit/lib/iscsi/iscsi.c/.gitignore | 1 + test/{lib/iscsi/pdu => unit/lib/iscsi/iscsi.c}/Makefile | 8 ++++---- .../iscsi/pdu/pdu.c => unit/lib/iscsi/iscsi.c/iscsi_ut.c} | 2 ++ .../iscsi/param => unit/lib/iscsi/param.c}/.gitignore | 0 test/{lib/iscsi/param => unit/lib/iscsi/param.c}/Makefile | 2 +- .../iscsi/param => unit/lib/iscsi/param.c}/param_ut.c | 0 test/unit/lib/iscsi/tgt_node.c/.gitignore | 1 + .../target_node => unit/lib/iscsi/tgt_node.c}/Makefile | 6 +++--- .../lib/iscsi/tgt_node.c/tgt_node.conf} | 0 .../lib/iscsi/tgt_node.c/tgt_node_ut.c} | 0 unittest.sh | 6 +++--- 17 files changed, 19 insertions(+), 17 deletions(-) delete mode 100644 test/lib/iscsi/pdu/.gitignore delete mode 100644 test/lib/iscsi/target_node/.gitignore rename test/{ => unit}/lib/iscsi/Makefile (95%) rename test/{ => unit}/lib/iscsi/common.c (100%) create mode 100644 test/unit/lib/iscsi/iscsi.c/.gitignore rename test/{lib/iscsi/pdu => unit/lib/iscsi/iscsi.c}/Makefile (94%) rename test/{lib/iscsi/pdu/pdu.c => unit/lib/iscsi/iscsi.c/iscsi_ut.c} (99%) rename test/{lib/iscsi/param => unit/lib/iscsi/param.c}/.gitignore (100%) rename test/{lib/iscsi/param => unit/lib/iscsi/param.c}/Makefile (97%) rename test/{lib/iscsi/param => unit/lib/iscsi/param.c}/param_ut.c (100%) create mode 100644 test/unit/lib/iscsi/tgt_node.c/.gitignore rename test/{lib/iscsi/target_node => unit/lib/iscsi/tgt_node.c}/Makefile (95%) rename test/{lib/iscsi/target_node/target_node.conf => unit/lib/iscsi/tgt_node.c/tgt_node.conf} (100%) rename test/{lib/iscsi/target_node/target_node_ut.c => unit/lib/iscsi/tgt_node.c/tgt_node_ut.c} (100%) diff --git a/test/lib/Makefile b/test/lib/Makefile index 067a87d90c..7453b2d444 100644 --- a/test/lib/Makefile +++ b/test/lib/Makefile @@ -34,7 +34,7 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..) include $(SPDK_ROOT_DIR)/mk/spdk.common.mk -DIRS-y = bdev blobfs env event iscsi json nvme +DIRS-y = bdev blobfs env event json nvme .PHONY: all clean $(DIRS-y) diff --git a/test/lib/iscsi/pdu/.gitignore b/test/lib/iscsi/pdu/.gitignore deleted file mode 100644 index 2c20f776de..0000000000 --- a/test/lib/iscsi/pdu/.gitignore +++ /dev/null @@ -1 +0,0 @@ -pdu diff --git a/test/lib/iscsi/target_node/.gitignore b/test/lib/iscsi/target_node/.gitignore deleted file mode 100644 index 5d8df1ff34..0000000000 --- a/test/lib/iscsi/target_node/.gitignore +++ /dev/null @@ -1 +0,0 @@ -target_node_ut diff --git a/test/unit/lib/Makefile b/test/unit/lib/Makefile index 78c4143a72..c702d076ee 100644 --- a/test/unit/lib/Makefile +++ b/test/unit/lib/Makefile @@ -34,7 +34,7 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..) include $(SPDK_ROOT_DIR)/mk/spdk.common.mk -DIRS-y = bdev blob ioat json jsonrpc log nvme nvmf scsi util +DIRS-y = bdev blob ioat iscsi json jsonrpc log nvme nvmf scsi util .PHONY: all clean $(DIRS-y) diff --git a/test/lib/iscsi/Makefile b/test/unit/lib/iscsi/Makefile similarity index 95% rename from test/lib/iscsi/Makefile rename to test/unit/lib/iscsi/Makefile index 7c1de1c501..a318538980 100644 --- a/test/lib/iscsi/Makefile +++ b/test/unit/lib/iscsi/Makefile @@ -31,10 +31,10 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..) +SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../..) include $(SPDK_ROOT_DIR)/mk/spdk.common.mk -DIRS-y = param pdu target_node +DIRS-y = iscsi.c param.c tgt_node.c .PHONY: all clean $(DIRS-y) diff --git a/test/lib/iscsi/common.c b/test/unit/lib/iscsi/common.c similarity index 100% rename from test/lib/iscsi/common.c rename to test/unit/lib/iscsi/common.c diff --git a/test/unit/lib/iscsi/iscsi.c/.gitignore b/test/unit/lib/iscsi/iscsi.c/.gitignore new file mode 100644 index 0000000000..4d41887c8d --- /dev/null +++ b/test/unit/lib/iscsi/iscsi.c/.gitignore @@ -0,0 +1 @@ +iscsi_ut diff --git a/test/lib/iscsi/pdu/Makefile b/test/unit/lib/iscsi/iscsi.c/Makefile similarity index 94% rename from test/lib/iscsi/pdu/Makefile rename to test/unit/lib/iscsi/iscsi.c/Makefile index c0d28eaa4a..a5a625d0c0 100644 --- a/test/lib/iscsi/pdu/Makefile +++ b/test/unit/lib/iscsi/iscsi.c/Makefile @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../..) +SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../../..) include $(SPDK_ROOT_DIR)/mk/spdk.common.mk include $(SPDK_ROOT_DIR)/mk/spdk.app.mk @@ -43,12 +43,12 @@ CFLAGS += -I$(SPDK_ROOT_DIR)/lib LIBS += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS) LIBS += -lcunit -lcrypto SCSI_OBJS = port -ISCSI_OBJS = iscsi crc32c md5 param +ISCSI_OBJS = crc32c md5 param OBJS += $(SCSI_OBJS:%=$(SPDK_ROOT_DIR)/lib/scsi/%.o) OBJS += $(ISCSI_OBJS:%=$(SPDK_ROOT_DIR)/lib/iscsi/%.o) -APP = pdu -C_SRCS = pdu.c +APP = iscsi_ut +C_SRCS = iscsi_ut.c all: $(APP) diff --git a/test/lib/iscsi/pdu/pdu.c b/test/unit/lib/iscsi/iscsi.c/iscsi_ut.c similarity index 99% rename from test/lib/iscsi/pdu/pdu.c rename to test/unit/lib/iscsi/iscsi.c/iscsi_ut.c index 158c10b994..c1bc0223a6 100644 --- a/test/lib/iscsi/pdu/pdu.c +++ b/test/unit/lib/iscsi/iscsi.c/iscsi_ut.c @@ -38,6 +38,8 @@ #include "CUnit/Basic.h" +#include "iscsi/iscsi.c" + #include "../common.c" #include "iscsi/acceptor.h" #include "iscsi/portal_grp.h" diff --git a/test/lib/iscsi/param/.gitignore b/test/unit/lib/iscsi/param.c/.gitignore similarity index 100% rename from test/lib/iscsi/param/.gitignore rename to test/unit/lib/iscsi/param.c/.gitignore diff --git a/test/lib/iscsi/param/Makefile b/test/unit/lib/iscsi/param.c/Makefile similarity index 97% rename from test/lib/iscsi/param/Makefile rename to test/unit/lib/iscsi/param.c/Makefile index 434a057116..b1840ed343 100644 --- a/test/lib/iscsi/param/Makefile +++ b/test/unit/lib/iscsi/param.c/Makefile @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../..) +SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../../..) include $(SPDK_ROOT_DIR)/mk/spdk.common.mk include $(SPDK_ROOT_DIR)/mk/spdk.app.mk diff --git a/test/lib/iscsi/param/param_ut.c b/test/unit/lib/iscsi/param.c/param_ut.c similarity index 100% rename from test/lib/iscsi/param/param_ut.c rename to test/unit/lib/iscsi/param.c/param_ut.c diff --git a/test/unit/lib/iscsi/tgt_node.c/.gitignore b/test/unit/lib/iscsi/tgt_node.c/.gitignore new file mode 100644 index 0000000000..010d84b832 --- /dev/null +++ b/test/unit/lib/iscsi/tgt_node.c/.gitignore @@ -0,0 +1 @@ +tgt_node_ut diff --git a/test/lib/iscsi/target_node/Makefile b/test/unit/lib/iscsi/tgt_node.c/Makefile similarity index 95% rename from test/lib/iscsi/target_node/Makefile rename to test/unit/lib/iscsi/tgt_node.c/Makefile index aa3f30d6a0..4222ed50cc 100644 --- a/test/lib/iscsi/target_node/Makefile +++ b/test/unit/lib/iscsi/tgt_node.c/Makefile @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../..) +SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../../..) include $(SPDK_ROOT_DIR)/mk/spdk.common.mk include $(SPDK_ROOT_DIR)/mk/spdk.app.mk @@ -43,8 +43,8 @@ CFLAGS += -I$(SPDK_ROOT_DIR)/lib LIBS += $(SPDK_LIB_LINKER_ARGS) LIBS += -lcunit -APP = target_node_ut -C_SRCS = target_node_ut.c +APP = tgt_node_ut +C_SRCS = tgt_node_ut.c all: $(APP) diff --git a/test/lib/iscsi/target_node/target_node.conf b/test/unit/lib/iscsi/tgt_node.c/tgt_node.conf similarity index 100% rename from test/lib/iscsi/target_node/target_node.conf rename to test/unit/lib/iscsi/tgt_node.c/tgt_node.conf diff --git a/test/lib/iscsi/target_node/target_node_ut.c b/test/unit/lib/iscsi/tgt_node.c/tgt_node_ut.c similarity index 100% rename from test/lib/iscsi/target_node/target_node_ut.c rename to test/unit/lib/iscsi/tgt_node.c/tgt_node_ut.c diff --git a/unittest.sh b/unittest.sh index ed13554def..eb406f0a72 100755 --- a/unittest.sh +++ b/unittest.sh @@ -69,9 +69,9 @@ $valgrind test/unit/lib/scsi/lun.c/lun_ut $valgrind test/unit/lib/scsi/scsi.c/scsi_ut $valgrind test/unit/lib/scsi/scsi_bdev.c/scsi_bdev_ut -$valgrind test/lib/iscsi/param/param_ut -$valgrind test/lib/iscsi/target_node/target_node_ut test/lib/iscsi/target_node/target_node.conf -$valgrind test/lib/iscsi/pdu/pdu +$valgrind test/unit/lib/iscsi/param.c/param_ut +$valgrind test/unit/lib/iscsi/tgt_node.c/tgt_node_ut test/unit/lib/iscsi/tgt_node.c/tgt_node.conf +$valgrind test/unit/lib/iscsi/iscsi.c/iscsi_ut $valgrind test/unit/lib/util/bit_array.c/bit_array_ut $valgrind test/unit/lib/util/io_channel.c/io_channel_ut