test/common: Use mktemp() to determine fallback test storage
Using hardcoded path of /tmp/spdk was a bit problematic due to the
way how CI mixes root permissions with non-root's during test
execution. As an example, see:
https://review.spdk.io/gerrit/c/spdk/spdk/+/2560
Instead of using /tmp/spdk as a fallback, always try to create tmp
directory by generating its path via mktemp(). This way, as with
"autobuild: Use mktemp() for spdk workspace (ae730042
)", different
permissions shouldn't be an issue anymore.
Lingering tmp directories will be purge at each set_test_storage()
run.
Change-Id: I93bc60c97b68e66606e98fc83463074fc020e372
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3238
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
2ba684aa20
commit
9aeaafa1bc
@ -258,8 +258,17 @@ function set_test_storage() {
|
||||
local source fs size avail mount use
|
||||
|
||||
local storage_fallback storage_candidates
|
||||
local storage_fallback_purge
|
||||
|
||||
storage_fallback=/tmp/spdk
|
||||
storage_fallback_purge=("${TMPDIR:-/tmp}/spdk."??????)
|
||||
|
||||
if ((${#storage_fallback_purge[@]} > 0)); then
|
||||
printf '* Purging old temporary test storage (%s)\n' \
|
||||
"${storage_fallback_purge[*]}" >&2
|
||||
rm -rf "${storage_fallback_purge[@]}"
|
||||
fi
|
||||
|
||||
storage_fallback=$(mktemp -udt spdk.XXXXXX)
|
||||
storage_candidates=(
|
||||
"$testdir"
|
||||
"$storage_fallback/tests/${testdir##*/}"
|
||||
|
Loading…
Reference in New Issue
Block a user