2015-09-21 21:48:40 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2021-11-17 10:28:45 +00:00
|
|
|
set -e
|
2015-09-21 21:48:40 +00:00
|
|
|
|
2019-05-09 11:22:41 +00:00
|
|
|
# If the configuration of tests is not provided, no tests will be carried out.
|
|
|
|
if [[ ! -f $1 ]]; then
|
|
|
|
echo "ERROR: SPDK test configuration not specified"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
source "$1"
|
|
|
|
|
2015-10-08 19:40:44 +00:00
|
|
|
rootdir=$(readlink -f $(dirname $0))
|
2021-06-02 10:30:12 +00:00
|
|
|
testdir=$rootdir # to get the storage space for tests
|
2018-02-27 22:14:08 +00:00
|
|
|
source "$rootdir/test/common/autotest_common.sh"
|
2015-10-03 00:11:56 +00:00
|
|
|
|
2021-02-24 15:28:36 +00:00
|
|
|
function build_rpms() (
|
|
|
|
local version rpms
|
|
|
|
|
|
|
|
# Make sure linker will not attempt to look under DPDK's repo dir to get the libs
|
|
|
|
unset -v LD_LIBRARY_PATH
|
|
|
|
|
|
|
|
install_uninstall_rpms() {
|
2021-06-16 11:23:48 +00:00
|
|
|
rpms=("${1:-$builddir/rpm/}/x86_64/"*.rpm)
|
2021-02-24 15:28:36 +00:00
|
|
|
|
|
|
|
sudo rpm -i "${rpms[@]}"
|
|
|
|
# Check if we can find one of the apps in the PATH now and verify if it doesn't miss
|
|
|
|
# any libs.
|
|
|
|
LIST_LIBS=yes "$rootdir/rpmbuild/rpm-deps.sh" "${SPDK_APP[@]##*/}"
|
2021-12-28 17:09:02 +00:00
|
|
|
rm "${rpms[@]}"
|
|
|
|
rpms=("${rpms[@]##*/}") rpms=("${rpms[@]%.rpm}")
|
2021-02-24 15:28:36 +00:00
|
|
|
sudo rpm -e "${rpms[@]}"
|
|
|
|
}
|
|
|
|
|
|
|
|
build_rpm() {
|
2021-06-16 09:09:59 +00:00
|
|
|
# Separate run to see the final .spec in use
|
|
|
|
GEN_SPEC=yes BUILDDIR=$builddir MAKEFLAGS="$MAKEFLAGS" SPDK_VERSION="$version" DEPS=no "$rootdir/rpmbuild/rpm.sh" "$@"
|
|
|
|
# Actual build
|
2021-06-02 10:30:12 +00:00
|
|
|
BUILDDIR=$builddir MAKEFLAGS="$MAKEFLAGS" SPDK_VERSION="$version" DEPS=no "$rootdir/rpmbuild/rpm.sh" "$@"
|
2021-02-24 15:28:36 +00:00
|
|
|
install_uninstall_rpms
|
|
|
|
}
|
|
|
|
|
2021-06-16 08:43:48 +00:00
|
|
|
build_rpm_with_rpmed_dpdk() {
|
|
|
|
sudo dnf install -y dpdk-devel
|
|
|
|
build_rpm --with-shared --with-dpdk
|
|
|
|
}
|
|
|
|
|
2021-06-16 11:23:48 +00:00
|
|
|
build_rpm_from_gen_spec() {
|
|
|
|
GEN_SPEC=yes \
|
|
|
|
USE_DEFAULT_DIRS=yes \
|
|
|
|
MAKEFLAGS="$MAKEFLAGS" \
|
|
|
|
SPDK_VERSION="$version" \
|
|
|
|
DEPS=no \
|
|
|
|
"$rootdir/rpmbuild/rpm.sh" --with-shared > "$builddir/gen-spdk.spec"
|
|
|
|
|
|
|
|
# Default locations should be in use.
|
|
|
|
sourcedir=$(rpm --eval "%{_sourcedir}") rpmdir=$(rpm --eval "%{_rpmdir}")
|
|
|
|
mkdir -p "$sourcedir" "$rpmdir"
|
|
|
|
|
|
|
|
# Prepare the source at the default location - default %prep step requires
|
|
|
|
# extra dir inside the source package hence the dance with symlinking to
|
|
|
|
# the repo (after the extraction source should be under spdk-$version/) -
|
|
|
|
# make sure symlinking is done outside of the repo to avoid nasty loops.
|
|
|
|
ln -s "$rootdir" "/tmp/spdk-$version"
|
|
|
|
tar -czhf "$sourcedir/spdk-$version.tar.gz" -C /tmp "spdk-$version"
|
|
|
|
|
|
|
|
# See rpm.sh for details on the PYTHONPATH HACK
|
|
|
|
PYTHONPATH="$(python3 -c "import sys; print('%s' % ':'.join(sys.path)[1:])")" \
|
|
|
|
rpmbuild -ba "$builddir/gen-spdk.spec"
|
|
|
|
install_uninstall_rpms "$rpmdir"
|
|
|
|
}
|
|
|
|
|
2021-02-24 15:28:36 +00:00
|
|
|
version="test_shared"
|
2021-06-02 10:30:12 +00:00
|
|
|
builddir=$SPDK_TEST_STORAGE/test-rpm
|
2021-06-16 08:43:48 +00:00
|
|
|
|
2021-02-24 15:28:36 +00:00
|
|
|
run_test "build_shared_rpm" build_rpm --with-shared
|
2021-07-05 12:25:11 +00:00
|
|
|
if [[ $RUN_NIGHTLY -eq 1 ]]; then
|
|
|
|
run_test "build_shared_rpm_with_rpmed_dpdk" build_rpm_with_rpmed_dpdk
|
|
|
|
run_test "build_rpm_from_gen_spec" build_rpm_from_gen_spec
|
|
|
|
if [[ -n $SPDK_TEST_NATIVE_DPDK ]]; then
|
|
|
|
version="test_shared_native_dpdk"
|
|
|
|
run_test "build_shared_native_dpdk_rpm" build_rpm --with-shared --with-dpdk="$SPDK_RUN_EXTERNAL_DPDK"
|
|
|
|
fi
|
2021-02-24 15:28:36 +00:00
|
|
|
fi
|
|
|
|
)
|
|
|
|
|
2015-09-21 21:48:40 +00:00
|
|
|
out=$PWD
|
|
|
|
|
|
|
|
MAKEFLAGS=${MAKEFLAGS:--j16}
|
2015-10-08 19:40:44 +00:00
|
|
|
cd $rootdir
|
|
|
|
|
2019-05-01 23:56:42 +00:00
|
|
|
timing_enter porcelain_check
|
2015-10-03 00:11:56 +00:00
|
|
|
$MAKE clean
|
2015-09-21 21:48:40 +00:00
|
|
|
|
2019-07-03 15:12:39 +00:00
|
|
|
if [ $(git status --porcelain --ignore-submodules | wc -l) -ne 0 ]; then
|
2015-09-21 21:48:40 +00:00
|
|
|
echo make clean left the following files:
|
2019-01-13 22:28:03 +00:00
|
|
|
git status --porcelain --ignore-submodules
|
2015-09-21 21:48:40 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2019-05-01 23:56:42 +00:00
|
|
|
timing_exit porcelain_check
|
|
|
|
|
2021-02-24 15:28:36 +00:00
|
|
|
if [[ $SPDK_TEST_RELEASE_BUILD -eq 1 ]]; then
|
|
|
|
run_test "build_rpms" build_rpms
|
2021-04-22 14:05:09 +00:00
|
|
|
$MAKE clean
|
2021-02-24 15:28:36 +00:00
|
|
|
fi
|
|
|
|
|
2021-03-30 09:27:48 +00:00
|
|
|
if [[ $RUN_NIGHTLY -eq 0 ]]; then
|
2019-05-01 23:56:42 +00:00
|
|
|
timing_finish
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2020-04-01 07:50:01 +00:00
|
|
|
timing_enter build_release
|
2015-09-21 21:48:40 +00:00
|
|
|
|
2020-10-16 08:38:15 +00:00
|
|
|
config_params="$(get_config_params | sed 's/--enable-debug//g')"
|
2020-04-27 20:50:05 +00:00
|
|
|
if [ $(uname -s) = Linux ]; then
|
2021-11-16 13:14:12 +00:00
|
|
|
# LTO needs a special compiler to work under clang. See detect_cc.sh for details.
|
|
|
|
if [[ $CC == *clang* ]]; then
|
|
|
|
LD=$(type -P ld.gold)
|
|
|
|
export LD
|
|
|
|
fi
|
2020-10-16 08:38:15 +00:00
|
|
|
./configure $config_params --enable-lto
|
2020-04-27 20:50:05 +00:00
|
|
|
else
|
|
|
|
# LTO needs a special compiler to work on BSD.
|
2020-10-16 08:38:15 +00:00
|
|
|
./configure $config_params
|
2020-04-27 20:50:05 +00:00
|
|
|
fi
|
2020-04-01 07:50:01 +00:00
|
|
|
$MAKE ${MAKEFLAGS}
|
|
|
|
$MAKE ${MAKEFLAGS} clean
|
2015-09-21 21:48:40 +00:00
|
|
|
|
2020-04-01 07:50:01 +00:00
|
|
|
timing_exit build_release
|
2015-10-08 19:40:44 +00:00
|
|
|
|
|
|
|
timing_finish
|