mirror of
https://git.proxmox.com/git/mirror_zfs
synced 2025-04-28 11:40:17 +00:00
ZTS: replace all uses of /var/tmp with TEST_BASE_DIR
The operator can override TEST_BASE_DIR by setting its source var FILEDIR through zfs-tests.sh -d. There were a handful of cases where this was not honoured. By default FILEDIR (and so TEST_BASE_DIR) is /var/tmp, so there should be no functional change if the operator does nothing. Sponsored-by: https://despairlabs.com/sponsor/ Signed-off-by: Rob Norris <robn@despairlabs.com> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de> Reviewed-by: Igor Kozhukhov <igor@dilos.org>
This commit is contained in:
parent
f65fc98a8c
commit
4afec534cc
@ -184,7 +184,7 @@ Linux)
|
||||
DEV_RDSKDIR="/dev"
|
||||
DEV_MPATHDIR="/dev/mapper"
|
||||
|
||||
ZEDLET_DIR="/var/tmp/zed"
|
||||
ZEDLET_DIR="$TEST_BASE_DIR/zed"
|
||||
ZED_LOG="$ZEDLET_DIR/zed.log"
|
||||
ZED_DEBUG_LOG="$ZEDLET_DIR/zed.debug.log"
|
||||
VDEVID_CONF="$ZEDLET_DIR/vdev_id.conf"
|
||||
|
@ -915,7 +915,7 @@ function set_partition
|
||||
log_fail "The slice, size or disk name is unspecified."
|
||||
fi
|
||||
|
||||
typeset format_file=/var/tmp/format_in.$$
|
||||
typeset format_file="$TEST_BASE_DIR"/format_in.$$
|
||||
|
||||
echo "partition" >$format_file
|
||||
echo "$slicenum" >> $format_file
|
||||
@ -2404,7 +2404,7 @@ function add_user #<group_name> <user_name> <basedir>
|
||||
{
|
||||
typeset group=$1
|
||||
typeset user=$2
|
||||
typeset basedir=${3:-"/var/tmp"}
|
||||
typeset basedir=${3:-"$TEST_BASE_DIR"}
|
||||
|
||||
if ((${#group} == 0 || ${#user} == 0)); then
|
||||
log_fail "group name or user name are not defined."
|
||||
@ -2434,7 +2434,7 @@ function add_user #<group_name> <user_name> <basedir>
|
||||
function del_user #<logname> <basedir>
|
||||
{
|
||||
typeset user=$1
|
||||
typeset basedir=${2:-"/var/tmp"}
|
||||
typeset basedir=${2:-"$TEST_BASE_DIR"}
|
||||
|
||||
if ((${#user} == 0)); then
|
||||
log_fail "login name is necessary."
|
||||
@ -3184,7 +3184,7 @@ function zed_start
|
||||
return
|
||||
fi
|
||||
|
||||
# ZEDLET_DIR=/var/tmp/zed
|
||||
# ZEDLET_DIR=$TEST_BASE_DIR/zed
|
||||
if [[ ! -d $ZEDLET_DIR ]]; then
|
||||
log_must mkdir $ZEDLET_DIR
|
||||
fi
|
||||
|
@ -29,9 +29,9 @@
|
||||
# home directory.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Change HOME to /var/tmp
|
||||
# 1. Change HOME to /var/tmp (TEST_BASE_DIR)
|
||||
# 2. Make a simple script that echoes a key value pair
|
||||
# in /var/tmp/.zpool.d
|
||||
# in $HOME/.zpool.d
|
||||
# 3. Make sure it can be run with -c
|
||||
# 4. Remove the script we created
|
||||
|
||||
|
@ -29,9 +29,9 @@
|
||||
# home directory.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Change HOME to /var/tmp
|
||||
# 1. Change HOME to /var/tmp (TEST_BASE_DIR)
|
||||
# 2. Make a simple script that echoes a key value pair
|
||||
# in /var/tmp/.zpool.d
|
||||
# in $HOME/.zpool.d
|
||||
# 3. Make sure it can be run with -c
|
||||
# 4. Remove the script we created
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
# 1. Create a pool
|
||||
# 2. Create a zvol volume
|
||||
# 3. Use zvol as swap space
|
||||
# 4. Create a file under /var/tmp
|
||||
# 4. Create a file under /var/tmp (TEST_BASE_DIR)
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
@ -63,11 +63,11 @@ voldev=${ZVOL_DEVDIR}/$TESTPOOL/$TESTVOL
|
||||
log_note "Add zvol volume as swap space"
|
||||
log_must swap_setup $voldev
|
||||
|
||||
log_note "Create a file under /var/tmp"
|
||||
log_note "Create a file under $TEST_BASE_DIR"
|
||||
log_must file_write -o create -f $TEMPFILE \
|
||||
-b $BLOCKSZ -c $NUM_WRITES -d $DATA
|
||||
|
||||
[[ ! -f $TEMPFILE ]] && log_fail "Unable to create file under /var/tmp"
|
||||
[[ ! -f $TEMPFILE ]] && log_fail "Unable to create file under $TEST_BASE_DIR"
|
||||
|
||||
filesize=`ls -l $TEMPFILE | awk '{print $5}'`
|
||||
tf_size=$(( BLOCKSZ * NUM_WRITES ))
|
||||
|
@ -39,7 +39,7 @@
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create a new zvol and add it as swap
|
||||
# 2. Fill //var/tmp with 80% the size of the zvol
|
||||
# 2. Fill //var/tmp (TEST_BASE_DIR) with 80% the size of the zvol
|
||||
# 5. Remove the new zvol, and restore original swap devices
|
||||
#
|
||||
|
||||
@ -54,7 +54,7 @@ function cleanup
|
||||
fi
|
||||
}
|
||||
|
||||
log_assert "Using a zvol as swap space, fill /var/tmp to 80%."
|
||||
log_assert "Using a zvol as swap space, fill $TEST_BASE_DIR to 80%."
|
||||
|
||||
log_onexit cleanup
|
||||
|
||||
@ -73,4 +73,4 @@ log_must dd if=/dev/urandom of=$TEMPFILE bs=1048576 count=$count
|
||||
log_must rm -f $TEMPFILE
|
||||
log_must swap_cleanup $swapdev
|
||||
|
||||
log_pass "Using a zvol as swap space, fill /var/tmp to 80%."
|
||||
log_pass "Using a zvol as swap space, fill $TEST_BASE_DIR to 80%."
|
||||
|
Loading…
Reference in New Issue
Block a user