2015-09-21 21:48:40 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
rootdir=$(readlink -f $(dirname $0))
|
2019-02-07 12:22:12 +00:00
|
|
|
|
|
|
|
# In autotest_common.sh all tests are disabled by default.
|
|
|
|
# If the configuration of tests is not provided, no tests will be carried out.
|
2019-05-09 11:22:41 +00:00
|
|
|
if [[ ! -f $1 ]]; then
|
|
|
|
echo "ERROR: SPDK test configuration not specified"
|
2019-02-07 12:22:12 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-05-09 11:22:41 +00:00
|
|
|
source "$1"
|
2018-02-27 22:14:08 +00:00
|
|
|
source "$rootdir/test/common/autotest_common.sh"
|
2016-07-08 21:19:11 +00:00
|
|
|
source "$rootdir/test/nvmf/common.sh"
|
2015-09-21 21:48:40 +00:00
|
|
|
|
|
|
|
if [ $EUID -ne 0 ]; then
|
|
|
|
echo "$0 must be run as root"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-07-06 16:26:13 +00:00
|
|
|
if [ $(uname -s) = Linux ]; then
|
|
|
|
# set core_pattern to a known value to avoid ABRT, systemd-coredump, etc.
|
|
|
|
echo "core" > /proc/sys/kernel/core_pattern
|
2018-11-26 08:04:25 +00:00
|
|
|
|
|
|
|
# make sure nbd (network block device) driver is loaded if it is available
|
|
|
|
# this ensures that when tests need to use nbd, it will be fully initialized
|
|
|
|
modprobe nbd || true
|
2016-07-06 16:26:13 +00:00
|
|
|
fi
|
|
|
|
|
2018-02-28 16:42:12 +00:00
|
|
|
trap "process_core; autotest_cleanup; exit 1" SIGINT SIGTERM EXIT
|
2015-09-25 16:48:11 +00:00
|
|
|
|
2015-09-21 21:48:40 +00:00
|
|
|
timing_enter autotest
|
|
|
|
|
2017-12-18 21:20:41 +00:00
|
|
|
create_test_list
|
|
|
|
|
2015-09-21 21:48:40 +00:00
|
|
|
src=$(readlink -f $(dirname $0))
|
|
|
|
out=$PWD
|
|
|
|
cd $src
|
|
|
|
|
2018-01-05 03:56:49 +00:00
|
|
|
./scripts/setup.sh status
|
|
|
|
|
2018-04-26 23:46:08 +00:00
|
|
|
freebsd_update_contigmem_mod
|
|
|
|
|
2015-10-22 18:26:21 +00:00
|
|
|
if hash lcov; then
|
2017-05-08 20:57:23 +00:00
|
|
|
# setup output dir for unittest.sh
|
|
|
|
export UT_COVERAGE=$out/ut_coverage
|
2015-11-11 20:09:51 +00:00
|
|
|
export LCOV_OPTS="
|
|
|
|
--rc lcov_branch_coverage=1
|
|
|
|
--rc lcov_function_coverage=1
|
|
|
|
--rc genhtml_branch_coverage=1
|
|
|
|
--rc genhtml_function_coverage=1
|
|
|
|
--rc genhtml_legend=1
|
|
|
|
--rc geninfo_all_blocks=1
|
|
|
|
"
|
2016-09-13 17:16:41 +00:00
|
|
|
export LCOV="lcov $LCOV_OPTS --no-external"
|
2018-02-12 15:59:50 +00:00
|
|
|
# Print lcov version to log
|
|
|
|
$LCOV -v
|
2015-10-22 18:26:21 +00:00
|
|
|
# zero out coverage data
|
2017-02-27 19:37:33 +00:00
|
|
|
$LCOV -q -c -i -t "Baseline" -d $src -o cov_base.info
|
2015-10-22 18:26:21 +00:00
|
|
|
fi
|
|
|
|
|
2016-08-15 17:43:53 +00:00
|
|
|
# Make sure the disks are clean (no leftover partition tables)
|
|
|
|
timing_enter cleanup
|
2017-11-09 23:33:29 +00:00
|
|
|
# Remove old domain socket pathname just in case
|
2017-11-22 19:10:29 +00:00
|
|
|
rm -f /var/tmp/spdk*.sock
|
2016-08-15 17:43:53 +00:00
|
|
|
|
2018-11-27 08:43:56 +00:00
|
|
|
# Load the kernel driver
|
|
|
|
./scripts/setup.sh reset
|
|
|
|
|
|
|
|
# Let the kernel discover any filesystems or partitions
|
|
|
|
sleep 10
|
2016-08-15 17:43:53 +00:00
|
|
|
|
2019-02-01 09:26:39 +00:00
|
|
|
if [ $(uname -s) = Linux ]; then
|
|
|
|
# OCSSD devices drivers don't support IO issues by kernel so
|
|
|
|
# detect OCSSD devices and blacklist them (unbind from any driver).
|
|
|
|
# If test scripts want to use this device it needs to do this explicitly.
|
|
|
|
#
|
|
|
|
# If some OCSSD device is bound to other driver than nvme we won't be able to
|
|
|
|
# discover if it is OCSSD or not so load the kernel driver first.
|
|
|
|
|
|
|
|
|
2019-10-08 10:22:47 +00:00
|
|
|
while IFS= read -r -d '' dev
|
|
|
|
do
|
2019-02-01 09:26:39 +00:00
|
|
|
# Send Open Channel 2.0 Geometry opcode "0xe2" - not supported by NVMe device.
|
|
|
|
if nvme admin-passthru $dev --namespace-id=1 --data-len=4096 --opcode=0xe2 --read >/dev/null; then
|
|
|
|
bdf="$(basename $(readlink -e /sys/class/nvme/${dev#/dev/}/device))"
|
|
|
|
echo "INFO: blacklisting OCSSD device: $dev ($bdf)"
|
|
|
|
PCI_BLACKLIST+=" $bdf"
|
2019-02-07 10:35:21 +00:00
|
|
|
OCSSD_PCI_DEVICES+=" $bdf"
|
2019-02-01 09:26:39 +00:00
|
|
|
fi
|
2019-10-08 10:22:47 +00:00
|
|
|
done < <(find /dev -maxdepth 1 -regex '/dev/nvme[0-9]+' -print0)
|
2019-02-01 09:26:39 +00:00
|
|
|
|
2019-02-07 10:35:21 +00:00
|
|
|
export OCSSD_PCI_DEVICES
|
|
|
|
|
2019-02-01 09:26:39 +00:00
|
|
|
# Now, bind blacklisted devices to pci-stub module. This will prevent
|
|
|
|
# automatic grabbing these devices when we add device/vendor ID to
|
|
|
|
# proper driver.
|
|
|
|
if [[ -n "$PCI_BLACKLIST" ]]; then
|
|
|
|
PCI_WHITELIST="$PCI_BLACKLIST" \
|
|
|
|
PCI_BLACKLIST="" \
|
|
|
|
DRIVER_OVERRIDE="pci-stub" \
|
|
|
|
./scripts/setup.sh
|
|
|
|
|
|
|
|
# Export our blacklist so it will take effect during next setup.sh
|
|
|
|
export PCI_BLACKLIST
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-11-27 08:43:56 +00:00
|
|
|
# Delete all leftover lvols and gpt partitions
|
|
|
|
# Matches both /dev/nvmeXnY on Linux and /dev/nvmeXnsY on BSD
|
2019-02-01 09:26:39 +00:00
|
|
|
# Filter out nvme with partitions - the "p*" suffix
|
2018-11-27 08:43:56 +00:00
|
|
|
for dev in $(ls /dev/nvme*n* | grep -v p || true); do
|
|
|
|
dd if=/dev/zero of="$dev" bs=1M count=1
|
|
|
|
done
|
2017-11-01 20:08:50 +00:00
|
|
|
|
2018-11-27 08:43:56 +00:00
|
|
|
sync
|
|
|
|
|
2016-08-15 17:43:53 +00:00
|
|
|
timing_exit cleanup
|
|
|
|
|
2015-09-21 21:48:40 +00:00
|
|
|
# set up huge pages
|
|
|
|
timing_enter afterboot
|
2016-02-19 21:11:08 +00:00
|
|
|
./scripts/setup.sh
|
2016-03-07 22:11:36 +00:00
|
|
|
timing_exit afterboot
|
2015-09-21 21:48:40 +00:00
|
|
|
|
2016-07-08 21:19:11 +00:00
|
|
|
timing_enter nvmf_setup
|
|
|
|
rdma_device_init
|
|
|
|
timing_exit nvmf_setup
|
|
|
|
|
2018-12-05 23:35:02 +00:00
|
|
|
if [[ $SPDK_TEST_CRYPTO -eq 1 || $SPDK_TEST_REDUCE -eq 1 ]]; then
|
2018-10-09 18:26:27 +00:00
|
|
|
if grep -q '#define SPDK_CONFIG_IGB_UIO_DRIVER 1' $rootdir/include/spdk/config.h; then
|
|
|
|
./scripts/qat_setup.sh igb_uio
|
|
|
|
else
|
|
|
|
./scripts/qat_setup.sh
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-10-22 15:12:35 +00:00
|
|
|
# Revert existing OPAL to factory settings that may have been left from earlier failed tests.
|
|
|
|
# This ensures we won't hit any unexpected failures due to NVMe SSDs being locked.
|
2019-11-20 10:48:03 +00:00
|
|
|
# Disable this for now as we don't have opal test running
|
|
|
|
# opal_revert_cleanup
|
2019-10-22 15:12:35 +00:00
|
|
|
|
2015-09-21 21:48:40 +00:00
|
|
|
#####################
|
|
|
|
# Unit Tests
|
|
|
|
#####################
|
|
|
|
|
2017-05-24 16:25:45 +00:00
|
|
|
if [ $SPDK_TEST_UNITTEST -eq 1 ]; then
|
|
|
|
timing_enter unittest
|
2018-03-13 05:57:41 +00:00
|
|
|
run_test suite ./test/unit/unittest.sh
|
2017-12-18 21:20:41 +00:00
|
|
|
report_test_completion "unittest"
|
2017-05-24 16:25:45 +00:00
|
|
|
timing_exit unittest
|
|
|
|
fi
|
2017-01-24 22:47:46 +00:00
|
|
|
|
2015-09-21 21:48:40 +00:00
|
|
|
|
2019-01-28 12:21:57 +00:00
|
|
|
if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
|
|
|
|
timing_enter lib
|
2017-03-08 19:17:32 +00:00
|
|
|
|
2019-01-28 12:21:57 +00:00
|
|
|
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
|
2019-08-19 12:48:34 +00:00
|
|
|
run_test suite test/json_config/alias_rpc/alias_rpc.sh
|
2019-09-09 11:12:24 +00:00
|
|
|
run_test suite test/spdkcli/tcp.sh
|
2018-07-26 01:32:05 +00:00
|
|
|
|
2019-01-28 12:21:57 +00:00
|
|
|
if [ $SPDK_TEST_BLOCKDEV -eq 1 ]; then
|
|
|
|
run_test suite test/bdev/blockdev.sh
|
2019-11-25 09:58:26 +00:00
|
|
|
run_test suite test/bdev/bdev_raid.sh
|
2019-01-28 12:21:57 +00:00
|
|
|
fi
|
2017-03-08 19:17:32 +00:00
|
|
|
|
2019-01-28 12:21:57 +00:00
|
|
|
if [ $SPDK_TEST_JSON -eq 1 ]; then
|
|
|
|
run_test suite test/config_converter/test_converter.sh
|
|
|
|
fi
|
2017-03-08 19:17:32 +00:00
|
|
|
|
2019-01-28 12:21:57 +00:00
|
|
|
if [ $SPDK_TEST_EVENT -eq 1 ]; then
|
|
|
|
run_test suite test/event/event.sh
|
|
|
|
fi
|
2017-03-08 19:17:32 +00:00
|
|
|
|
2019-01-28 12:21:57 +00:00
|
|
|
if [ $SPDK_TEST_NVME -eq 1 ]; then
|
|
|
|
run_test suite test/nvme/nvme.sh
|
2019-10-24 18:11:51 +00:00
|
|
|
if [[ $SPDK_TEST_NVME_CLI -eq 1 ]]; then
|
2019-01-28 12:21:57 +00:00
|
|
|
run_test suite test/nvme/spdk_nvme_cli.sh
|
|
|
|
fi
|
2019-10-24 18:11:51 +00:00
|
|
|
if [[ $SPDK_TEST_NVME_CUSE -eq 1 ]]; then
|
|
|
|
run_test suite test/nvme/spdk_nvme_cli_cuse.sh
|
|
|
|
fi
|
2019-01-28 12:21:57 +00:00
|
|
|
# Only test hotplug without ASAN enabled. Since if it is
|
|
|
|
# enabled, it catches SEGV earlier than our handler which
|
|
|
|
# breaks the hotplug logic.
|
2019-09-19 10:46:21 +00:00
|
|
|
if [ $SPDK_RUN_ASAN -eq 0 ]; then
|
|
|
|
run_test suite test/nvme/hotplug.sh intel
|
|
|
|
fi
|
2019-01-28 12:21:57 +00:00
|
|
|
fi
|
2015-09-21 21:48:40 +00:00
|
|
|
|
2019-01-28 12:21:57 +00:00
|
|
|
if [ $SPDK_TEST_IOAT -eq 1 ]; then
|
|
|
|
run_test suite test/ioat/ioat.sh
|
|
|
|
fi
|
2015-09-21 21:48:40 +00:00
|
|
|
|
2019-01-28 12:21:57 +00:00
|
|
|
timing_exit lib
|
2016-08-03 21:37:16 +00:00
|
|
|
|
2019-01-28 12:21:57 +00:00
|
|
|
if [ $SPDK_TEST_ISCSI -eq 1 ]; then
|
|
|
|
run_test suite ./test/iscsi_tgt/iscsi_tgt.sh posix
|
|
|
|
run_test suite ./test/spdkcli/iscsi.sh
|
2019-04-26 17:30:50 +00:00
|
|
|
|
|
|
|
# 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
|
2019-01-28 12:21:57 +00:00
|
|
|
fi
|
2017-03-22 20:35:00 +00:00
|
|
|
|
2018-06-25 12:44:59 +00:00
|
|
|
if [ $SPDK_TEST_VPP -eq 1 ]; then
|
|
|
|
run_test suite ./test/iscsi_tgt/iscsi_tgt.sh vpp
|
|
|
|
fi
|
|
|
|
|
2019-01-28 12:21:57 +00:00
|
|
|
if [ $SPDK_TEST_BLOBFS -eq 1 ]; then
|
|
|
|
run_test suite ./test/blobfs/rocksdb/rocksdb.sh
|
|
|
|
run_test suite ./test/blobstore/blobstore.sh
|
2019-08-28 08:06:50 +00:00
|
|
|
run_test suite ./test/blobfs/blobfs.sh
|
2019-01-28 12:21:57 +00:00
|
|
|
fi
|
2016-06-07 15:49:44 +00:00
|
|
|
|
2019-01-28 12:21:57 +00:00
|
|
|
if [ $SPDK_TEST_NVMF -eq 1 ]; then
|
2019-07-08 01:19:56 +00:00
|
|
|
run_test suite ./test/nvmf/nvmf.sh --transport=$SPDK_TEST_NVMF_TRANSPORT
|
2019-01-28 12:21:57 +00:00
|
|
|
run_test suite ./test/spdkcli/nvmf.sh
|
|
|
|
fi
|
2017-10-23 15:03:18 +00:00
|
|
|
|
2019-01-28 12:21:57 +00:00
|
|
|
if [ $SPDK_TEST_VHOST -eq 1 ]; then
|
|
|
|
run_test suite ./test/vhost/vhost.sh
|
|
|
|
report_test_completion "vhost"
|
|
|
|
fi
|
2017-03-02 14:12:20 +00:00
|
|
|
|
2019-01-28 12:21:57 +00:00
|
|
|
if [ $SPDK_TEST_LVOL -eq 1 ]; then
|
|
|
|
timing_enter lvol
|
2019-03-06 21:26:59 +00:00
|
|
|
run_test suite ./test/lvol/lvol.sh --test-cases=all
|
2019-01-28 12:21:57 +00:00
|
|
|
run_test suite ./test/blobstore/blob_io_wait/blob_io_wait.sh
|
|
|
|
report_test_completion "lvol"
|
|
|
|
timing_exit lvol
|
|
|
|
fi
|
2017-09-12 13:47:30 +00:00
|
|
|
|
2019-01-28 12:21:57 +00:00
|
|
|
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
|
2019-05-15 22:49:30 +00:00
|
|
|
run_test suite ./test/vhost/fuzz/fuzz.sh
|
2019-01-28 12:21:57 +00:00
|
|
|
report_test_completion "vhost_initiator"
|
|
|
|
timing_exit vhost_initiator
|
|
|
|
fi
|
2017-09-26 13:02:52 +00:00
|
|
|
|
2019-01-28 12:21:57 +00:00
|
|
|
if [ $SPDK_TEST_PMDK -eq 1 ]; then
|
|
|
|
run_test suite ./test/pmem/pmem.sh -x
|
|
|
|
run_test suite ./test/spdkcli/pmem.sh
|
|
|
|
fi
|
2018-07-03 01:37:42 +00:00
|
|
|
|
2019-01-28 12:21:57 +00:00
|
|
|
if [ $SPDK_TEST_RBD -eq 1 ]; then
|
|
|
|
run_test suite ./test/spdkcli/rbd.sh
|
|
|
|
fi
|
2018-11-02 00:00:24 +00:00
|
|
|
|
2019-01-28 12:21:57 +00:00
|
|
|
if [ $SPDK_TEST_OCF -eq 1 ]; then
|
|
|
|
run_test suite ./test/ocf/ocf.sh
|
|
|
|
fi
|
2018-10-29 14:40:34 +00:00
|
|
|
|
2019-09-10 09:47:54 +00:00
|
|
|
if [ $SPDK_TEST_FTL -eq 1 ]; then
|
2019-01-28 12:21:57 +00:00
|
|
|
run_test suite ./test/ftl/ftl.sh
|
|
|
|
fi
|
2019-06-27 14:49:26 +00:00
|
|
|
|
|
|
|
if [ $SPDK_TEST_VMD -eq 1 ]; then
|
|
|
|
run_test suite ./test/vmd/vmd.sh
|
|
|
|
fi
|
2019-08-01 04:27:15 +00:00
|
|
|
|
|
|
|
if [ $SPDK_TEST_REDUCE -eq 1 ]; then
|
|
|
|
run_test suite ./test/compress/compress.sh
|
|
|
|
fi
|
2019-10-22 15:12:35 +00:00
|
|
|
|
|
|
|
if [ $SPDK_TEST_OPAL -eq 1 ]; then
|
|
|
|
run_test suite ./test/nvme/nvme_opal.sh
|
|
|
|
fi
|
2019-01-28 12:21:57 +00:00
|
|
|
fi
|
2018-11-07 13:57:38 +00:00
|
|
|
|
2016-03-07 22:11:36 +00:00
|
|
|
timing_enter cleanup
|
2018-02-28 16:42:12 +00:00
|
|
|
autotest_cleanup
|
2016-03-07 22:11:36 +00:00
|
|
|
timing_exit cleanup
|
2015-09-21 21:48:40 +00:00
|
|
|
|
|
|
|
timing_exit autotest
|
|
|
|
chmod a+r $output_dir/timing.txt
|
|
|
|
|
2015-09-25 16:48:11 +00:00
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
|
2015-09-21 21:48:40 +00:00
|
|
|
# catch any stray core files
|
|
|
|
process_core
|
2015-10-22 18:26:21 +00:00
|
|
|
|
|
|
|
if hash lcov; then
|
|
|
|
# generate coverage data and combine with baseline
|
2017-02-27 19:37:33 +00:00
|
|
|
$LCOV -q -c -d $src -t "$(hostname)" -o cov_test.info
|
|
|
|
$LCOV -q -a cov_base.info -a cov_test.info -o $out/cov_total.info
|
2017-06-30 16:58:21 +00:00
|
|
|
$LCOV -q -r $out/cov_total.info '*/dpdk/*' -o $out/cov_total.info
|
2017-07-12 22:11:57 +00:00
|
|
|
$LCOV -q -r $out/cov_total.info '/usr/*' -o $out/cov_total.info
|
2017-05-08 20:57:23 +00:00
|
|
|
git clean -f "*.gcda"
|
2017-06-20 22:29:43 +00:00
|
|
|
rm -f cov_base.info cov_test.info OLD_STDOUT OLD_STDERR
|
2015-10-22 18:26:21 +00:00
|
|
|
fi
|