Commit 37100484 authored by Seth Howell's avatar Seth Howell Committed by Tomasz Zawadzki
Browse files

test: add a test_name param to run_test



This will allow us to use timing_enter and timing_exit directly
inside the run_test function. That function already lends itself well to
nesting the way we do our timing.

This patch series is aimed at combining the timing_*, run_test, and
report_test_completions calls all into a single place. This will greatly
reduce the number of lines of code in our bash scripts devoted to
tracking timing, formatting, and test completion. It will also enable us
to expand on the reporting of test completions. Further down the line,
this will also allow us to unify test case documentation.

Change-Id: I8e1f4bcea86b2c3b88cc6e42339c57dfce4d58f2
Signed-off-by: default avatarSeth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476799


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarKarol Latecki <karol.latecki@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent e6ee1990
Loading
Loading
Loading
Loading
+41 −42
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ fi

if [ $SPDK_TEST_UNITTEST -eq 1 ]; then
	timing_enter unittest
	run_test suite ./test/unit/unittest.sh
	run_test suite "unittest" ./test/unit/unittest.sh
	report_test_completion "unittest"
	timing_exit unittest
fi
@@ -154,121 +154,120 @@ fi
if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
	timing_enter lib

	run_test suite test/env/env.sh
	run_test suite test/rpc_client/rpc_client.sh
	run_test suite ./test/json_config/json_config.sh
	run_test suite test/json_config/alias_rpc/alias_rpc.sh
	run_test suite test/spdkcli/tcp.sh
	run_test suite "env" test/env/env.sh
	run_test suite "rpc_client" test/rpc_client/rpc_client.sh
	run_test suite "json_config" ./test/json_config/json_config.sh
	run_test suite "alias_rpc" test/json_config/alias_rpc/alias_rpc.sh
	run_test suite "spdkcli_tcp" test/spdkcli/tcp.sh

	if [ $SPDK_TEST_BLOCKDEV -eq 1 ]; then
		run_test suite test/bdev/blockdev.sh
		run_test suite test/bdev/bdev_raid.sh
		run_test suite "blockdev" test/bdev/blockdev.sh
		run_test suite "bdev_raid" test/bdev/bdev_raid.sh
	fi

	if [ $SPDK_TEST_JSON -eq 1 ]; then
		run_test suite test/config_converter/test_converter.sh
		run_test suite "test_converter" test/config_converter/test_converter.sh
	fi

	if [ $SPDK_TEST_EVENT -eq 1 ]; then
		run_test suite test/event/event.sh
		run_test suite "event" test/event/event.sh
	fi

	if [ $SPDK_TEST_NVME -eq 1 ]; then
		run_test suite test/nvme/nvme.sh
		run_test suite "nvme" test/nvme/nvme.sh
		if [[ $SPDK_TEST_NVME_CLI -eq 1 ]]; then
			run_test suite test/nvme/spdk_nvme_cli.sh
			run_test suite "nvme_cli" test/nvme/spdk_nvme_cli.sh
		fi
		if [[ $SPDK_TEST_NVME_CUSE -eq 1 ]]; then
			run_test suite test/nvme/spdk_nvme_cli_cuse.sh
			run_test suite "nvme_cli_cuse" test/nvme/spdk_nvme_cli_cuse.sh
		fi
		# Only test hotplug without ASAN enabled. Since if it is
		# enabled, it catches SEGV earlier than our handler which
		# breaks the hotplug logic.
		if [ $SPDK_RUN_ASAN -eq 0 ]; then
			run_test suite test/nvme/hotplug.sh intel
			run_test suite "nvme_hotplug" test/nvme/hotplug.sh intel
		fi
	fi

	if [ $SPDK_TEST_IOAT -eq 1 ]; then
		run_test suite test/ioat/ioat.sh
		run_test suite "ioat" test/ioat/ioat.sh
	fi

	timing_exit lib

	if [ $SPDK_TEST_ISCSI -eq 1 ]; then
		run_test suite ./test/iscsi_tgt/iscsi_tgt.sh posix
		run_test suite ./test/spdkcli/iscsi.sh
		run_test suite "iscsi_tgt_posix" ./test/iscsi_tgt/iscsi_tgt.sh posix
		run_test suite "spdkcli_iscsi" ./test/spdkcli/iscsi.sh

		# Run raid spdkcli test under iSCSI since blockdev tests run on systems that can't run spdkcli yet
		run_test suite test/spdkcli/raid.sh
		run_test suite "spdkcli_raid" test/spdkcli/raid.sh
	fi

	if [ $SPDK_TEST_VPP -eq 1 ]; then
		run_test suite ./test/iscsi_tgt/iscsi_tgt.sh vpp
		run_test suite "iscsi_tgt_vpp" ./test/iscsi_tgt/iscsi_tgt.sh vpp
	fi

	if [ $SPDK_TEST_BLOBFS -eq 1 ]; then
		run_test suite ./test/blobfs/rocksdb/rocksdb.sh
		run_test suite ./test/blobstore/blobstore.sh
		run_test suite ./test/blobfs/blobfs.sh
		run_test suite "rocksdb" ./test/blobfs/rocksdb/rocksdb.sh
		run_test suite "blobstore" ./test/blobstore/blobstore.sh
		run_test suite "blobfs" ./test/blobfs/blobfs.sh
	fi

	if [ $SPDK_TEST_NVMF -eq 1 ]; then
		run_test suite ./test/nvmf/nvmf.sh --transport=$SPDK_TEST_NVMF_TRANSPORT
		run_test suite ./test/spdkcli/nvmf.sh
		run_test suite "nvmf" ./test/nvmf/nvmf.sh --transport=$SPDK_TEST_NVMF_TRANSPORT
		run_test suite "spdkcli_nvmf" ./test/spdkcli/nvmf.sh
	fi

	if [ $SPDK_TEST_VHOST -eq 1 ]; then
		run_test suite ./test/vhost/vhost.sh
		report_test_completion "vhost"
		run_test suite "vhost" ./test/vhost/vhost.sh
	fi

	if [ $SPDK_TEST_LVOL -eq 1 ]; then
		timing_enter lvol
		run_test suite ./test/lvol/lvol.sh --test-cases=all
		run_test suite ./test/lvol/lvol2.sh
		run_test suite ./test/blobstore/blob_io_wait/blob_io_wait.sh
		run_test suite "lvol" ./test/lvol/lvol.sh --test-cases=all
		run_test suite "lvol2" ./test/lvol/lvol2.sh
		run_test suite "blob_io_wait" ./test/blobstore/blob_io_wait/blob_io_wait.sh
		report_test_completion "lvol"
		timing_exit lvol
	fi

	if [ $SPDK_TEST_VHOST_INIT -eq 1 ]; then
		timing_enter vhost_initiator
		run_test suite ./test/vhost/initiator/blockdev.sh
		run_test suite ./test/spdkcli/virtio.sh
		run_test suite ./test/vhost/shared/shared.sh
		run_test suite ./test/vhost/fuzz/fuzz.sh
		report_test_completion "vhost_initiator"
		run_test suite "vhost_blockdev" ./test/vhost/initiator/blockdev.sh
		run_test suite "spdkcli_virtio" ./test/spdkcli/virtio.sh
		run_test suite "vhost_shared" ./test/vhost/shared/shared.sh
		run_test suite "vhost_fuzz" ./test/vhost/fuzz/fuzz.sh
		report_test_completion "vhost initiator"
		timing_exit vhost_initiator
	fi

	if [ $SPDK_TEST_PMDK -eq 1 ]; then
		run_test suite ./test/pmem/pmem.sh -x
		run_test suite ./test/spdkcli/pmem.sh
		run_test suite "pmem" ./test/pmem/pmem.sh -x
		run_test suite "spdkcli_pmem" ./test/spdkcli/pmem.sh
	fi

	if [ $SPDK_TEST_RBD -eq 1 ]; then
		run_test suite ./test/spdkcli/rbd.sh
		run_test suite "spdkcli_rbd" ./test/spdkcli/rbd.sh
	fi

	if [ $SPDK_TEST_OCF -eq 1 ]; then
		run_test suite ./test/ocf/ocf.sh
		run_test suite "ocf" ./test/ocf/ocf.sh
	fi

	if [ $SPDK_TEST_FTL -eq 1 ]; then
		run_test suite ./test/ftl/ftl.sh
		run_test suite "ftl" ./test/ftl/ftl.sh
	fi

	if [ $SPDK_TEST_VMD -eq 1 ]; then
		run_test suite ./test/vmd/vmd.sh
		run_test suite "vmd" ./test/vmd/vmd.sh
	fi

        if [ $SPDK_TEST_REDUCE -eq 1 ]; then
                run_test suite ./test/compress/compress.sh
                run_test suite "compress" ./test/compress/compress.sh
        fi

	if [ $SPDK_TEST_OPAL -eq 1 ]; then
		run_test suite ./test/nvme/nvme_opal.sh
		run_test suite "nvme_opal" ./test/nvme/nvme_opal.sh
	fi
fi

+2 −0
Original line number Diff line number Diff line
@@ -567,6 +567,8 @@ function run_test() {
	local test_type
	test_type="$(echo $1 | tr '[:lower:]' '[:upper:]')"
	shift
	local test_name="$1"
	shift
	echo "************************************"
	echo "START TEST $test_type $*"
	echo "************************************"
+7 −7
Original line number Diff line number Diff line
@@ -48,30 +48,30 @@ fi
timing_enter ftl
timing_enter bdevperf

run_test suite $testdir/bdevperf.sh $device
run_test suite "ftl_bdevperf" $testdir/bdevperf.sh $device

timing_exit bdevperf

timing_enter restore
run_test suite $testdir/restore.sh $device
run_test suite "ftl_restore" $testdir/restore.sh $device
if [ -n "$nv_cache" ]; then
	run_test suite $testdir/restore.sh -c $nv_cache $device
	run_test suite "ftl_restore_nv_cache" $testdir/restore.sh -c $nv_cache $device
fi
timing_exit restore

if [ -n "$nv_cache" ]; then
	timing_enter dirty_shutdown
	run_test suite $testdir/dirty_shutdown.sh -c $nv_cache $device
	run_test suite "ftl_dirty_shutdown" $testdir/dirty_shutdown.sh -c $nv_cache $device
	timing_exit dirty_shutdown
fi

timing_enter json
run_test suite $testdir/json.sh $device
run_test suite "ftl_json" $testdir/json.sh $device
timing_exit json

if [ $SPDK_TEST_FTL_EXTENDED -eq 1 ]; then
	timing_enter fio_basic
	run_test suite $testdir/fio.sh $device basic
	run_test suite "ftl_fio_basic" $testdir/fio.sh $device basic
	timing_exit fio_basic

	$rootdir/app/spdk_tgt/spdk_tgt &
@@ -86,7 +86,7 @@ if [ $SPDK_TEST_FTL_EXTENDED -eq 1 ]; then
	trap - SIGINT SIGTERM EXIT

	timing_enter fio_extended
	run_test suite $testdir/fio.sh $device extended $uuid
	run_test suite "ftl_fio_extended" $testdir/fio.sh $device extended $uuid
	timing_exit fio_extended
fi

+18 −18
Original line number Diff line number Diff line
@@ -24,39 +24,39 @@ create_veth_interfaces $TEST_TYPE

trap 'cleanup_veth_interfaces $TEST_TYPE; exit 1' SIGINT SIGTERM EXIT

run_test suite ./test/iscsi_tgt/sock/sock.sh $TEST_TYPE
run_test suite "iscsi_tgt_sock" ./test/iscsi_tgt/sock/sock.sh $TEST_TYPE
if [ "$TEST_TYPE" == "posix" ]; then
	# calsoft doesn't handle TCP stream properly and fails decoding iSCSI
	# requests when are divided by TCP segmentation. This is very common
	# situation for VPP and causes that calsoft.sh never PASS.
	run_test suite ./test/iscsi_tgt/calsoft/calsoft.sh
	run_test suite "iscsi_tgt_calsoft" ./test/iscsi_tgt/calsoft/calsoft.sh
fi
run_test suite ./test/iscsi_tgt/filesystem/filesystem.sh
run_test suite ./test/iscsi_tgt/reset/reset.sh
run_test suite ./test/iscsi_tgt/rpc_config/rpc_config.sh $TEST_TYPE
run_test suite ./test/iscsi_tgt/lvol/iscsi_lvol.sh
run_test suite ./test/iscsi_tgt/fio/fio.sh
run_test suite ./test/iscsi_tgt/qos/qos.sh
run_test suite "iscsi_tgt_filesystem" ./test/iscsi_tgt/filesystem/filesystem.sh
run_test suite "iscsi_tgt_reset" ./test/iscsi_tgt/reset/reset.sh
run_test suite "iscsi_tgt_rpc_config" ./test/iscsi_tgt/rpc_config/rpc_config.sh $TEST_TYPE
run_test suite "iscsi_tgt_iscsi_lvol" ./test/iscsi_tgt/lvol/iscsi_lvol.sh
run_test suite "iscsi_tgt_fio" ./test/iscsi_tgt/fio/fio.sh
run_test suite "iscsi_tgt_qos" ./test/iscsi_tgt/qos/qos.sh

# IP Migration tests do not support network namespaces,
# they can only be run on posix sockets.
if [ "$TEST_TYPE" == "posix" ]; then
	run_test suite ./test/iscsi_tgt/ip_migration/ip_migration.sh
	run_test suite "iscsi_tgt_ip_migration" ./test/iscsi_tgt/ip_migration/ip_migration.sh
fi
run_test suite ./test/iscsi_tgt/trace_record/trace_record.sh
run_test suite "iscsi_tgt_trace_record" ./test/iscsi_tgt/trace_record/trace_record.sh

if [ $RUN_NIGHTLY -eq 1 ]; then
	if [ $SPDK_TEST_PMDK -eq 1 ]; then
		run_test suite ./test/iscsi_tgt/pmem/iscsi_pmem.sh 4096 10
		run_test suite "iscsi_tgt_pmem" ./test/iscsi_tgt/pmem/iscsi_pmem.sh 4096 10
	fi
	run_test suite ./test/iscsi_tgt/ext4test/ext4test.sh
	run_test suite ./test/iscsi_tgt/digests/digests.sh
	run_test suite "iscsi_tgt_ext4test" ./test/iscsi_tgt/ext4test/ext4test.sh
	run_test suite "iscsi_tgt_digests" ./test/iscsi_tgt/digests/digests.sh
fi
if [ $SPDK_TEST_RBD -eq 1 ]; then
	# RBD tests do not support network namespaces,
	# they can only be run on posix sockets.
	if [ "$TEST_TYPE" == "posix" ]; then
		run_test suite ./test/iscsi_tgt/rbd/rbd.sh
		run_test suite "iscsi_tgt_rbd" ./test/iscsi_tgt/rbd/rbd.sh
	fi
fi

@@ -67,17 +67,17 @@ if [ $SPDK_TEST_NVMF -eq 1 ]; then
	# they can only be run on posix sockets.
	if [ "$TEST_TYPE" == "posix" ]; then
		# Test configure remote NVMe device from rpc and conf file
		run_test suite ./test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh
		run_test suite "iscsi_tgt_fio_remote_nvme" ./test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh
	fi
fi

if [ $RUN_NIGHTLY -eq 1 ]; then
	run_test suite ./test/iscsi_tgt/multiconnection/multiconnection.sh
	run_test suite "iscsi_tgt_multiconnection" ./test/iscsi_tgt/multiconnection/multiconnection.sh
fi

if [ $SPDK_TEST_ISCSI_INITIATOR -eq 1 ]; then
	run_test suite ./test/iscsi_tgt/initiator/initiator.sh
	run_test suite ./test/iscsi_tgt/bdev_io_wait/bdev_io_wait.sh
	run_test suite "iscsi_tgt_initiator" ./test/iscsi_tgt/initiator/initiator.sh
	run_test suite "iscsi_tgt_bdev_io_wait" ./test/iscsi_tgt/bdev_io_wait/bdev_io_wait.sh
fi

cleanup_veth_interfaces $TEST_TYPE
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ function rpc_cmd() {
}

function run_lvol_test() {
	run_test suite "$@"
	run_test suite "$*" "$@"

	leftover_bdevs=$(rpc_cmd bdev_get_bdevs)
	[ "$(jq length <<< "$leftover_bdevs")" == "0" ]
Loading