diff options
author | bernie1995 <[email protected]> | 2018-08-30 22:46:55 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-08-30 13:46:55 -0700 |
commit | 0fe7c953b38a39278ea44c5c0782fa295d51fa54 (patch) | |
tree | dafeda016c7e23799dee2005f5ef43c5468f11fe /tests | |
parent | 6c6949acae06dc9a31db2e375f13eb7f357651b6 (diff) |
ZTS: path cleanup
Removing hardcoded paths in many scripts.
Reviewed-by: George Melikov <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: bernie1995 <[email protected]>
Issue #7507
Closes #7843
Diffstat (limited to 'tests')
62 files changed, 180 insertions, 164 deletions
diff --git a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_002_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_002_pos.ksh index 6d3e3ab45..ec7e1dcab 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_002_pos.ksh @@ -32,7 +32,7 @@ log_assert "Verify zdb accurately counts feature refcounts." log_onexit cleanup typeset errstr="feature refcount mismatch" -typeset tmpfile="/var/tmp/zdb-feature-mismatch" +typeset tmpfile="$TEST_BASE_DIR/zdb-feature-mismatch" function cleanup { datasetexists $TESTPOOL && destroy_pool $TESTPOOL diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_004_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_004_pos.ksh index f57628c16..b038e7484 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_004_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_004_pos.ksh @@ -156,7 +156,7 @@ done typeset -i fspropnum=27 typeset -i snappropnum=8 typeset -i volpropnum=15 -propfile=/var/tmp/allpropfile.$$ +propfile=$TEST_BASE_DIR/allpropfile.$$ typeset -i i=0 typeset -i propnum=0 diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/receive-o-x_props_override.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/receive-o-x_props_override.ksh index 14d503c51..6a0152e81 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/receive-o-x_props_override.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/receive-o-x_props_override.ksh @@ -41,8 +41,8 @@ function cleanup log_must rm -f $streamfile_incr log_must rm -f $streamfile_repl log_must rm -f $streamfile_trun - log_must zfs destroy -r -f $orig - log_must zfs destroy -r -f $dest + destroy_dataset "$orig" "-rf" + destroy_dataset "$dest" "-rf" } log_assert "ZFS receive property override and exclude options work as expected." diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_001_pos.ksh index 96cc0aae8..5ce0e02fa 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_001_pos.ksh @@ -76,7 +76,7 @@ log_assert "Verifying 'zfs receive [<filesystem|snapshot>] -d <filesystem>' work log_onexit cleanup typeset datasets="$TESTPOOL/$TESTFS $TESTPOOL" -set -A bkup "/var/tmp/fullbkup" "/var/tmp/incbkup" +set -A bkup "$TEST_BASE_DIR/fullbkup" "$TEST_BASE_DIR/incbkup" orig_sum="" rst_sum="" rst_root=$TESTPOOL/rst_ctr diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_002_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_002_pos.ksh index e33112ea1..36af37a75 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_002_pos.ksh @@ -70,7 +70,7 @@ log_assert "Verifying 'zfs receive <volume>' works." log_onexit cleanup set -A orig_snap "$TESTPOOL/$TESTVOL@init_snap" "$TESTPOOL/$TESTVOL@inc_snap" -set -A bkup "/var/tmp/fullbkup" "/var/tmp/incbkup" +set -A bkup "$TEST_BASE_DIR/fullbkup" "$TEST_BASE_DIR/incbkup" rst_root=$TESTPOOL/rst_ctr rst_vol=$rst_root/$TESTVOL set -A rst_snap "${rst_vol}@init_snap" "${rst_vol}@inc_snap" diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_003_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_003_pos.ksh index a6935acc7..d5f6e0984 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_003_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_003_pos.ksh @@ -59,7 +59,7 @@ function cleanup log_assert "'zfs recv -F' to force rollback." log_onexit cleanup -ibackup=/var/tmp/ibackup.$$ +ibackup=$TEST_BASE_DIR/ibackup.$$ fs=$TESTPOOL/$TESTFS; snap1=$fs@snap1; snap2=$fs@snap2 mntpnt=$(get_prop mountpoint $fs) || log_fail "get_prop mountpoint $fs" diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_004_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_004_neg.ksh index ad73c585a..fcbdc5e15 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_004_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_004_neg.ksh @@ -64,13 +64,13 @@ log_onexit cleanup init_snap=$TESTPOOL/$TESTFS@initsnap inc_snap=$TESTPOOL/$TESTFS@incsnap -full_bkup=/var/tmp/full_bkup.$$ -inc_bkup=/var/tmp/inc_bkup.$$ +full_bkup=$TEST_BASE_DIR/full_bkup.$$ +inc_bkup=$TEST_BASE_DIR/inc_bkup.$$ init_topsnap=$TESTPOOL@initsnap inc_topsnap=$TESTPOOL@incsnap -full_topbkup=/var/tmp/full_topbkup.$$ -inc_topbkup=/var/tmp/inc_topbkup.$$ +full_topbkup=$TEST_BASE_DIR/full_topbkup.$$ +inc_topbkup=$TEST_BASE_DIR/inc_topbkup.$$ log_must zfs snapshot $init_topsnap log_must eval "zfs send $init_topsnap > $full_topbkup" diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_005_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_005_neg.ksh index 17d9be911..4cbc7e339 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_005_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_005_neg.ksh @@ -74,8 +74,8 @@ inc_snap=$TESTPOOL/$TESTFS@incsnap rst_root=$TESTPOOL/rst_ctr rst_init_snap=$rst_root/$TESTFS@init_snap rst_inc_snap=$rst_root/$TESTFS@inc_snap -full_bkup=/var/tmp/full_bkup.$$ -inc_bkup=/var/tmp/inc_bkup.$$ +full_bkup=$TEST_BASE_DIR/full_bkup.$$ +inc_bkup=$TEST_BASE_DIR/inc_bkup.$$ log_must zfs create $rst_root log_must zfs snapshot $init_snap diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_006_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_006_pos.ksh index eeeea4e9b..7338fd2b9 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_006_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_006_pos.ksh @@ -75,8 +75,8 @@ ancestor_fs=$TESTPOOL/$TESTFS fs=$TESTPOOL/$TESTFS/$TESTFS1 snap1=$fs@snap1 snap2=$fs@snap2 -fbackup1=/var/tmp/fbackup1.$$ -fbackup2=/var/tmp/fbackup2.$$ +fbackup1=$TEST_BASE_DIR/fbackup1.$$ +fbackup2=$TEST_BASE_DIR/fbackup2.$$ datasetexists $ancestor_fs || \ log_must zfs create $ancestor_fs diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_007_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_007_neg.ksh index b7b92800d..57454dcbc 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_007_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_007_neg.ksh @@ -60,7 +60,7 @@ log_onexit cleanup fs=$TESTPOOL/$TESTFS snap1=$fs@snap1 snap2=$fs@snap2 -ibackup=/var/tmp/ibackup.$$ +ibackup=$TEST_BASE_DIR/ibackup.$$ datasetexists $fs || log_must zfs create $fs diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_008_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_008_pos.ksh index 82fceeab2..1729b59b2 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_008_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_008_pos.ksh @@ -73,8 +73,8 @@ log_onexit cleanup typeset datasets="$TESTPOOL/$TESTFS $TESTPOOL" typeset rst_fs=$TESTPOOL/$TESTFS/$TESTFS -typeset fbackup=/var/tmp/fbackup.$$ -typeset tmp_out=/var/tmp/tmpout.$$ +typeset fbackup=$TEST_BASE_DIR/fbackup.$$ +typeset tmp_out=$TEST_BASE_DIR/tmpout.$$ for orig_fs in $datasets ; do typeset rst_snap=$rst_fs@snap diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_011_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_011_pos.ksh index 6e312d8ea..afae804a1 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_011_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_011_pos.ksh @@ -43,7 +43,7 @@ verify_runnable "both" -typeset streamfile=/var/tmp/streamfile.$$ +typeset streamfile=$TEST_BASE_DIR/streamfile.$$ function cleanup { diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_012_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_012_pos.ksh index 70afe419f..4e72a66d4 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_012_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_012_pos.ksh @@ -40,7 +40,7 @@ verify_runnable "both" -typeset streamfile=/var/tmp/streamfile.$$ +typeset streamfile=$TEST_BASE_DIR/streamfile.$$ function cleanup { diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_013_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_013_pos.ksh index 9879282ea..5d7a7043b 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_013_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_013_pos.ksh @@ -33,8 +33,8 @@ src_fs=$TESTPOOL/drecvsrc temppool=recvtank dst_fs=$temppool/drecvdest -streamfile=/var/tmp/drecvstream.$$ -tpoolfile=/temptank.$$ +streamfile=$TEST_BASE_DIR/drecvstream.$$ +tpoolfile=$TEST_BASE_DIR/temptank.$$ function cleanup { diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_015_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_015_pos.ksh index b540ead5a..ead3c4311 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_015_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_015_pos.ksh @@ -36,8 +36,8 @@ verify_runnable "both" -typeset streamfile_full=/var/tmp/streamfile_full.$$ -typeset streamfile_incr=/var/tmp/streamfile_incr.$$ +typeset streamfile_full=$TEST_BASE_DIR/streamfile_full.$$ +typeset streamfile_incr=$TEST_BASE_DIR/streamfile_incr.$$ orig=$TESTPOOL/$TESTFS1 dest=$TESTPOOL/$TESTFS2 typeset user_prop=$(valid_user_property 8) diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_001_pos.ksh index f28ce06fd..b0a319d41 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_001_pos.ksh @@ -74,7 +74,7 @@ log_onexit cleanup init_snap=$TESTPOOL/$TESTFS@init_snap inc_snap=$TESTPOOL/$TESTFS@inc_snap -full_bkup=/var/tmp/fullbkup.$$ +full_bkup=$TEST_BASE_DIR/fullbkup.$$ inc_bkup=/var/tmp/incbkup.$$ init_data=$TESTDIR/$TESTFILE1 inc_data=$TESTDIR/$TESTFILE2 diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_002_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_002_pos.ksh index 0c21e4175..6359bb4f7 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_002_pos.ksh @@ -116,7 +116,7 @@ origfile=$TESTDIR/$TESTFILE1 rstfile=/$rstfs/$TESTFILE1 origsnapfile=$TESTDIR/$snapdir/$TESTFILE1 rstsnapfile=/$rstfs/$snapdir/$TESTFILE1 -stream=/var/tmp/streamfile.$$ +stream=$TEST_BASE_DIR/streamfile.$$ set -A props "compression" "checksum" "recordsize" set -A propval "on lzjb" "on fletcher2 fletcher4 sha256" \ diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_set/zfs_set_003_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_set/zfs_set_003_neg.ksh index 16bb38802..102e88742 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_set/zfs_set_003_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_set/zfs_set_003_neg.ksh @@ -33,7 +33,7 @@ # # DESCRIPTION: -# 'zfs set mountpoint/sharenfs' should fail when the mountpoint is invlid +# 'zfs set mountpoint/sharenfs' should fail when the mountpoint is invalid # # STRATEGY: # 1. Create invalid scenarios @@ -56,7 +56,7 @@ function cleanup log_assert "'zfs set mountpoint/sharenfs' fails with invalid scenarios" log_onexit cleanup -badpath=/tmp/foo1.$$ +badpath=$TEST_BASE_DIR/foo1.$$ touch $badpath longpath=$(gen_dataset_name 1030 "abcdefg") diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_001_pos.ksh index f23ad6e5e..e37b4f81a 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_001_pos.ksh @@ -66,8 +66,8 @@ log_assert "Executing 'zfs upgrade' command succeeds." log_onexit cleanup rootfs=$TESTPOOL/$TESTFS -typeset output=/tmp/zfs-versions.$$ -typeset oldoutput=/tmp/zfs-versions-old.$$ +typeset output=$TEST_BASE_DIR/zfs-versions.$$ +typeset oldoutput=$TEST_BASE_DIR/zfs-versions-old.$$ typeset expect_str1="This system is currently running ZFS filesystem version" typeset expect_str2="All filesystems are formatted with the current version" typeset expect_str3="The following filesystems are out of date, and can be upgraded" diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_002_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_002_pos.ksh index dcddcc10a..ba6e7c483 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_002_pos.ksh @@ -54,7 +54,7 @@ function cleanup log_assert "Executing 'zfs upgrade -v' command succeeds." log_onexit cleanup -typeset output=/tmp/zfs-versions.$$ +typeset output=$TEST_BASE_DIR/zfs-versions.$$ typeset expect_str1="Initial ZFS filesystem version" typeset expect_str2="Enhanced directory entries" diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_002_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_002_pos.ksh index d4abaa5ff..4cdc71123 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_002_pos.ksh @@ -99,7 +99,6 @@ export ZFS_ABORT=yes for subcmd in "${cmds[@]}" "${badparams[@]}"; do corefile=${corepath}/core.zpool zpool $subcmd >/dev/null 2>&1 - ls -l $corepath >>/tmp/CORE if [[ ! -e $corefile ]]; then log_fail "zpool $subcmd cannot generate core file with ZFS_ABORT set." fi diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add.kshlib b/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add.kshlib index 426565c09..f80a2a864 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add.kshlib +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add.kshlib @@ -42,10 +42,10 @@ function find_vfstab_dev if is_linux; then vfstab="/etc/fstab" - tmpfile="/tmp/fstab.tmp" + tmpfile="$TEST_BASE_DIR/fstab.tmp" else vfstab="/etc/vfstab" - tmpfile="/tmp/vfstab.tmp" + tmpfile="$TEST_BASE_DIR/vfstab.tmp" fi cat $vfstab | grep "^${DEV_DSKDIR}" >$tmpfile @@ -71,10 +71,10 @@ function find_mnttab_dev if is_linux; then typeset mnttab="/etc/mtab" - typeset tmpfile="/tmp/mtab.tmp" + typeset tmpfile="$TEST_BASE_DIR/mtab.tmp" else typeset mnttab="/etc/mnttab" - typeset tmpfile="/tmp/mnttab.tmp" + typeset tmpfile="$TEST_BASE_DIR/mnttab.tmp" fi cat $mnttab | grep "^${DEV_DSKDIR}" >$tmpfile diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_001_pos.ksh index df15da183..a0fc0eade 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_001_pos.ksh @@ -97,7 +97,6 @@ eval set -A mirrorarray $mirrordevs eval set -A raidzarray $raidzdevs while (( $i < ${#keywords[*]} )); do - echo "I=$i keyword=${keywords[i]}" >>/tmp/LOG case ${keywords[i]} in ""|spare) diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_003_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_003_pos.ksh index 1a10a0719..cfdc29d95 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_003_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_003_pos.ksh @@ -61,7 +61,7 @@ log_assert "'zpool add -n <pool> <vdev> ...' can display the configuration" \ log_onexit cleanup -tmpfile="/var/tmp/zpool_add_003.tmp$$" +tmpfile="$TEST_BASE_DIR/zpool_add_003.tmp$$" create_pool "$TESTPOOL" "${disk}${SLICE_PREFIX}${SLICE0}" log_must poolexists "$TESTPOOL" diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_clear/zpool_clear_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_clear/zpool_clear_001_pos.ksh index e53481932..0cd9b5959 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_clear/zpool_clear_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_clear/zpool_clear_001_pos.ksh @@ -85,7 +85,7 @@ function check_err # <pool> [<vdev>] typeset c_read=0 typeset c_write=0 typeset c_cksum=0 - typeset tmpfile=/var/tmp/file.$$ + typeset tmpfile=$TEST_BASE_DIR/file.$$ typeset healthstr="pool '$pool' is healthy" typeset output="`zpool status -x $pool`" diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.cfg b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.cfg index 93e0c38d3..d58cece04 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.cfg +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.cfg @@ -111,4 +111,4 @@ export TESTPOOL4=testpool4.create export TESTPOOL5=testpool5.create export TESTPOOL6=testpool6.create -export CPATH="/var/tmp/cachefile.create" +export CPATH="$TEST_BASE_DIR/cachefile.create" diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.shlib b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.shlib index d65144369..9e6874832 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.shlib +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.shlib @@ -127,10 +127,10 @@ function find_vfstab_dev if is_linux; then vfstab="/etc/fstab" - tmpfile="/tmp/fstab.tmp" + tmpfile="$TEST_BASE_DIR/fstab.tmp" else vfstab="/etc/vfstab" - tmpfile="/tmp/vfstab.tmp" + tmpfile="$TEST_BASE_DIR/vfstab.tmp" fi cat $vfstab | grep "^${DEV_DSKDIR}" >$tmpfile diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_003_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_003_pos.ksh index 2438b127e..51ddced76 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_003_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_003_pos.ksh @@ -49,7 +49,7 @@ function cleanup [[ -e $tmpfile ]] && log_must rm -f $tmpfile } -tmpfile="/var/tmp/zpool_create_003.tmp$$" +tmpfile="$TEST_BASE_DIR/zpool_create_003.tmp$$" log_assert "'zpool create -n <pool> <vspec> ...' can display the configuration" \ "without actually creating the pool." diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_008_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_008_pos.ksh index df16da992..5c5c1d94d 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_008_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_008_pos.ksh @@ -89,7 +89,7 @@ function cleanup # function create_overlap_slice { - typeset format_file=/var/tmp/format_overlap.$$ + typeset format_file=$TEST_BASE_DIR/format_overlap.$$ typeset disk=$1 echo "partition" >$format_file diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_016_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_016_pos.ksh index 2314f4f69..3fca607b1 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_016_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_016_pos.ksh @@ -57,7 +57,7 @@ function cleanup fi #recover swap devices - FSTAB=/tmp/fstab_$$ + FSTAB=$TEST_BASE_DIR/fstab_$$ rm -f $FSTAB for sdisk in $swap_disks; do echo "$sdisk - - swap - no -" >> $FSTAB diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_020_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_020_pos.ksh index 49cedd85f..ae069606e 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_020_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_020_pos.ksh @@ -53,12 +53,15 @@ function cleanup then log_must rmdir /${TESTPOOL}.root fi + [[ -e $values ]] && log_must rm -f $values } log_onexit cleanup log_assert "zpool create -R works as expected" +typeset values=$TEST_BASE_DIR/values.$$ + if [[ -n $DISK ]]; then disk=$DISK else @@ -80,23 +83,23 @@ then fi log_must zpool get all $TESTPOOL -zpool get all $TESTPOOL > /tmp/values.$$ +zpool get all $TESTPOOL > $values # check for the cachefile property, verifying that it's set to 'none' -grep "$TESTPOOL[ ]*cachefile[ ]*none" /tmp/values.$$ > /dev/null 2>&1 +grep "$TESTPOOL[ ]*cachefile[ ]*none" $values > /dev/null 2>&1 if [ $? -ne 0 ] then log_fail "zpool property \'cachefile\' was not set to \'none\'." fi # check that the root = /mountpoint property is set correctly -grep "$TESTPOOL[ ]*altroot[ ]*/${TESTPOOL}.root" /tmp/values.$$ > /dev/null 2>&1 +grep "$TESTPOOL[ ]*altroot[ ]*/${TESTPOOL}.root" $values > /dev/null 2>&1 if [ $? -ne 0 ] then log_fail "zpool property root was not found in pool output." fi -rm /tmp/values.$$ +rm $values # finally, check that the pool has no reference in /etc/zfs/zpool.cache if [[ -f /etc/zfs/zpool.cache ]] ; then @@ -108,5 +111,4 @@ if [[ -f /etc/zfs/zpool.cache ]] ; then fi fi - log_pass "zpool create -R works as expected" diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_002_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_002_pos.ksh index 26f27a179..ba83fadb0 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_002_pos.ksh @@ -48,19 +48,25 @@ # default values are sane, or whether they can be changed with zpool set. # +function cleanup +{ + rm -f $values +} +log_onexit cleanup log_assert "Zpool get all works as expected" typeset -i i=0; +typeset values=$TEST_BASE_DIR/values.$$ if ! is_global_zone ; then TESTPOOL=${TESTPOOL%%/*} fi log_must zpool get all $TESTPOOL -zpool get all $TESTPOOL > /tmp/values.$$ +zpool get all $TESTPOOL > $values log_note "Checking zpool get all output for a header." -grep ^"NAME " /tmp/values.$$ > /dev/null 2>&1 +grep ^"NAME " $values > /dev/null 2>&1 if [ $? -ne 0 ] then log_fail "The header was not printed from zpool get all" @@ -70,7 +76,7 @@ fi while [ $i -lt "${#properties[@]}" ] do log_note "Checking for ${properties[$i]} property" - grep "$TESTPOOL *${properties[$i]}" /tmp/values.$$ > /dev/null 2>&1 + grep "$TESTPOOL *${properties[$i]}" $values > /dev/null 2>&1 if [ $? -ne 0 ] then log_fail "zpool property ${properties[$i]} was not found\ @@ -82,13 +88,10 @@ done # increment the counter to include the header line i=$(( $i + 1 )) -COUNT=$(wc /tmp/values.$$ | awk '{print $1}') +COUNT=$(wc $values | awk '{print $1}') if [ $i -ne $COUNT ] then log_fail "Found zpool features not in the zpool_get test config $i/$COUNT." fi - - -rm /tmp/values.$$ log_pass "Zpool get all works as expected" diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_003_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_003_pos.ksh index 815786ad7..89fca9cbd 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_003_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_003_pos.ksh @@ -41,24 +41,31 @@ # 1. For all properties, verify zpool get retrieves a value # +function cleanup +{ + rm -f $values +} + log_assert "Zpool get returns values for all known properties" +log_onexit cleanup if ! is_global_zone ; then TESTPOOL=${TESTPOOL%%/*} fi typeset -i i=0; +typeset values=$TEST_BASE_DIR/values.$$ while [ $i -lt "${#properties[@]}" ] do log_note "Checking for ${properties[$i]} property" - log_must eval "zpool get ${properties[$i]} $TESTPOOL > /tmp/value.$$" - grep "${properties[$i]}" /tmp/value.$$ > /dev/null 2>&1 + log_must eval "zpool get ${properties[$i]} $TESTPOOL > $values" + grep "${properties[$i]}" $values > /dev/null 2>&1 if [ $? -ne 0 ] then log_fail "${properties[$i]} not seen in output" fi - grep "^NAME " /tmp/value.$$ > /dev/null 2>&1 + grep "^NAME " $values > /dev/null 2>&1 # only need to check this once. if [ $i -eq 0 ] && [ $? -ne 0 ] then @@ -67,5 +74,4 @@ do i=$(( $i + 1 )) done -rm /tmp/value.$$ log_pass "Zpool get returns values for all known properties" diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/zpool_upgrade_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/zpool_upgrade_001_pos.ksh index 45d143758..b49c19c55 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/zpool_upgrade_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/zpool_upgrade_001_pos.ksh @@ -45,7 +45,15 @@ verify_runnable "global" +function cleanup +{ + rm -f $versions +} + log_assert "Executing 'zpool upgrade -v' command succeeds" +log_onexit cleanup + +typeset versions=$TEST_BASE_DIR/zpool-versions.$$ log_must zpool upgrade -v @@ -54,7 +62,7 @@ log_must zpool upgrade -v log_must eval "zpool upgrade -v | head -1 | grep 'feature flags'" -zpool upgrade -v > /tmp/zpool-versions.$$ +zpool upgrade -v > $versions # # Current output for 'zpool upgrade -v' has different indent space @@ -64,8 +72,7 @@ zpool upgrade -v > /tmp/zpool-versions.$$ # for version in {1..28}; do log_note "Checking for a description of pool version $version" - log_must eval "awk '/^ $version / { print $1 }' /tmp/zpool-versions.$$ | grep $version" + log_must eval "awk '/^ $version / { print $1 }' $versions | grep $version" done -rm /tmp/zpool-versions.$$ log_pass "Executing 'zpool upgrade -v' command succeeds" diff --git a/tests/zfs-tests/tests/functional/cli_user/misc/cleanup.ksh b/tests/zfs-tests/tests/functional/cli_user/misc/cleanup.ksh index 4319a639e..874a9fd2d 100755 --- a/tests/zfs-tests/tests/functional/cli_user/misc/cleanup.ksh +++ b/tests/zfs-tests/tests/functional/cli_user/misc/cleanup.ksh @@ -42,9 +42,9 @@ then log_must zpool destroy v1-pool fi -if [[ -f /tmp/zfstest_datastream.dat ]] +if [[ -f $TEST_BASE_DIR/zfstest_datastream.dat ]] then - log_must rm -f /tmp/zfstest_datastream.dat + log_must rm -f $TEST_BASE_DIR/zfstest_datastream.dat fi default_cleanup diff --git a/tests/zfs-tests/tests/functional/cli_user/misc/setup.ksh b/tests/zfs-tests/tests/functional/cli_user/misc/setup.ksh index 690d22209..1ef25e4dc 100755 --- a/tests/zfs-tests/tests/functional/cli_user/misc/setup.ksh +++ b/tests/zfs-tests/tests/functional/cli_user/misc/setup.ksh @@ -69,12 +69,12 @@ log_must zfs unmount $TESTPOOL/$TESTFS/$TESTFS2.unmounted # send our snapshot to a known file in /tmp -zfs send $TESTPOOL/$TESTFS@snap > /tmp/zfstest_datastream.dat -if [ ! -s /tmp/zfstest_datastream.dat ] +zfs send $TESTPOOL/$TESTFS@snap > $TEST_BASE_DIR/zfstest_datastream.dat +if [ ! -s $TEST_BASE_DIR/zfstest_datastream.dat ] then log_fail "ZFS send datafile was not created!" fi -log_must chmod 644 /tmp/zfstest_datastream.dat +log_must chmod 644 $TEST_BASE_DIR/zfstest_datastream.dat # create a filesystem that has particular properties to test set/get diff --git a/tests/zfs-tests/tests/functional/cli_user/misc/zdb_001_neg.ksh b/tests/zfs-tests/tests/functional/cli_user/misc/zdb_001_neg.ksh index 583a65b4c..579ab1294 100755 --- a/tests/zfs-tests/tests/functional/cli_user/misc/zdb_001_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_user/misc/zdb_001_neg.ksh @@ -44,21 +44,21 @@ function check_zdb { - $@ > /tmp/zdb.$$ - grep "Dataset mos" /tmp/zdb.$$ + $@ > $TEST_BASE_DIR/zdb.$$ + grep "Dataset mos" $TEST_BASE_DIR/zdb.$$ if [ $? -eq 0 ] then log_fail "$@ exited 0 when run as a non root user!" fi - rm /tmp/zdb.$$ + rm $TEST_BASE_DIR/zdb.$$ } function cleanup { - if [ -e /tmp/zdb_001_neg.$$.txt ] + if [ -e $TEST_BASE_DIR/zdb_001_neg.$$.txt ] then - rm /tmp/zdb_001_neg.$$.txt + rm $TEST_BASE_DIR/zdb_001_neg.$$.txt fi } @@ -68,10 +68,10 @@ verify_runnable "global" log_assert "zdb can't run as a user on datasets, but can run without arguments" log_onexit cleanup -log_must eval "zdb > /tmp/zdb_001_neg.$$.txt" +log_must eval "zdb > $TEST_BASE_DIR/zdb_001_neg.$$.txt" # verify the output looks okay -log_must grep pool_guid /tmp/zdb_001_neg.$$.txt -log_must rm /tmp/zdb_001_neg.$$.txt +log_must grep pool_guid $TEST_BASE_DIR/zdb_001_neg.$$.txt +log_must rm $TEST_BASE_DIR/zdb_001_neg.$$.txt # we shouldn't able to run it on any dataset check_zdb zdb $TESTPOOL diff --git a/tests/zfs-tests/tests/functional/cli_user/misc/zfs_001_neg.ksh b/tests/zfs-tests/tests/functional/cli_user/misc/zfs_001_neg.ksh index b5c1fdeca..1073a4030 100755 --- a/tests/zfs-tests/tests/functional/cli_user/misc/zfs_001_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_user/misc/zfs_001_neg.ksh @@ -44,16 +44,16 @@ function cleanup { - if [ -e /tmp/zfs_001_neg.$$.txt ] + if [ -e $TEST_BASE_DIR/zfs_001_neg.$$.txt ] then - rm /tmp/zfs_001_neg.$$.txt + rm $TEST_BASE_DIR/zfs_001_neg.$$.txt fi } log_onexit cleanup log_assert "zfs shows a usage message when run as a user" -eval "zfs > /tmp/zfs_001_neg.$$.txt 2>&1" -log_must grep "usage: zfs command args" /tmp/zfs_001_neg.$$.txt +eval "zfs > $TEST_BASE_DIR/zfs_001_neg.$$.txt 2>&1" +log_must grep "usage: zfs command args" $TEST_BASE_DIR/zfs_001_neg.$$.txt log_pass "zfs shows a usage message when run as a user" diff --git a/tests/zfs-tests/tests/functional/cli_user/misc/zfs_receive_001_neg.ksh b/tests/zfs-tests/tests/functional/cli_user/misc/zfs_receive_001_neg.ksh index 4f7ddf2e7..38c11a051 100755 --- a/tests/zfs-tests/tests/functional/cli_user/misc/zfs_receive_001_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_user/misc/zfs_receive_001_neg.ksh @@ -46,7 +46,7 @@ log_assert "zfs receive returns an error when run as a user" log_mustnot eval "zfs receive -d $TESTPOOL/$TESTFS/$TESTFS2 \ - < /tmp/zfstest_datastream.dat" + < $TEST_BASE_DIR/zfstest_datastream.dat" # verify that command actually did nothing diff --git a/tests/zfs-tests/tests/functional/cli_user/misc/zfs_send_001_neg.ksh b/tests/zfs-tests/tests/functional/cli_user/misc/zfs_send_001_neg.ksh index d5dfe3728..6ecb66a35 100755 --- a/tests/zfs-tests/tests/functional/cli_user/misc/zfs_send_001_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_user/misc/zfs_send_001_neg.ksh @@ -45,23 +45,23 @@ function cleanup { - if [ -e /tmp/zfstest_datastream.$$ ] + if [ -e $TEST_BASE_DIR/zfstest_datastream.$$ ] then - log_must rm /tmp/zfstest_datastream.$$ + log_must rm $TEST_BASE_DIR/zfstest_datastream.$$ fi } log_assert "zfs send returns an error when run as a user" log_onexit cleanup -log_mustnot eval "zfs send $TESTPOOL/$TESTFS@snap > /tmp/zfstest_datastream.$$" +log_mustnot eval "zfs send $TESTPOOL/$TESTFS@snap > $TEST_BASE_DIR/zfstest_datastream.$$" # Now check that the above command actually did nothing # We should have a non-zero-length file in /tmp -if [ -s /tmp/zfstest_datastream.$$ ] +if [ -s $TEST_BASE_DIR/zfstest_datastream.$$ ] then - log_fail "A zfs send file was created in /tmp/zfstest_datastream.$$ !" + log_fail "A zfs send file was created in $TEST_BASE_DIR/zfstest_datastream.$$ !" fi log_pass "zfs send returns an error when run as a user" diff --git a/tests/zfs-tests/tests/functional/cli_user/misc/zpool_001_neg.ksh b/tests/zfs-tests/tests/functional/cli_user/misc/zpool_001_neg.ksh index d71668d89..af924837a 100755 --- a/tests/zfs-tests/tests/functional/cli_user/misc/zpool_001_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_user/misc/zpool_001_neg.ksh @@ -45,16 +45,16 @@ function cleanup { - if [ -e /tmp/zpool_001_neg.$$.txt ] + if [ -e $TEST_BASE_DIR/zpool_001_neg.$$.txt ] then - rm /tmp/zpool_001_neg.$$.txt + rm $TEST_BASE_DIR/zpool_001_neg.$$.txt fi } log_onexit cleanup log_assert "zpool shows a usage message when run as a user" -eval "zpool > /tmp/zpool_001_neg.$$.txt 2>&1" -log_must grep "usage: zpool command args" /tmp/zpool_001_neg.$$.txt +eval "zpool > $TEST_BASE_DIR/zpool_001_neg.$$.txt 2>&1" +log_must grep "usage: zpool command args" $TEST_BASE_DIR/zpool_001_neg.$$.txt log_pass "zpool shows a usage message when run as a user" diff --git a/tests/zfs-tests/tests/functional/cli_user/misc/zpool_status_001_neg.ksh b/tests/zfs-tests/tests/functional/cli_user/misc/zpool_status_001_neg.ksh index 7fe9fe55b..9cd811a54 100755 --- a/tests/zfs-tests/tests/functional/cli_user/misc/zpool_status_001_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_user/misc/zpool_status_001_neg.ksh @@ -45,28 +45,28 @@ function check_pool_status { - RESULT=$(grep "pool:" /tmp/pool-status.$$) + RESULT=$(grep "pool:" $TEST_BASE_DIR/pool-status.$$) if [ -z "$RESULT" ] then log_fail "No pool: string found in zpool status output!" fi - rm /tmp/pool-status.$$ + rm $TEST_BASE_DIR/pool-status.$$ } verify_runnable "global" log_assert "zpool status works when run as a user" -log_must eval "zpool status > /tmp/pool-status.$$" +log_must eval "zpool status > $TEST_BASE_DIR/pool-status.$$" check_pool_status -log_must eval "zpool status -v > /tmp/pool-status.$$" +log_must eval "zpool status -v > $TEST_BASE_DIR/pool-status.$$" check_pool_status -log_must eval "zpool status $TESTPOOL> /tmp/pool-status.$$" +log_must eval "zpool status $TESTPOOL> $TEST_BASE_DIR/pool-status.$$" check_pool_status -log_must eval "zpool status -v $TESTPOOL > /tmp/pool-status.$$" +log_must eval "zpool status -v $TESTPOOL > $TEST_BASE_DIR/pool-status.$$" check_pool_status log_pass "zpool status works when run as a user" diff --git a/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_003_pos.ksh b/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_003_pos.ksh index 3c27cbf32..43cfd0cf2 100755 --- a/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_003_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_003_pos.ksh @@ -54,7 +54,7 @@ log_onexit cleanup log_assert "Verify 'zfs list -r' could display any children recursively." -tmpfile=/var/tmp/zfslist.out.$$ +tmpfile=$TEST_BASE_DIR/zfslist.out.$$ children="$TESTPOOL/$TESTFS" for fs in $DATASETS ; do diff --git a/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/zpool_iostat_002_pos.ksh b/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/zpool_iostat_002_pos.ksh index c67031780..49be7d070 100755 --- a/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/zpool_iostat_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/zpool_iostat_002_pos.ksh @@ -43,7 +43,7 @@ verify_runnable "both" -typeset tmpfile=/var/tmp/zfsiostat.out.$$ +typeset tmpfile=$TEST_BASE_DIR/zfsiostat.out.$$ typeset -i stat_count=0 function cleanup diff --git a/tests/zfs-tests/tests/functional/history/history_001_pos.ksh b/tests/zfs-tests/tests/functional/history/history_001_pos.ksh index 80c0fb363..e22aaa33d 100755 --- a/tests/zfs-tests/tests/functional/history/history_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/history/history_001_pos.ksh @@ -111,7 +111,7 @@ done run_and_verify -p "$MPOOL" "zpool split $MPOOL ${MPOOL}_split" -import_dir=/var/tmp/import_dir.$$ +import_dir=$TEST_BASE_DIR/import_dir.$$ log_must mkdir $import_dir log_must cp $STF_SUITE/tests/functional/history/zfs-pool-v4.dat.Z $import_dir log_must uncompress $import_dir/zfs-pool-v4.dat.Z diff --git a/tests/zfs-tests/tests/functional/history/history_002_pos.ksh b/tests/zfs-tests/tests/functional/history/history_002_pos.ksh index af69668fb..553328745 100755 --- a/tests/zfs-tests/tests/functional/history/history_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/history/history_002_pos.ksh @@ -61,7 +61,7 @@ fs=$TESTPOOL/$TESTFS1; newfs=$TESTPOOL/newfs; fsclone=$TESTPOOL/clone vol=$TESTPOOL/$TESTVOL ; newvol=$TESTPOOL/newvol; volclone=$TESTPOOL/volclone fssnap=$fs@fssnap; fssnap2=$fs@fssnap2 volsnap=$vol@volsnap; volsnap2=$vol@volsnap2 -tmpfile=/tmp/tmpfile.$$ ; tmpfile2=/tmp/tmpfile2.$$ +tmpfile=$TEST_BASE_DIR/tmpfile.$$ ; tmpfile2=$TEST_BASE_DIR/tmpfile2.$$ if is_linux; then # property value property value diff --git a/tests/zfs-tests/tests/functional/history/history_003_pos.ksh b/tests/zfs-tests/tests/functional/history/history_003_pos.ksh index 3f6df99a0..4ecee3ba0 100755 --- a/tests/zfs-tests/tests/functional/history/history_003_pos.ksh +++ b/tests/zfs-tests/tests/functional/history/history_003_pos.ksh @@ -79,7 +79,7 @@ while ((i < 300)); do ((i += 1)) done -TMPFILE=/tmp/spool.$$ +TMPFILE=$TEST_BASE_DIR/spool.$$ zpool history $spool >$TMPFILE typeset -i entry_count=$(wc -l $TMPFILE | awk '{print $1}') typeset final_md5=$(head -2 $TMPFILE | md5sum | awk '{print $1}') diff --git a/tests/zfs-tests/tests/functional/kstat/state.ksh b/tests/zfs-tests/tests/functional/kstat/state.ksh index bf0b6e313..3c29266e5 100755 --- a/tests/zfs-tests/tests/functional/kstat/state.ksh +++ b/tests/zfs-tests/tests/functional/kstat/state.ksh @@ -125,7 +125,7 @@ ln $DEV_RDSKDIR/$SDISK $REALDISK log_must zpool create $TESTPOOL2 $REALDISK # Backup the contents of the disk image -BACKUP=/tmp/kstat-state-realdisk.gz +BACKUP=$TEST_BASE_DIR/kstat-state-realdisk.gz log_must [ ! -e $BACKUP ] gzip -c $REALDISK > $BACKUP diff --git a/tests/zfs-tests/tests/functional/mv_files/cleanup.ksh b/tests/zfs-tests/tests/functional/mv_files/cleanup.ksh index 13322cb30..a66443374 100755 --- a/tests/zfs-tests/tests/functional/mv_files/cleanup.ksh +++ b/tests/zfs-tests/tests/functional/mv_files/cleanup.ksh @@ -34,10 +34,10 @@ verify_runnable "global" -[[ -f /var/tmp/exitsZero.ksh ]] && \ - log_must rm -f /var/tmp/exitsZero.ksh -[[ -f /var/tmp/testbackgprocs.ksh ]] && \ - log_must rm -f /var/tmp/testbackgprocs.ksh +[[ -f $TEST_BASE_DIR/exitsZero.ksh ]] && \ + log_must rm -f $TEST_BASE_DIR/exitsZero.ksh +[[ -f $TEST_BASE_DIR/testbackgprocs.ksh ]] && \ + log_must rm -f $TEST_BASE_DIR/testbackgprocs.ksh ismounted $TESTPOOL/$TESTFS_TGT (( $? == 0 )) && log_must zfs umount $TESTPOOL/$TESTFS_TGT diff --git a/tests/zfs-tests/tests/functional/mv_files/mv_files_common.kshlib b/tests/zfs-tests/tests/functional/mv_files/mv_files_common.kshlib index 6728e950b..24b3fab38 100644 --- a/tests/zfs-tests/tests/functional/mv_files/mv_files_common.kshlib +++ b/tests/zfs-tests/tests/functional/mv_files/mv_files_common.kshlib @@ -37,11 +37,11 @@ # function check_bg_procs_limit_num { -echo "#!/bin/ksh" > /var/tmp/exitsZero.ksh -echo "exit 0" >> /var/tmp/exitsZero.ksh -chmod 777 /var/tmp/exitsZero.ksh +echo "#!/bin/ksh" > $TEST_BASE_DIR/exitsZero.ksh +echo "exit 0" >> $TEST_BASE_DIR/exitsZero.ksh +chmod 777 $TEST_BASE_DIR/exitsZero.ksh -cat <<EOF > /var/tmp/testbackgprocs.ksh +cat <<EOF > $TEST_BASE_DIR/testbackgprocs.ksh #!/bin/ksh # # exitsZero.ksh is a one line script @@ -52,7 +52,7 @@ PIDS="" typeset -i i=1 while [ \$i -le 50 ] do - /var/tmp/exitsZero.ksh & + $TEST_BASE_DIR/exitsZero.ksh & PIDS="\$PIDS \$!" (( i = i + 1 )) done @@ -67,7 +67,7 @@ done exit 0 EOF -ksh /var/tmp/testbackgprocs.ksh +ksh $TEST_BASE_DIR/testbackgprocs.ksh if [[ $? -eq 1 ]]; then # # Current ksh being executed has a limit diff --git a/tests/zfs-tests/tests/functional/nopwrite/nopwrite_recsize.ksh b/tests/zfs-tests/tests/functional/nopwrite/nopwrite_recsize.ksh index a3497c75f..14caedbf2 100755 --- a/tests/zfs-tests/tests/functional/nopwrite/nopwrite_recsize.ksh +++ b/tests/zfs-tests/tests/functional/nopwrite/nopwrite_recsize.ksh @@ -50,7 +50,7 @@ log_must zfs clone $origin@a $origin/clone for rs in 512 1024 2048 4096 8192 16384 32768 65536 131072 ; do log_must zfs set recsize=$rs $origin/clone dd if=/$TESTDIR/file of=/$TESTDIR/clone/file bs=1024k count=$MEGS \ - conv=notrunc >/tmp/null 2>&1 || log_fail "dd failed." + conv=notrunc > $TEST_BASE_DIR/null 2>&1 || log_fail "dd failed." log_must verify_nopwrite $origin $origin@a $origin/clone done diff --git a/tests/zfs-tests/tests/functional/redundancy/redundancy.cfg b/tests/zfs-tests/tests/functional/redundancy/redundancy.cfg index f49b7e76a..37b93820b 100644 --- a/tests/zfs-tests/tests/functional/redundancy/redundancy.cfg +++ b/tests/zfs-tests/tests/functional/redundancy/redundancy.cfg @@ -28,7 +28,7 @@ # Copyright (c) 2013, 2015 by Delphix. All rights reserved. # -export BASEDIR=/var/tmp/basedir.$$ +export BASEDIR=$TEST_BASE_DIR/basedir.$$ export TESTFILE=testfile.$$ export PRE_RECORD_FILE=$BASEDIR/pre-record-file.$$ diff --git a/tests/zfs-tests/tests/functional/rootpool/rootpool_002_neg.ksh b/tests/zfs-tests/tests/functional/rootpool/rootpool_002_neg.ksh index ece665776..32bacf753 100755 --- a/tests/zfs-tests/tests/functional/rootpool/rootpool_002_neg.ksh +++ b/tests/zfs-tests/tests/functional/rootpool/rootpool_002_neg.ksh @@ -48,7 +48,7 @@ verify_runnable "global" log_assert "zpool/zfs destroy <rootpool> should fail" typeset rootpool=$(get_rootpool) -typeset tmpfile="/tmp/mounted-datasets.$$" +typeset tmpfile="$TEST_BASE_DIR/mounted-datasets.$$" # Collect the currently mounted ZFS filesystems, so that we can repair any # damage done by the attempted pool destroy. The destroy itself should fail, diff --git a/tests/zfs-tests/tests/functional/upgrade/upgrade_common.kshlib b/tests/zfs-tests/tests/functional/upgrade/upgrade_common.kshlib index 2ff0cb7eb..679ff3049 100644 --- a/tests/zfs-tests/tests/functional/upgrade/upgrade_common.kshlib +++ b/tests/zfs-tests/tests/functional/upgrade/upgrade_common.kshlib @@ -30,7 +30,7 @@ . $STF_SUITE/include/libtest.shlib -export TMPDEV=/tmp/zpool_upgrade_test.dat +export TMPDEV=$TEST_BASE_DIR/zpool_upgrade_test.dat function cleanup_upgrade { diff --git a/tests/zfs-tests/tests/functional/userquota/userquota_002_pos.ksh b/tests/zfs-tests/tests/functional/userquota/userquota_002_pos.ksh index 64066ea8e..4e13691da 100755 --- a/tests/zfs-tests/tests/functional/userquota/userquota_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/userquota/userquota_002_pos.ksh @@ -59,7 +59,7 @@ log_onexit cleanup log_assert \ "the userquota and groupquota can be set during zpool,zfs creation" -typeset pool_vdev=/var/tmp/pool_dev.$$ +typeset pool_vdev=$TEST_BASE_DIR/pool_dev.$$ log_must mkfile 500m $pool_vdev diff --git a/tests/zfs-tests/tests/functional/xattr/cleanup.ksh b/tests/zfs-tests/tests/functional/xattr/cleanup.ksh index 5f0a84616..509090619 100755 --- a/tests/zfs-tests/tests/functional/xattr/cleanup.ksh +++ b/tests/zfs-tests/tests/functional/xattr/cleanup.ksh @@ -33,8 +33,8 @@ del_user $ZFS_USER del_group $ZFS_GROUP -USES_NIS=$(cat /tmp/zfs-xattr-test-nis.txt) -rm /tmp/zfs-xattr-test-nis.txt +USES_NIS=$(cat $TEST_BASE_DIR/zfs-xattr-test-nis.txt) +rm $TEST_BASE_DIR/zfs-xattr-test-nis.txt if [ "${USES_NIS}" == "true" ] then diff --git a/tests/zfs-tests/tests/functional/xattr/setup.ksh b/tests/zfs-tests/tests/functional/xattr/setup.ksh index 64f89a3d0..e623cd79b 100755 --- a/tests/zfs-tests/tests/functional/xattr/setup.ksh +++ b/tests/zfs-tests/tests/functional/xattr/setup.ksh @@ -48,8 +48,8 @@ fi log_must add_group $ZFS_GROUP log_must add_user $ZFS_GROUP $ZFS_USER -echo $ZFS_USER > /tmp/zfs-xattr-test-user.txt -echo $USES_NIS > /tmp/zfs-xattr-test-nis.txt +echo $ZFS_USER > $TEST_BASE_DIR/zfs-xattr-test-user.txt +echo $USES_NIS > $TEST_BASE_DIR/zfs-xattr-test-nis.txt DISK=${DISKS%% *} default_setup $DISK diff --git a/tests/zfs-tests/tests/functional/xattr/xattr.cfg b/tests/zfs-tests/tests/functional/xattr/xattr.cfg index 5f47562bb..d61fc46cb 100644 --- a/tests/zfs-tests/tests/functional/xattr/xattr.cfg +++ b/tests/zfs-tests/tests/functional/xattr/xattr.cfg @@ -24,7 +24,7 @@ # Use is subject to license terms. # -export NISSTAFILE=/var/tmp/nis_state +export NISSTAFILE=$TEST_BASE_DIR/nis_state export ZFS_USER=zxtr export ZFS_GROUP=zfsgrp diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_007_neg.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_007_neg.ksh index 977434ceb..201f876cc 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_007_neg.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_007_neg.ksh @@ -49,9 +49,9 @@ function cleanup { log_must zfs destroy $TESTPOOL/$TESTFS@snap log_must rm $TESTDIR/myfile2.$$ log_must rm $TESTDIR/myfile.$$ - log_must rm /tmp/output.$$ - [[ -e /tmp/expected_output.$$ ]] && log_must rm \ - /tmp/expected_output.$$ + log_must rm $TEST_BASE_DIR/output.$$ + [[ -e $TEST_BASE_DIR/expected_output.$$ ]] && log_must rm \ + $TEST_BASE_DIR/expected_output.$$ } @@ -71,20 +71,20 @@ log_must zfs snapshot $TESTPOOL/$TESTFS@snap # we shouldn't be able to alter the first file's xattr if is_linux; then log_mustnot eval "attr -s cp $TESTDIR/.zfs/snapshot/snap/myfile.$$ \ - </etc/passwd >/tmp/output.$$ 2>&1" - log_must grep -i Read-only /tmp/output.$$ + </etc/passwd > $TEST_BASE_DIR/output.$$ 2>&1" + log_must grep -i Read-only $TEST_BASE_DIR/output.$$ log_must eval "attr -q -l $TESTDIR/.zfs/snapshot/snap/myfile2.$$ \ - >/tmp/output.$$ 2>&1" - log_must eval "attr -q -l $TESTDIR/myfile2.$$ >/tmp/expected_output.$$" + > $TEST_BASE_DIR/output.$$ 2>&1" + log_must eval "attr -q -l $TESTDIR/myfile2.$$ > $TEST_BASE_DIR/expected_output.$$" else log_mustnot eval " runat $TESTDIR/.zfs/snapshot/snap/myfile.$$ \ - cp /etc/passwd . >/tmp/output.$$ 2>&1" - log_must grep -i Read-only /tmp/output.$$ + cp /etc/passwd . > $TEST_BASE_DIR/output.$$ 2>&1" + log_must grep -i Read-only $TEST_BASE_DIR/output.$$ log_must eval "runat $TESTDIR/.zfs/snapshot/snap/myfile2.$$ \ - ls >/tmp/output.$$ 2>&1" - create_expected_output /tmp/expected_output.$$ SUNWattr_ro SUNWattr_rw + ls > $TEST_BASE_DIR/output.$$ 2>&1" + create_expected_output $TEST_BASE_DIR/expected_output.$$ SUNWattr_ro SUNWattr_rw fi -log_must diff /tmp/output.$$ /tmp/expected_output.$$ +log_must diff $TEST_BASE_DIR/output.$$ $TEST_BASE_DIR/expected_output.$$ log_pass "create/write xattr on a snapshot fails" diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_008_pos.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_008_pos.ksh index 735f1859a..45d24ac27 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_008_pos.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_008_pos.ksh @@ -43,7 +43,7 @@ function cleanup { typeset file - for file in /tmp/output.$$ /tmp/expected-output.$$ \ + for file in $TEST_BASE_DIR/output.$$ $TEST_BASE_DIR/expected-output.$$ \ $TESTDIR/myfile.$$ ; do log_must rm -f $file done @@ -61,15 +61,15 @@ log_must touch $TESTDIR/myfile.$$ create_xattr $TESTDIR/myfile.$$ passwd /etc/passwd # listing the directory . -log_must eval "runat $TESTDIR/myfile.$$ ls . > /tmp/output.$$" -create_expected_output /tmp/expected-output.$$ \ +log_must eval "runat $TESTDIR/myfile.$$ ls . > $TEST_BASE_DIR/output.$$" +create_expected_output $TEST_BASE_DIR/expected-output.$$ \ SUNWattr_ro SUNWattr_rw passwd -log_must diff /tmp/output.$$ /tmp/expected-output.$$ +log_must diff $TEST_BASE_DIR/output.$$ $TEST_BASE_DIR/expected-output.$$ # list the directory . long form -log_must eval "runat $TESTDIR/myfile.$$ ls -a . > /tmp/output.$$" -create_expected_output /tmp/expected-output.$$ . .. \ +log_must eval "runat $TESTDIR/myfile.$$ ls -a . > $TEST_BASE_DIR/output.$$" +create_expected_output $TEST_BASE_DIR/expected-output.$$ . .. \ SUNWattr_ro SUNWattr_rw passwd -log_must diff /tmp/output.$$ /tmp/expected-output.$$ +log_must diff $TEST_BASE_DIR/output.$$ $TEST_BASE_DIR/expected-output.$$ # list the directory .. expecting one file OUTPUT=$(runat $TESTDIR/myfile.$$ ls ..) diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh index 9276d3a1a..80704fad7 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh @@ -71,25 +71,25 @@ else log_note "Checking cpio" log_must touch $TESTDIR/cpio.$$ create_xattr $TESTDIR/cpio.$$ passwd /etc/passwd - echo $TESTDIR/cpio.$$ | cpio -o@ > /tmp/xattr.$$.cpio - echo $TESTDIR/cpio.$$ | cpio -o > /tmp/noxattr.$$.cpio + echo $TESTDIR/cpio.$$ | cpio -o@ > $TEST_BASE_DIR/xattr.$$.cpio + echo $TESTDIR/cpio.$$ | cpio -o > $TEST_BASE_DIR/noxattr.$$.cpio # we should have no xattr here - log_must cpio -iu < /tmp/xattr.$$.cpio + log_must cpio -iu < $TEST_BASE_DIR/xattr.$$.cpio log_mustnot eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1" # we should have an xattr here - log_must cpio -iu@ < /tmp/xattr.$$.cpio + log_must cpio -iu@ < $TEST_BASE_DIR/xattr.$$.cpio log_must eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1" # we should have no xattr here - log_must cpio -iu < /tmp/noxattr.$$.cpio + log_must cpio -iu < $TEST_BASE_DIR/noxattr.$$.cpio log_mustnot eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1" # we should have no xattr here - log_must cpio -iu@ < /tmp/noxattr.$$.cpio + log_must cpio -iu@ < $TEST_BASE_DIR/noxattr.$$.cpio log_mustnot eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1" - log_must rm $TESTDIR/cpio.$$ /tmp/xattr.$$.cpio /tmp/noxattr.$$.cpio + log_must rm $TESTDIR/cpio.$$ $TEST_BASE_DIR/xattr.$$.cpio $TEST_BASE_DIR/noxattr.$$.cpio fi log_note "Checking cp" diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_common.kshlib b/tests/zfs-tests/tests/functional/xattr/xattr_common.kshlib index d2399310b..b80436be4 100644 --- a/tests/zfs-tests/tests/functional/xattr/xattr_common.kshlib +++ b/tests/zfs-tests/tests/functional/xattr/xattr_common.kshlib @@ -60,15 +60,15 @@ function compare_xattrs { # filename1 filename2 xattr_name typeset XATTR_NAME=$3 if is_linux; then - attr -q -g $XATTR_NAME $FILE1 >/tmp/file1.$$ - attr -q -g $XATTR_NAME $FILE2 >/tmp/file2.$$ + attr -q -g $XATTR_NAME $FILE1 > $TEST_BASE_DIR/file1.$$ + attr -q -g $XATTR_NAME $FILE2 > $TEST_BASE_DIR/file2.$$ else - runat $FILE1 cat $XATTR_NAME > /tmp/file1.$$ - runat $FILE2 cat $XATTR_NAME > /tmp/file2.$$ + runat $FILE1 cat $XATTR_NAME > $TEST_BASE_DIR/file1.$$ + runat $FILE2 cat $XATTR_NAME > $TEST_BASE_DIR/file2.$$ fi - log_must diff /tmp/file1.$$ /tmp/file2.$$ - log_must rm /tmp/file1.$$ /tmp/file2.$$ + log_must diff $TEST_BASE_DIR/file1.$$ $TEST_BASE_DIR/file2.$$ + log_must rm $TEST_BASE_DIR/file1.$$ $TEST_BASE_DIR/file2.$$ } function verify_xattr { # filename xattr_name xattr_contents @@ -79,14 +79,14 @@ function verify_xattr { # filename xattr_name xattr_contents # read the xattr, writing it to a temp file if is_linux; then log_must eval \ - "attr -q -g $XATTR_NAME $FILE >/tmp/$XATTR_NAME.$$" + "attr -q -g $XATTR_NAME $FILE > $TEST_BASE_DIR/$XATTR_NAME.$$" else log_must eval \ - "runat $FILE cat $XATTR_NAME >/tmp/$XATTR_NAME.$$ 2>&1" + "runat $FILE cat $XATTR_NAME > $TEST_BASE_DIR/$XATTR_NAME.$$ 2>&1" fi - log_must diff $XATTR_CONTENTS /tmp/$XATTR_NAME.$$ - rm /tmp/$XATTR_NAME.$$ + log_must diff $XATTR_CONTENTS $TEST_BASE_DIR/$XATTR_NAME.$$ + rm $TEST_BASE_DIR/$XATTR_NAME.$$ } function delete_xattr { # filename xattr_name @@ -111,15 +111,15 @@ function verify_write_xattr { # filename xattr_name if is_linux; then log_must attr -q -s $XATTR_NAME $FILE < /etc/passwd log_must eval \ - "attr -q -g $XATTR_NAME $FILE >/tmp/$XATTR_NAME.$$" + "attr -q -g $XATTR_NAME $FILE > $TEST_BASE_DIR/$XATTR_NAME.$$" else log_must eval "runat $FILE dd if=/etc/passwd of=$XATTR_NAME" log_must eval \ - "runat $FILE cat $XATTR_NAME > /tmp/$XATTR_NAME.$$ 2>&1" + "runat $FILE cat $XATTR_NAME > $TEST_BASE_DIR/$XATTR_NAME.$$ 2>&1" fi - log_must dd if=/etc/passwd of=/tmp/passwd_dd.$$ - log_must diff /tmp/passwd_dd.$$ /tmp/$XATTR_NAME.$$ - log_must rm /tmp/passwd_dd.$$ /tmp/$XATTR_NAME.$$ + log_must dd if=/etc/passwd of=$TEST_BASE_DIR/passwd_dd.$$ + log_must diff $TEST_BASE_DIR/passwd_dd.$$ $TEST_BASE_DIR/$XATTR_NAME.$$ + log_must rm $TEST_BASE_DIR/passwd_dd.$$ $TEST_BASE_DIR/$XATTR_NAME.$$ } # this function is to create the expected output |