2018-02-27 23:07:35 +00:00
|
|
|
#!/usr/bin/env bash
|
2022-11-02 15:49:40 +00:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
# Copyright (C) 2018 Intel Corporation
|
|
|
|
# All rights reserved.
|
2023-01-09 17:33:40 +00:00
|
|
|
# Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
2018-02-27 23:07:35 +00:00
|
|
|
#
|
|
|
|
# Environment variables:
|
|
|
|
# $valgrind Specify the valgrind command line, if not
|
|
|
|
# then a default command line is used
|
|
|
|
|
|
|
|
set -xe
|
|
|
|
|
|
|
|
testdir=$(readlink -f $(dirname $0))
|
2018-03-19 21:02:59 +00:00
|
|
|
rootdir=$(readlink -f $(dirname $0)/../..)
|
2019-12-19 22:14:59 +00:00
|
|
|
source "$rootdir/test/common/autotest_common.sh"
|
2018-02-27 23:07:35 +00:00
|
|
|
|
2018-07-06 15:53:45 +00:00
|
|
|
cd "$rootdir"
|
|
|
|
|
2020-05-07 11:27:06 +00:00
|
|
|
function unittest_bdev() {
|
2019-12-19 22:14:59 +00:00
|
|
|
$valgrind $testdir/lib/bdev/bdev.c/bdev_ut
|
2021-01-18 14:04:41 +00:00
|
|
|
$valgrind $testdir/lib/bdev/nvme/bdev_nvme.c/bdev_nvme_ut
|
2020-02-03 11:33:41 +00:00
|
|
|
$valgrind $testdir/lib/bdev/raid/bdev_raid.c/bdev_raid_ut
|
2022-02-01 06:46:20 +00:00
|
|
|
$valgrind $testdir/lib/bdev/raid/concat.c/concat_ut
|
2022-11-08 09:59:01 +00:00
|
|
|
$valgrind $testdir/lib/bdev/raid/raid1.c/raid1_ut
|
2019-12-19 22:14:59 +00:00
|
|
|
$valgrind $testdir/lib/bdev/bdev_zone.c/bdev_zone_ut
|
|
|
|
$valgrind $testdir/lib/bdev/gpt/gpt.c/gpt_ut
|
|
|
|
$valgrind $testdir/lib/bdev/part.c/part_ut
|
|
|
|
$valgrind $testdir/lib/bdev/scsi_nvme.c/scsi_nvme_ut
|
|
|
|
$valgrind $testdir/lib/bdev/vbdev_lvol.c/vbdev_lvol_ut
|
|
|
|
$valgrind $testdir/lib/bdev/vbdev_zone_block.c/vbdev_zone_block_ut
|
|
|
|
$valgrind $testdir/lib/bdev/mt/bdev.c/bdev_ut
|
|
|
|
}
|
2018-09-28 12:29:04 +00:00
|
|
|
|
2020-05-07 11:27:06 +00:00
|
|
|
function unittest_blob() {
|
2020-09-24 05:28:21 +00:00
|
|
|
# We do not compile blob_ut on systems with too old Cunit, so do
|
|
|
|
# not try to execute it if it doesn't exist
|
|
|
|
if [[ -e $testdir/lib/blob/blob.c/blob_ut ]]; then
|
|
|
|
$valgrind $testdir/lib/blob/blob.c/blob_ut
|
|
|
|
fi
|
2023-01-09 17:33:40 +00:00
|
|
|
$valgrind $testdir/lib/blob/blob_bdev.c/blob_bdev_ut
|
2019-12-19 22:19:57 +00:00
|
|
|
$valgrind $testdir/lib/blobfs/tree.c/tree_ut
|
|
|
|
$valgrind $testdir/lib/blobfs/blobfs_async_ut/blobfs_async_ut
|
|
|
|
# blobfs_sync_ut hangs when run under valgrind, so don't use $valgrind
|
|
|
|
$testdir/lib/blobfs/blobfs_sync_ut/blobfs_sync_ut
|
|
|
|
$valgrind $testdir/lib/blobfs/blobfs_bdev.c/blobfs_bdev_ut
|
|
|
|
}
|
|
|
|
|
2020-05-07 11:27:06 +00:00
|
|
|
function unittest_event() {
|
2019-12-19 22:22:21 +00:00
|
|
|
$valgrind $testdir/lib/event/app.c/app_ut
|
|
|
|
$valgrind $testdir/lib/event/reactor.c/reactor_ut
|
|
|
|
}
|
|
|
|
|
2022-06-22 10:11:47 +00:00
|
|
|
function unittest_ftl() {
|
2022-06-22 12:11:50 +00:00
|
|
|
$valgrind $testdir/lib/ftl/ftl_band.c/ftl_band_ut
|
2022-06-10 08:28:16 +00:00
|
|
|
$valgrind $testdir/lib/ftl/ftl_bitmap.c/ftl_bitmap_ut
|
2022-06-15 07:47:20 +00:00
|
|
|
$valgrind $testdir/lib/ftl/ftl_io.c/ftl_io_ut
|
2022-06-22 10:11:47 +00:00
|
|
|
$valgrind $testdir/lib/ftl/ftl_mngt/ftl_mngt_ut
|
2022-06-15 09:54:12 +00:00
|
|
|
$valgrind $testdir/lib/ftl/ftl_mempool.c/ftl_mempool_ut
|
2022-06-13 11:31:05 +00:00
|
|
|
$valgrind $testdir/lib/ftl/ftl_l2p/ftl_l2p_ut
|
2022-05-25 10:13:38 +00:00
|
|
|
$valgrind $testdir/lib/ftl/ftl_sb/ftl_sb_ut
|
|
|
|
$valgrind $testdir/lib/ftl/ftl_layout_upgrade/ftl_layout_upgrade_ut
|
2022-06-22 10:11:47 +00:00
|
|
|
}
|
|
|
|
|
2020-05-07 11:27:06 +00:00
|
|
|
function unittest_iscsi() {
|
2019-12-19 22:27:02 +00:00
|
|
|
$valgrind $testdir/lib/iscsi/conn.c/conn_ut
|
|
|
|
$valgrind $testdir/lib/iscsi/param.c/param_ut
|
2020-10-23 10:00:50 +00:00
|
|
|
$valgrind $testdir/lib/iscsi/tgt_node.c/tgt_node_ut
|
2019-12-19 22:27:02 +00:00
|
|
|
$valgrind $testdir/lib/iscsi/iscsi.c/iscsi_ut
|
2020-10-23 10:00:50 +00:00
|
|
|
$valgrind $testdir/lib/iscsi/init_grp.c/init_grp_ut
|
|
|
|
$valgrind $testdir/lib/iscsi/portal_grp.c/portal_grp_ut
|
2019-12-19 22:27:02 +00:00
|
|
|
}
|
|
|
|
|
2020-05-07 11:27:06 +00:00
|
|
|
function unittest_json() {
|
2019-12-19 22:28:59 +00:00
|
|
|
$valgrind $testdir/lib/json/json_parse.c/json_parse_ut
|
|
|
|
$valgrind $testdir/lib/json/json_util.c/json_util_ut
|
|
|
|
$valgrind $testdir/lib/json/json_write.c/json_write_ut
|
|
|
|
$valgrind $testdir/lib/jsonrpc/jsonrpc_server.c/jsonrpc_server_ut
|
|
|
|
}
|
|
|
|
|
2021-08-23 00:49:14 +00:00
|
|
|
function unittest_rpc() {
|
|
|
|
$valgrind $testdir/lib/rpc/rpc.c/rpc_ut
|
|
|
|
}
|
|
|
|
|
2020-05-07 11:27:06 +00:00
|
|
|
function unittest_nvme() {
|
2019-12-19 22:32:00 +00:00
|
|
|
$valgrind $testdir/lib/nvme/nvme.c/nvme_ut
|
|
|
|
$valgrind $testdir/lib/nvme/nvme_ctrlr.c/nvme_ctrlr_ut
|
|
|
|
$valgrind $testdir/lib/nvme/nvme_ctrlr_cmd.c/nvme_ctrlr_cmd_ut
|
|
|
|
$valgrind $testdir/lib/nvme/nvme_ctrlr_ocssd_cmd.c/nvme_ctrlr_ocssd_cmd_ut
|
|
|
|
$valgrind $testdir/lib/nvme/nvme_ns.c/nvme_ns_ut
|
|
|
|
$valgrind $testdir/lib/nvme/nvme_ns_cmd.c/nvme_ns_cmd_ut
|
|
|
|
$valgrind $testdir/lib/nvme/nvme_ns_ocssd_cmd.c/nvme_ns_ocssd_cmd_ut
|
|
|
|
$valgrind $testdir/lib/nvme/nvme_qpair.c/nvme_qpair_ut
|
|
|
|
$valgrind $testdir/lib/nvme/nvme_pcie.c/nvme_pcie_ut
|
2020-02-07 23:52:14 +00:00
|
|
|
$valgrind $testdir/lib/nvme/nvme_poll_group.c/nvme_poll_group_ut
|
2019-12-19 22:32:00 +00:00
|
|
|
$valgrind $testdir/lib/nvme/nvme_quirks.c/nvme_quirks_ut
|
|
|
|
$valgrind $testdir/lib/nvme/nvme_tcp.c/nvme_tcp_ut
|
2021-02-04 08:21:05 +00:00
|
|
|
$valgrind $testdir/lib/nvme/nvme_transport.c/nvme_transport_ut
|
2021-01-29 08:46:28 +00:00
|
|
|
$valgrind $testdir/lib/nvme/nvme_io_msg.c/nvme_io_msg_ut
|
2021-03-08 03:02:40 +00:00
|
|
|
$valgrind $testdir/lib/nvme/nvme_pcie_common.c/nvme_pcie_common_ut
|
2021-02-26 06:43:46 +00:00
|
|
|
$valgrind $testdir/lib/nvme/nvme_fabric.c/nvme_fabric_ut
|
2021-05-18 09:18:50 +00:00
|
|
|
$valgrind $testdir/lib/nvme/nvme_opal.c/nvme_opal_ut
|
2019-12-19 22:32:00 +00:00
|
|
|
}
|
|
|
|
|
2020-05-07 11:27:06 +00:00
|
|
|
function unittest_nvmf() {
|
2019-12-19 22:36:08 +00:00
|
|
|
$valgrind $testdir/lib/nvmf/ctrlr.c/ctrlr_ut
|
|
|
|
$valgrind $testdir/lib/nvmf/ctrlr_bdev.c/ctrlr_bdev_ut
|
|
|
|
$valgrind $testdir/lib/nvmf/ctrlr_discovery.c/ctrlr_discovery_ut
|
|
|
|
$valgrind $testdir/lib/nvmf/subsystem.c/subsystem_ut
|
|
|
|
$valgrind $testdir/lib/nvmf/tcp.c/tcp_ut
|
2021-07-06 06:19:01 +00:00
|
|
|
$valgrind $testdir/lib/nvmf/nvmf.c/nvmf_ut
|
2019-12-19 22:36:08 +00:00
|
|
|
}
|
|
|
|
|
2020-05-07 11:27:06 +00:00
|
|
|
function unittest_scsi() {
|
2019-12-19 22:37:55 +00:00
|
|
|
$valgrind $testdir/lib/scsi/dev.c/dev_ut
|
|
|
|
$valgrind $testdir/lib/scsi/lun.c/lun_ut
|
|
|
|
$valgrind $testdir/lib/scsi/scsi.c/scsi_ut
|
|
|
|
$valgrind $testdir/lib/scsi/scsi_bdev.c/scsi_bdev_ut
|
|
|
|
$valgrind $testdir/lib/scsi/scsi_pr.c/scsi_pr_ut
|
|
|
|
}
|
|
|
|
|
2020-05-07 11:27:06 +00:00
|
|
|
function unittest_sock() {
|
|
|
|
$valgrind $testdir/lib/sock/sock.c/sock_ut
|
|
|
|
$valgrind $testdir/lib/sock/posix.c/posix_ut
|
2020-06-29 16:34:52 +00:00
|
|
|
# Check whether uring is configured
|
|
|
|
if grep -q '#define SPDK_CONFIG_URING 1' $rootdir/include/spdk/config.h; then
|
|
|
|
$valgrind $testdir/lib/sock/uring.c/uring_ut
|
|
|
|
fi
|
2020-02-17 14:20:20 +00:00
|
|
|
}
|
|
|
|
|
2020-05-07 11:27:06 +00:00
|
|
|
function unittest_util() {
|
2019-12-19 22:39:57 +00:00
|
|
|
$valgrind $testdir/lib/util/base64.c/base64_ut
|
|
|
|
$valgrind $testdir/lib/util/bit_array.c/bit_array_ut
|
|
|
|
$valgrind $testdir/lib/util/cpuset.c/cpuset_ut
|
|
|
|
$valgrind $testdir/lib/util/crc16.c/crc16_ut
|
|
|
|
$valgrind $testdir/lib/util/crc32_ieee.c/crc32_ieee_ut
|
|
|
|
$valgrind $testdir/lib/util/crc32c.c/crc32c_ut
|
|
|
|
$valgrind $testdir/lib/util/string.c/string_ut
|
|
|
|
$valgrind $testdir/lib/util/dif.c/dif_ut
|
|
|
|
$valgrind $testdir/lib/util/iov.c/iov_ut
|
2020-03-18 02:25:30 +00:00
|
|
|
$valgrind $testdir/lib/util/math.c/math_ut
|
2019-12-19 22:39:57 +00:00
|
|
|
$valgrind $testdir/lib/util/pipe.c/pipe_ut
|
2022-03-28 12:17:55 +00:00
|
|
|
$valgrind $testdir/lib/util/xor.c/xor_ut
|
2019-12-19 22:39:57 +00:00
|
|
|
}
|
|
|
|
|
2021-02-26 22:00:03 +00:00
|
|
|
function unittest_init() {
|
|
|
|
$valgrind $testdir/lib/init/subsystem.c/subsystem_ut
|
|
|
|
}
|
|
|
|
|
2022-03-21 17:38:24 +00:00
|
|
|
if [ $SPDK_RUN_VALGRIND -eq 1 ] && [ $SPDK_RUN_ASAN -eq 1 ]; then
|
|
|
|
echo "ERR: Tests cannot be run if both SPDK_RUN_VALGRIND and SPDK_RUN_ASAN options are selected simultaneously"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-02-27 23:07:35 +00:00
|
|
|
# if ASAN is enabled, use it. If not use valgrind if installed but allow
|
|
|
|
# the env variable to override the default shown below.
|
|
|
|
if [ -z ${valgrind+x} ]; then
|
2018-09-28 12:29:04 +00:00
|
|
|
if grep -q '#undef SPDK_CONFIG_ASAN' $rootdir/include/spdk/config.h && hash valgrind; then
|
2022-12-05 13:21:37 +00:00
|
|
|
valgrind='valgrind --leak-check=full --error-exitcode=2 --verbose'
|
2018-02-27 23:07:35 +00:00
|
|
|
else
|
|
|
|
valgrind=''
|
|
|
|
fi
|
|
|
|
fi
|
2022-03-21 17:38:24 +00:00
|
|
|
if [ $SPDK_RUN_VALGRIND -eq 1 ]; then
|
|
|
|
if [ -n "$valgrind" ]; then
|
|
|
|
run_test "valgrind" echo "Using valgrind for unit tests"
|
|
|
|
else
|
|
|
|
echo "ERR: SPDK_RUN_VALGRIND option is enabled but valgrind is not available"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
2018-02-27 23:07:35 +00:00
|
|
|
|
|
|
|
# setup local unit test coverage if cov is available
|
2020-12-01 07:48:29 +00:00
|
|
|
# lcov takes considerable time to process clang coverage.
|
|
|
|
# Disabling lcov allow us to do this.
|
|
|
|
# More information: https://github.com/spdk/spdk/issues/1693
|
|
|
|
CC_TYPE=$(grep CC_TYPE $rootdir/mk/cc.mk)
|
|
|
|
if hash lcov && grep -q '#define SPDK_CONFIG_COVERAGE 1' $rootdir/include/spdk/config.h && ! [[ "$CC_TYPE" == *"clang"* ]]; then
|
2018-02-27 23:07:35 +00:00
|
|
|
cov_avail="yes"
|
|
|
|
else
|
|
|
|
cov_avail="no"
|
|
|
|
fi
|
|
|
|
if [ "$cov_avail" = "yes" ]; then
|
|
|
|
# set unit test output dir if not specified in env var
|
2022-11-18 09:35:01 +00:00
|
|
|
if [[ -z $output_dir ]]; then
|
2018-02-27 23:07:35 +00:00
|
|
|
UT_COVERAGE="ut_coverage"
|
2022-11-18 09:35:01 +00:00
|
|
|
else
|
|
|
|
UT_COVERAGE=$output_dir/ut_coverage
|
2018-02-27 23:07:35 +00:00
|
|
|
fi
|
|
|
|
mkdir -p $UT_COVERAGE
|
|
|
|
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
|
|
|
|
"
|
|
|
|
export LCOV="lcov $LCOV_OPTS --no-external"
|
|
|
|
# zero out coverage data
|
|
|
|
$LCOV -q -c -i -d . -t "Baseline" -o $UT_COVERAGE/ut_cov_base.info
|
|
|
|
fi
|
2019-02-16 15:51:45 +00:00
|
|
|
|
|
|
|
# workaround for valgrind v3.13 on arm64
|
|
|
|
if [ $(uname -m) = "aarch64" ]; then
|
|
|
|
export LD_HWCAP_MASK=1
|
|
|
|
fi
|
|
|
|
|
2021-04-02 13:04:42 +00:00
|
|
|
run_test "unittest_pci_event" $valgrind $testdir/lib/env_dpdk/pci_event.c/pci_event_ut
|
2019-12-19 22:46:55 +00:00
|
|
|
run_test "unittest_include" $valgrind $testdir/include/spdk/histogram_data.h/histogram_ut
|
2019-12-19 22:14:59 +00:00
|
|
|
run_test "unittest_bdev" unittest_bdev
|
2020-04-24 14:09:37 +00:00
|
|
|
if grep -q '#define SPDK_CONFIG_CRYPTO 1' $rootdir/include/spdk/config.h; then
|
2019-12-19 22:14:59 +00:00
|
|
|
run_test "unittest_bdev_crypto" $valgrind $testdir/lib/bdev/crypto.c/crypto_ut
|
2022-12-02 12:10:44 +00:00
|
|
|
run_test "unittest_bdev_crypto" $valgrind $testdir/lib/accel/dpdk_cryptodev.c/accel_dpdk_cryptodev_ut
|
2018-03-07 23:44:06 +00:00
|
|
|
fi
|
|
|
|
|
2022-10-28 23:07:51 +00:00
|
|
|
if grep -q '#define SPDK_CONFIG_VBDEV_COMPRESS 1' $rootdir/include/spdk/config.h; then
|
|
|
|
run_test "unittest_bdev_compress" $valgrind $testdir/lib/bdev/compress.c/compress_ut
|
2022-12-01 21:45:47 +00:00
|
|
|
run_test "unittest_lib_reduce" $valgrind $testdir/lib/reduce/reduce.c/reduce_ut
|
2019-02-19 22:52:08 +00:00
|
|
|
fi
|
|
|
|
|
2022-12-23 21:00:47 +00:00
|
|
|
if grep -q '#define SPDK_CONFIG_DPDK_COMPRESSDEV 1' $rootdir/include/spdk/config.h; then
|
|
|
|
run_test "unittest_dpdk_compressdev" $valgrind $testdir/lib/accel/dpdk_compressdev.c/accel_dpdk_compressdev_ut
|
|
|
|
fi
|
|
|
|
|
2020-04-24 14:09:37 +00:00
|
|
|
if grep -q '#define SPDK_CONFIG_PMDK 1' $rootdir/include/spdk/config.h; then
|
2019-12-19 22:14:59 +00:00
|
|
|
run_test "unittest_bdev_pmem" $valgrind $testdir/lib/bdev/pmem/bdev_pmem_ut
|
2018-02-27 23:07:35 +00:00
|
|
|
fi
|
|
|
|
|
2022-04-27 09:18:05 +00:00
|
|
|
if grep -q '#define SPDK_CONFIG_RAID5F 1' $rootdir/include/spdk/config.h; then
|
|
|
|
run_test "unittest_bdev_raid5f" $valgrind $testdir/lib/bdev/raid/raid5f.c/raid5f_ut
|
2019-11-04 11:35:50 +00:00
|
|
|
fi
|
|
|
|
|
2019-12-19 22:19:57 +00:00
|
|
|
run_test "unittest_blob_blobfs" unittest_blob
|
2019-12-19 22:22:21 +00:00
|
|
|
run_test "unittest_event" unittest_event
|
2022-06-22 10:11:47 +00:00
|
|
|
if [ $(uname -s) = Linux ]; then
|
|
|
|
run_test "unittest_ftl" unittest_ftl
|
|
|
|
fi
|
2018-02-27 23:07:35 +00:00
|
|
|
|
2022-08-08 20:51:25 +00:00
|
|
|
run_test "unittest_accel" $valgrind $testdir/lib/accel/accel.c/accel_ut
|
2019-12-19 22:50:11 +00:00
|
|
|
run_test "unittest_ioat" $valgrind $testdir/lib/ioat/ioat.c/ioat_ut
|
2020-04-24 09:01:25 +00:00
|
|
|
if grep -q '#define SPDK_CONFIG_IDXD 1' $rootdir/include/spdk/config.h; then
|
2021-04-13 11:02:46 +00:00
|
|
|
run_test "unittest_idxd_user" $valgrind $testdir/lib/idxd/idxd_user.c/idxd_user_ut
|
2020-04-09 16:19:30 +00:00
|
|
|
fi
|
2019-12-19 22:27:02 +00:00
|
|
|
run_test "unittest_iscsi" unittest_iscsi
|
2019-12-19 22:28:59 +00:00
|
|
|
run_test "unittest_json" unittest_json
|
2021-08-23 00:49:14 +00:00
|
|
|
run_test "unittest_rpc" unittest_rpc
|
2019-12-19 22:50:11 +00:00
|
|
|
run_test "unittest_notify" $valgrind $testdir/lib/notify/notify.c/notify_ut
|
2019-12-19 22:32:00 +00:00
|
|
|
run_test "unittest_nvme" unittest_nvme
|
2019-12-19 22:50:11 +00:00
|
|
|
run_test "unittest_log" $valgrind $testdir/lib/log/log.c/log_ut
|
|
|
|
run_test "unittest_lvol" $valgrind $testdir/lib/lvol/lvol.c/lvol_ut
|
2018-10-11 23:21:05 +00:00
|
|
|
if grep -q '#define SPDK_CONFIG_RDMA 1' $rootdir/include/spdk/config.h; then
|
2019-12-19 22:32:00 +00:00
|
|
|
run_test "unittest_nvme_rdma" $valgrind $testdir/lib/nvme/nvme_rdma.c/nvme_rdma_ut
|
2021-08-31 06:42:08 +00:00
|
|
|
run_test "unittest_nvmf_transport" $valgrind $testdir/lib/nvmf/transport.c/transport_ut
|
rdma: Maintain per device PD which is persistent across reconnect
SPDK NVMe RDMA initiator used the default PD per RDMA device. Default PD
may be changed when all QPs for the RDMA device are destroyed and created
again.
For multipath, the RDMA zero copy feature require the PD per RDMA device
to be persistent when all QPs for the RDMA device are destroyed and
created again.
Maintain such persistent PDs in this patch.
Add two APIs, spdk_rdma_get_pd() and spdk_rdma_put_pd().
In each call of two APIs, synchronize RDMA device list with
rdma_get_devices().
Context may be deleted anytime by rdma-core. To avoid such deletion,
hold the returned array by rdma_get_devices().
RDMA device has PD, context, ref. count, and removed flag. If context
is missing in rdma_get_devices(), set the removed flag to true. Then,
if the ref count becomes zero, free the PD and the RDMA device.
The ref. count of a RDMA device is incremented when spdk_rdma_get_pd()
is called and decremented when spdk_rdma_put_pd() is called.
To simplify synchronization, sort the returned array by
rdma_get_devices().
To avoid resource leakage, add destructor function and free all PDs
and related data at termination.
Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I093cb4ec2c7d8432642edfbffa270797ccf3e715
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13769
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2022-07-25 05:32:44 +00:00
|
|
|
run_test "unittest_rdma" $valgrind $testdir/lib/rdma/common.c/common_ut
|
2018-10-03 21:02:54 +00:00
|
|
|
fi
|
2018-02-27 23:07:35 +00:00
|
|
|
|
2021-03-02 01:39:45 +00:00
|
|
|
if grep -q '#define SPDK_CONFIG_NVME_CUSE 1' $rootdir/include/spdk/config.h; then
|
|
|
|
run_test "unittest_nvme_cuse" $valgrind $testdir/lib/nvme/nvme_cuse.c/nvme_cuse_ut
|
|
|
|
fi
|
|
|
|
|
2019-12-19 22:36:08 +00:00
|
|
|
run_test "unittest_nvmf" unittest_nvmf
|
2020-04-24 14:09:37 +00:00
|
|
|
if grep -q '#define SPDK_CONFIG_FC 1' $rootdir/include/spdk/config.h; then
|
2019-12-19 22:36:08 +00:00
|
|
|
run_test "unittest_nvmf_fc" $valgrind $testdir/lib/nvmf/fc.c/fc_ut
|
|
|
|
run_test "unittest_nvmf_fc_ls" $valgrind $testdir/lib/nvmf/fc_ls.c/fc_ls_ut
|
|
|
|
fi
|
|
|
|
|
2018-10-11 23:21:05 +00:00
|
|
|
if grep -q '#define SPDK_CONFIG_RDMA 1' $rootdir/include/spdk/config.h; then
|
2019-12-19 22:36:08 +00:00
|
|
|
run_test "unittest_nvmf_rdma" $valgrind $testdir/lib/nvmf/rdma.c/rdma_ut
|
2018-10-11 23:21:05 +00:00
|
|
|
fi
|
2019-12-19 22:36:08 +00:00
|
|
|
|
2019-12-19 22:50:11 +00:00
|
|
|
run_test "unittest_scsi" unittest_scsi
|
2020-02-17 14:20:20 +00:00
|
|
|
run_test "unittest_sock" unittest_sock
|
2019-12-19 22:46:55 +00:00
|
|
|
run_test "unittest_thread" $valgrind $testdir/lib/thread/thread.c/thread_ut
|
2019-12-19 22:39:57 +00:00
|
|
|
run_test "unittest_util" unittest_util
|
2020-04-24 14:09:37 +00:00
|
|
|
if grep -q '#define SPDK_CONFIG_VHOST 1' $rootdir/include/spdk/config.h; then
|
2019-12-19 22:46:55 +00:00
|
|
|
run_test "unittest_vhost" $valgrind $testdir/lib/vhost/vhost.c/vhost_ut
|
2018-10-29 14:25:26 +00:00
|
|
|
fi
|
2021-04-26 06:29:38 +00:00
|
|
|
run_test "unittest_dma" $valgrind $testdir/lib/dma/dma.c/dma_ut
|
2018-10-29 14:25:26 +00:00
|
|
|
|
2021-02-26 22:00:03 +00:00
|
|
|
run_test "unittest_init" unittest_init
|
|
|
|
|
2020-11-19 10:47:05 +00:00
|
|
|
if [ "$cov_avail" = "yes" ] && ! [[ "$CC_TYPE" == *"clang"* ]]; then
|
2018-02-27 23:07:35 +00:00
|
|
|
$LCOV -q -d . -c -t "$(hostname)" -o $UT_COVERAGE/ut_cov_test.info
|
|
|
|
$LCOV -q -a $UT_COVERAGE/ut_cov_base.info -a $UT_COVERAGE/ut_cov_test.info -o $UT_COVERAGE/ut_cov_total.info
|
|
|
|
$LCOV -q -a $UT_COVERAGE/ut_cov_total.info -o $UT_COVERAGE/ut_cov_unit.info
|
2018-03-19 21:02:59 +00:00
|
|
|
$LCOV -q -r $UT_COVERAGE/ut_cov_unit.info "$rootdir/app/*" -o $UT_COVERAGE/ut_cov_unit.info
|
2018-03-19 22:15:14 +00:00
|
|
|
$LCOV -q -r $UT_COVERAGE/ut_cov_unit.info "$rootdir/dpdk/*" -o $UT_COVERAGE/ut_cov_unit.info
|
2018-03-19 21:02:59 +00:00
|
|
|
$LCOV -q -r $UT_COVERAGE/ut_cov_unit.info "$rootdir/examples/*" -o $UT_COVERAGE/ut_cov_unit.info
|
|
|
|
$LCOV -q -r $UT_COVERAGE/ut_cov_unit.info "$rootdir/lib/vhost/rte_vhost/*" -o $UT_COVERAGE/ut_cov_unit.info
|
|
|
|
$LCOV -q -r $UT_COVERAGE/ut_cov_unit.info "$rootdir/test/*" -o $UT_COVERAGE/ut_cov_unit.info
|
2018-02-27 23:07:35 +00:00
|
|
|
rm -f $UT_COVERAGE/ut_cov_base.info $UT_COVERAGE/ut_cov_test.info
|
|
|
|
genhtml $UT_COVERAGE/ut_cov_unit.info --output-directory $UT_COVERAGE
|
|
|
|
# git -C option not used for compatibility reasons
|
2022-05-15 13:58:14 +00:00
|
|
|
owner=$(stat -c "%U" $rootdir)
|
|
|
|
cd $rootdir
|
|
|
|
sudo -u $owner git clean -f "*.gcda"
|
2018-02-27 23:07:35 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
set +x
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo "====================="
|
|
|
|
echo "All unit tests passed"
|
|
|
|
echo "====================="
|
|
|
|
if [ "$cov_avail" = "yes" ]; then
|
2018-07-06 15:53:45 +00:00
|
|
|
echo "Note: coverage report is here: $rootdir/$UT_COVERAGE"
|
2018-02-27 23:07:35 +00:00
|
|
|
else
|
|
|
|
echo "WARN: lcov not installed or SPDK built without coverage!"
|
|
|
|
fi
|
2018-09-28 12:29:04 +00:00
|
|
|
if grep -q '#undef SPDK_CONFIG_ASAN' $rootdir/include/spdk/config.h && [ "$valgrind" = "" ]; then
|
2018-02-27 23:07:35 +00:00
|
|
|
echo "WARN: neither valgrind nor ASAN is enabled!"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|