autobuild: Use mktemp() for spdk workspace
With issues similar to https://github.com/spdk/spdk/issues/1293 it would be better to use temporary directories for spdk workspace instead of depending on the hardcoded path (/tmp/spdk). This will mitigate potential scenario where permissions of the target dir are suddenly changed in-between autobuild runs. Change-Id: If44a2dcce712a185287186f33e7361223dc6d451 Signed-off-by: Michal Berger <michalx.berger@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1863 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
7f007b44a9
commit
ae7300425b
20
autobuild.sh
20
autobuild.sh
@ -17,8 +17,11 @@ 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
|
||||
trap '[[ -d $SPDK_WORKSPACE ]] && rm -rf "$SPDK_WORKSPACE"' 0
|
||||
|
||||
SPDK_WORKSPACE=$(mktemp -dt "spdk_$(date +%s).XXXXXX")
|
||||
export SPDK_WORKSPACE
|
||||
|
||||
umask 022
|
||||
cd $rootdir
|
||||
|
||||
@ -115,15 +118,12 @@ function header_dependency_check {
|
||||
|
||||
function test_make_uninstall {
|
||||
# Create empty file to check if it is not deleted by target uninstall
|
||||
touch /tmp/spdk/usr/lib/sample_xyz.a
|
||||
$MAKE $MAKEFLAGS uninstall DESTDIR=/tmp/spdk prefix=/usr
|
||||
if [[ $(find /tmp/spdk/usr -maxdepth 1 -mindepth 1 | wc -l) -ne 2 ]] || [[ $(find /tmp/spdk/usr/lib/ -maxdepth 1 -mindepth 1 | wc -l) -ne 1 ]]; then
|
||||
ls -lR /tmp/spdk
|
||||
rm -rf /tmp/spdk
|
||||
touch "$SPDK_WORKSPACE/usr/lib/sample_xyz.a"
|
||||
$MAKE $MAKEFLAGS uninstall DESTDIR="$SPDK_WORKSPACE" prefix=/usr
|
||||
if [[ $(find "$SPDK_WORKSPACE/usr" -maxdepth 1 -mindepth 1 | wc -l) -ne 2 ]] || [[ $(find "$SPDK_WORKSPACE/usr/lib/" -maxdepth 1 -mindepth 1 | wc -l) -ne 1 ]]; then
|
||||
ls -lR "$SPDK_WORKSPACE"
|
||||
echo "Make uninstall failed"
|
||||
exit 1
|
||||
else
|
||||
rm -rf /tmp/spdk
|
||||
fi
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ function autobuild_test_suite {
|
||||
run_test "scanbuild_make" scanbuild_make
|
||||
run_test "autobuild_generated_files_check" porcelain_check
|
||||
run_test "autobuild_header_dependency_check" header_dependency_check
|
||||
run_test "autobuild_make_install" $MAKE $MAKEFLAGS install DESTDIR=/tmp/spdk prefix=/usr
|
||||
run_test "autobuild_make_install" $MAKE $MAKEFLAGS install DESTDIR="$SPDK_WORKSPACE" prefix=/usr
|
||||
run_test "autobuild_make_uninstall" test_make_uninstall
|
||||
run_test "autobuild_build_doc" build_doc
|
||||
}
|
||||
|
@ -226,6 +226,8 @@ class Initiator(Server):
|
||||
|
||||
self.ip = ip
|
||||
self.spdk_dir = workspace
|
||||
if os.getenv('SPDK_WORKSPACE'):
|
||||
self.spdk_dir = os.getenv('SPDK_WORKSPACE')
|
||||
self.fio_bin = fio_bin
|
||||
self.cpus_allowed = cpus_allowed
|
||||
self.cpus_allowed_policy = cpus_allowed_policy
|
||||
|
Loading…
Reference in New Issue
Block a user