autotest_common: move config_params to a function.
This accomplishes a couple of things: 1. Now we don't perform these checks every single time we source autotest_common.sh (some 140 times) 2. We have some flexibility in changing parameters either during a test or when trying to do a specific compilation and calling this function to get the updated parameters. Signed-off-by: Seth Howell <seth.howell@intel.com> Change-Id: Ibbe2dc9113a56f651d41216e8557708824652442 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1784 Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
b6eb4c8bb6
commit
4f7f0f0986
@ -15,6 +15,7 @@ source "$rootdir/test/common/autotest_common.sh"
|
||||
|
||||
out=$output_dir
|
||||
scanbuild="scan-build -o $output_dir/scan-build-tmp --status-bugs"
|
||||
config_params=$(get_config_params)
|
||||
|
||||
rm -rf /tmp/spdk
|
||||
mkdir /tmp/spdk
|
||||
|
@ -35,7 +35,7 @@ fi
|
||||
|
||||
timing_enter build_release
|
||||
|
||||
./configure $config_params --disable-debug --enable-lto
|
||||
./configure $(get_config_params) --disable-debug --enable-lto
|
||||
$MAKE ${MAKEFLAGS}
|
||||
$MAKE ${MAKEFLAGS} clean
|
||||
|
||||
|
@ -169,111 +169,6 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
config_params='--enable-debug --enable-werror'
|
||||
|
||||
if echo -e "#include <libunwind.h>\nint main(int argc, char *argv[]) {return 0;}\n" | \
|
||||
gcc -o /dev/null -lunwind -x c - 2>/dev/null; then
|
||||
config_params+=' --enable-log-bt'
|
||||
fi
|
||||
|
||||
# for options with dependencies but no test flag, set them here
|
||||
if [ -f /usr/include/infiniband/verbs.h ]; then
|
||||
config_params+=' --with-rdma'
|
||||
fi
|
||||
|
||||
if [[ -d $CONFIG_FIO_SOURCE_DIR ]]; then
|
||||
config_params+=" --with-fio=$CONFIG_FIO_SOURCE_DIR"
|
||||
fi
|
||||
|
||||
if [ -d ${DEPENDENCY_DIR}/vtune_codes ]; then
|
||||
config_params+=' --with-vtune='${DEPENDENCY_DIR}'/vtune_codes'
|
||||
fi
|
||||
|
||||
if [ -d /usr/include/iscsi ]; then
|
||||
libiscsi_version=$(grep LIBISCSI_API_VERSION /usr/include/iscsi/iscsi.h | head -1 | awk '{print $3}' | awk -F '(' '{print $2}' | awk -F ')' '{print $1}')
|
||||
if [ $libiscsi_version -ge 20150621 ]; then
|
||||
config_params+=' --with-iscsi-initiator'
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $SPDK_TEST_UNITTEST -eq 0 ]; then
|
||||
config_params+=' --disable-unit-tests'
|
||||
fi
|
||||
|
||||
if [ $SPDK_TEST_NVME_CUSE -eq 1 ]; then
|
||||
config_params+=' --with-nvme-cuse'
|
||||
fi
|
||||
|
||||
# for options with both dependencies and a test flag, set them here
|
||||
if [ -f /usr/include/libpmemblk.h ] && [ $SPDK_TEST_PMDK -eq 1 ]; then
|
||||
config_params+=' --with-pmdk'
|
||||
fi
|
||||
|
||||
if [ -f /usr/include/libpmem.h ] && [ $SPDK_TEST_REDUCE -eq 1 ]; then
|
||||
if [ $SPDK_TEST_ISAL -eq 1 ]; then
|
||||
config_params+=' --with-reduce'
|
||||
else
|
||||
echo "reduce not enabled because isal is not enabled."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d /usr/include/rbd ] && [ -d /usr/include/rados ] && [ $SPDK_TEST_RBD -eq 1 ]; then
|
||||
config_params+=' --with-rbd'
|
||||
fi
|
||||
|
||||
if [ $SPDK_TEST_VPP -eq 1 ]; then
|
||||
VPP_PATH="/usr/local/src/vpp-19.04/build-root/install-vpp_debug-native/vpp/"
|
||||
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${VPP_PATH}/lib/
|
||||
export PATH=${PATH}:${VPP_PATH}/bin/
|
||||
config_params+=" --with-vpp=${VPP_PATH}"
|
||||
fi
|
||||
|
||||
# for options with no required dependencies, just test flags, set them here
|
||||
if [ $SPDK_TEST_CRYPTO -eq 1 ]; then
|
||||
config_params+=' --with-crypto'
|
||||
fi
|
||||
|
||||
if [ $SPDK_TEST_OCF -eq 1 ]; then
|
||||
config_params+=" --with-ocf"
|
||||
fi
|
||||
|
||||
if [ $SPDK_RUN_UBSAN -eq 1 ]; then
|
||||
config_params+=' --enable-ubsan'
|
||||
fi
|
||||
|
||||
if [ $SPDK_RUN_ASAN -eq 1 ]; then
|
||||
config_params+=' --enable-asan'
|
||||
fi
|
||||
|
||||
if [ "$(uname -s)" = "Linux" ]; then
|
||||
config_params+=' --enable-coverage'
|
||||
fi
|
||||
|
||||
if [ $SPDK_TEST_ISAL -eq 0 ]; then
|
||||
config_params+=' --without-isal'
|
||||
fi
|
||||
|
||||
if [ $SPDK_TEST_BLOBFS -eq 1 ]; then
|
||||
if [[ -d /usr/include/fuse3 ]] || [[ -d /usr/local/include/fuse3 ]]; then
|
||||
config_params+=' --with-fuse'
|
||||
else
|
||||
echo "FUSE not enabled because libfuse3 is not installed."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $SPDK_TEST_RAID5 -eq 1 ]; then
|
||||
config_params+=' --with-raid5'
|
||||
fi
|
||||
|
||||
# By default, --with-dpdk is not set meaning the SPDK build will use the DPDK submodule.
|
||||
# If a DPDK installation is found in a well-known location though, WITH_DPDK_DIR will be
|
||||
# set which will override the default and use that DPDK installation instead.
|
||||
if [ -n "$WITH_DPDK_DIR" ]; then
|
||||
config_params+=" --with-dpdk=$WITH_DPDK_DIR"
|
||||
fi
|
||||
|
||||
export config_params
|
||||
|
||||
if [ -z "$output_dir" ]; then
|
||||
if [ -z "$rootdir" ] || [ ! -d "$rootdir/../output" ]; then
|
||||
output_dir=.
|
||||
@ -306,6 +201,114 @@ if [[ -z $RPC_PIPE_PID ]] || ! kill -0 "$RPC_PIPE_PID" &>/dev/null; then
|
||||
# process, this will make rpc.py stop reading and exit gracefully
|
||||
fi
|
||||
|
||||
if [ $SPDK_TEST_VPP -eq 1 ]; then
|
||||
VPP_PATH="/usr/local/src/vpp-19.04/build-root/install-vpp_debug-native/vpp/"
|
||||
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${VPP_PATH}/lib/
|
||||
export PATH=${PATH}:${VPP_PATH}/bin/
|
||||
fi
|
||||
|
||||
function get_config_params() {
|
||||
xtrace_disable
|
||||
config_params='--enable-debug --enable-werror'
|
||||
|
||||
if echo -e "#include <libunwind.h>\nint main(int argc, char *argv[]) {return 0;}\n" | \
|
||||
gcc -o /dev/null -lunwind -x c - 2>/dev/null; then
|
||||
config_params+=' --enable-log-bt'
|
||||
fi
|
||||
|
||||
# for options with dependencies but no test flag, set them here
|
||||
if [ -f /usr/include/infiniband/verbs.h ]; then
|
||||
config_params+=' --with-rdma'
|
||||
fi
|
||||
|
||||
if [[ -d $CONFIG_FIO_SOURCE_DIR ]]; then
|
||||
config_params+=" --with-fio=$CONFIG_FIO_SOURCE_DIR"
|
||||
fi
|
||||
|
||||
if [ -d ${DEPENDENCY_DIR}/vtune_codes ]; then
|
||||
config_params+=' --with-vtune='${DEPENDENCY_DIR}'/vtune_codes'
|
||||
fi
|
||||
|
||||
if [ -d /usr/include/iscsi ]; then
|
||||
libiscsi_version=$(grep LIBISCSI_API_VERSION /usr/include/iscsi/iscsi.h | head -1 | awk '{print $3}' | awk -F '(' '{print $2}' | awk -F ')' '{print $1}')
|
||||
if [ $libiscsi_version -ge 20150621 ]; then
|
||||
config_params+=' --with-iscsi-initiator'
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $SPDK_TEST_UNITTEST -eq 0 ]; then
|
||||
config_params+=' --disable-unit-tests'
|
||||
fi
|
||||
|
||||
if [ $SPDK_TEST_NVME_CUSE -eq 1 ]; then
|
||||
config_params+=' --with-nvme-cuse'
|
||||
fi
|
||||
|
||||
# for options with both dependencies and a test flag, set them here
|
||||
if [ -f /usr/include/libpmemblk.h ] && [ $SPDK_TEST_PMDK -eq 1 ]; then
|
||||
config_params+=' --with-pmdk'
|
||||
fi
|
||||
|
||||
if [ -f /usr/include/libpmem.h ] && [ $SPDK_TEST_REDUCE -eq 1 ]; then
|
||||
if [ $SPDK_TEST_ISAL -eq 1 ]; then
|
||||
config_params+=' --with-reduce'
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d /usr/include/rbd ] && [ -d /usr/include/rados ] && [ $SPDK_TEST_RBD -eq 1 ]; then
|
||||
config_params+=' --with-rbd'
|
||||
fi
|
||||
|
||||
if [ $SPDK_TEST_VPP -eq 1 ]; then
|
||||
config_params+=" --with-vpp=${VPP_PATH}"
|
||||
fi
|
||||
|
||||
# for options with no required dependencies, just test flags, set them here
|
||||
if [ $SPDK_TEST_CRYPTO -eq 1 ]; then
|
||||
config_params+=' --with-crypto'
|
||||
fi
|
||||
|
||||
if [ $SPDK_TEST_OCF -eq 1 ]; then
|
||||
config_params+=" --with-ocf"
|
||||
fi
|
||||
|
||||
if [ $SPDK_RUN_UBSAN -eq 1 ]; then
|
||||
config_params+=' --enable-ubsan'
|
||||
fi
|
||||
|
||||
if [ $SPDK_RUN_ASAN -eq 1 ]; then
|
||||
config_params+=' --enable-asan'
|
||||
fi
|
||||
|
||||
if [ "$(uname -s)" = "Linux" ]; then
|
||||
config_params+=' --enable-coverage'
|
||||
fi
|
||||
|
||||
if [ $SPDK_TEST_ISAL -eq 0 ]; then
|
||||
config_params+=' --without-isal'
|
||||
fi
|
||||
|
||||
if [ $SPDK_TEST_BLOBFS -eq 1 ]; then
|
||||
if [[ -d /usr/include/fuse3 ]] || [[ -d /usr/local/include/fuse3 ]]; then
|
||||
config_params+=' --with-fuse'
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $SPDK_TEST_RAID5 -eq 1 ]; then
|
||||
config_params+=' --with-raid5'
|
||||
fi
|
||||
|
||||
# By default, --with-dpdk is not set meaning the SPDK build will use the DPDK submodule.
|
||||
# If a DPDK installation is found in a well-known location though, WITH_DPDK_DIR will be
|
||||
# set which will override the default and use that DPDK installation instead.
|
||||
if [ -n "$WITH_DPDK_DIR" ]; then
|
||||
config_params+=" --with-dpdk=$WITH_DPDK_DIR"
|
||||
fi
|
||||
|
||||
echo "$config_params"
|
||||
xtrace_restore
|
||||
}
|
||||
|
||||
function rpc_cmd() {
|
||||
xtrace_disable
|
||||
local rsp rc
|
||||
|
@ -91,7 +91,7 @@ for dev in $devs; do
|
||||
rsync -qav --exclude=".git" --exclude="*.o" $rootdir/ /mnt/${dev}dir/spdk
|
||||
|
||||
make -C /mnt/${dev}dir/spdk clean
|
||||
(cd /mnt/${dev}dir/spdk && ./configure $config_params)
|
||||
(cd /mnt/${dev}dir/spdk && ./configure $(get_config_params))
|
||||
make -C /mnt/${dev}dir/spdk -j16
|
||||
|
||||
# Print out space consumed on target device to help decide
|
||||
|
@ -165,6 +165,7 @@ function confirm_deps() {
|
||||
# symbol dependencies we have.
|
||||
sed -i -e 's,include $(SPDK_ROOT_DIR)/mk/spdk.lib_deps.mk,,g' "$rootdir/mk/spdk.lib.mk"
|
||||
|
||||
config_params=$(get_config_params)
|
||||
if [ "$SPDK_TEST_OCF" -eq 1 ]; then
|
||||
config_params="$config_params --with-ocf=$rootdir/build/ocf.a"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user