mirror of
https://git.proxmox.com/git/mirror_zfs
synced 2025-04-28 13:20:02 +00:00
ZTS: make uses of mktemp consistent
In all cases, rely on mktemp itself to make the best decision about where to place the file or directory. In all cases, that decision will be $TMPDIR, which we have set globally. 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
60031906b4
commit
72c0fde609
@ -130,7 +130,7 @@ function test_posix_mode # base
|
||||
}
|
||||
|
||||
# Sanity check on tmpfs first
|
||||
tmpdir=$(TMPDIR=$TEST_BASE_DIR mktemp -d)
|
||||
tmpdir=$(mktemp -d)
|
||||
log_must mount -t tmpfs tmp $tmpdir
|
||||
log_must chmod 777 $tmpdir
|
||||
|
||||
|
@ -40,8 +40,8 @@
|
||||
# dbufstat and the dbufs kstat output
|
||||
#
|
||||
|
||||
DBUFSTATS_FILE=$(mktemp $TEST_BASE_DIR/dbufstats.out.XXXXXX)
|
||||
DBUFS_FILE=$(mktemp $TEST_BASE_DIR/dbufs.out.XXXXXX)
|
||||
DBUFSTATS_FILE=$(mktemp -t dbufstats.out.XXXXXX)
|
||||
DBUFS_FILE=$(mktemp -t dbufs.out.XXXXXX)
|
||||
|
||||
function cleanup
|
||||
{
|
||||
|
@ -42,7 +42,7 @@
|
||||
# 8. Ensure that at least some dbufs moved to the mfu list in the ARC
|
||||
#
|
||||
|
||||
DBUFS_FILE=$(mktemp $TEST_BASE_DIR/dbufs.out.XXXXXX)
|
||||
DBUFS_FILE=$(mktemp -t dbufs.out.XXXXXX)
|
||||
|
||||
function cleanup
|
||||
{
|
||||
|
@ -48,8 +48,8 @@ function cleanup
|
||||
|
||||
log_assert "Verify that 'zfs send' drills appropriate holes"
|
||||
log_onexit cleanup
|
||||
streamfile=$(mktemp $TESTDIR/file.XXXXXX)
|
||||
vdev=$(mktemp $TEST_BASE_DIR/file.XXXXXX)
|
||||
streamfile=$(mktemp)
|
||||
vdev=$(mktemp)
|
||||
|
||||
|
||||
function test_pool
|
||||
|
@ -160,7 +160,7 @@ while (( i < ${#pools[*]} )); do
|
||||
((i = i + 1))
|
||||
done
|
||||
|
||||
VDEV_FILE=$(mktemp $TEST_BASE_DIR/tmp.XXXXXX)
|
||||
VDEV_FILE=$(mktemp)
|
||||
|
||||
log_must mkfile -n 128M $VDEV_FILE
|
||||
log_must zpool create overflow $VDEV_FILE
|
||||
|
@ -28,7 +28,7 @@ typeset ds_name="panic"
|
||||
typeset sendfs="$POOL/$ds_name"
|
||||
typeset recvfs="$POOL2/$ds_name"
|
||||
typeset clone="$POOL/${ds_name}_clone"
|
||||
typeset stream=$(mktemp $TEST_BASE_DIR/stream.XXXX)
|
||||
typeset stream=$(mktemp -t stream.XXXX)
|
||||
|
||||
function cleanup
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ function cleanup
|
||||
log_assert "Verify an archive of a file system is identical to " \
|
||||
"an archive of its snapshot."
|
||||
|
||||
SNAPSHOT_TARDIR="$(mktemp -d /tmp/zfstests_snapshot_002.XXXXXX)"
|
||||
SNAPSHOT_TARDIR="$(mktemp -t -d zfstests_snapshot_002.XXXXXX)"
|
||||
log_onexit cleanup
|
||||
|
||||
typeset -i COUNT=21
|
||||
|
@ -72,7 +72,7 @@ function cleanup
|
||||
log_assert "Verify that an archive of a dataset is identical to " \
|
||||
"an archive of the dataset's snapshot."
|
||||
|
||||
SNAPSHOT_TARDIR="$(mktemp -d /tmp/zfstests_snapshot_006.XXXXXX)"
|
||||
SNAPSHOT_TARDIR="$(mktemp -t -d zfstests_snapshot_006.XXXXXX)"
|
||||
log_onexit cleanup
|
||||
|
||||
typeset -i COUNT=21
|
||||
|
@ -58,7 +58,7 @@ log_onexit user_ns_cleanup
|
||||
log_must zfs create -o zoned=on "$TESTPOOL/userns"
|
||||
|
||||
# 1. Try to pass a non-namespace file to zfs zone.
|
||||
temp_file="$(TMPDIR=$TEST_BASE_DIR mktemp)"
|
||||
temp_file="$(mktemp)"
|
||||
log_mustnot zfs zone "$temp_file" "$TESTPOOL/userns"
|
||||
|
||||
# 2. Try to pass a non-namespace and non-existent file to zfs zone.
|
||||
|
@ -47,8 +47,8 @@ if ! is_linux ; then
|
||||
log_unsupported "Only linux supports dd with oflag=dsync for FUA writes"
|
||||
fi
|
||||
|
||||
typeset datafile1="$(mktemp zvol_misc_fua1.XXXXXX)"
|
||||
typeset datafile2="$(mktemp zvol_misc_fua2.XXXXXX)"
|
||||
typeset datafile1="$(mktemp -t zvol_misc_fua1.XXXXXX)"
|
||||
typeset datafile2="$(mktemp -t zvol_misc_fua2.XXXXXX)"
|
||||
typeset zvolpath=${ZVOL_DEVDIR}/$TESTPOOL/$TESTVOL
|
||||
|
||||
function cleanup
|
||||
|
@ -65,8 +65,8 @@ if ! is_physical_device $DISKS; then
|
||||
log_unsupported "This directory cannot be run on raw files."
|
||||
fi
|
||||
|
||||
typeset datafile1="$(mktemp zvol_misc_flags1.XXXXXX)"
|
||||
typeset datafile2="$(mktemp zvol_misc_flags2.XXXXXX)"
|
||||
typeset datafile1="$(mktemp -t zvol_misc_flags1.XXXXXX)"
|
||||
typeset datafile2="$(mktemp -t zvol_misc_flags2.XXXXXX)"
|
||||
typeset zvolpath=${ZVOL_DEVDIR}/$TESTPOOL/$TESTVOL
|
||||
|
||||
function cleanup
|
||||
|
@ -57,7 +57,7 @@ biggest_zvol_size_possible=$(largest_volsize_from_pool $TESTPOOL)
|
||||
typeset -f each_zvol_size=$(( floor($biggest_zvol_size_possible * 0.9 / \
|
||||
$num_zvols )))
|
||||
|
||||
typeset tmpdir="$(mktemp -d zvol_stress_fio_state.XXXXXX)"
|
||||
typeset tmpdir="$(mktemp -t -d zvol_stress_fio_state.XXXXXX)"
|
||||
|
||||
function create_zvols
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user