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:
Seth Howell 2020-04-09 10:54:24 -07:00 committed by Tomasz Zawadzki
parent b6eb4c8bb6
commit 4f7f0f0986
5 changed files with 112 additions and 107 deletions

View File

@ -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

View File

@ -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

View File

@ -169,6 +169,46 @@ else
exit 1
fi
if [ -z "$output_dir" ]; then
if [ -z "$rootdir" ] || [ ! -d "$rootdir/../output" ]; then
output_dir=.
else
output_dir=$rootdir/../output
fi
export output_dir
fi
TEST_MODE=
for i in "$@"; do
case "$i" in
--iso)
TEST_MODE=iso
;;
--transport=*)
TEST_TRANSPORT="${i#*=}"
;;
--sock=*)
TEST_SOCK="${i#*=}"
;;
esac
done
# start rpc.py coprocess if it's not started yet
if [[ -z $RPC_PIPE_PID ]] || ! kill -0 "$RPC_PIPE_PID" &>/dev/null; then
coproc RPC_PIPE { "$rootdir/scripts/rpc.py" --server; }
exec {RPC_PIPE_OUTPUT}<&${RPC_PIPE[0]} {RPC_PIPE_INPUT}>&${RPC_PIPE[1]}
# all descriptors will automatically close together with this bash
# 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" | \
@ -212,8 +252,6 @@ 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
@ -222,9 +260,6 @@ if [ -d /usr/include/rbd ] && [ -d /usr/include/rados ] && [ $SPDK_TEST_RBD -eq
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
@ -256,8 +291,6 @@ 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
@ -272,39 +305,9 @@ 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=.
else
output_dir=$rootdir/../output
fi
export output_dir
fi
TEST_MODE=
for i in "$@"; do
case "$i" in
--iso)
TEST_MODE=iso
;;
--transport=*)
TEST_TRANSPORT="${i#*=}"
;;
--sock=*)
TEST_SOCK="${i#*=}"
;;
esac
done
# start rpc.py coprocess if it's not started yet
if [[ -z $RPC_PIPE_PID ]] || ! kill -0 "$RPC_PIPE_PID" &>/dev/null; then
coproc RPC_PIPE { "$rootdir/scripts/rpc.py" --server; }
exec {RPC_PIPE_OUTPUT}<&${RPC_PIPE[0]} {RPC_PIPE_INPUT}>&${RPC_PIPE[1]}
# all descriptors will automatically close together with this bash
# process, this will make rpc.py stop reading and exit gracefully
fi
echo "$config_params"
xtrace_restore
}
function rpc_cmd() {
xtrace_disable

View File

@ -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

View File

@ -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