]> git.proxmox.com Git - mirror_zfs.git/commitdiff
tests: clean out more temporary files
authorнаб <nabijaczleweli@nabijaczleweli.xyz>
Sat, 26 Mar 2022 10:19:17 +0000 (11:19 +0100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Sat, 2 Apr 2022 01:03:21 +0000 (18:03 -0700)
What remains is a bunch of anonymous untraceable /tmp/tmp.XXXXXXXXXX
files and bak.root.receive.staff1.3835 from an error branch, testdir.1,
testdir.3, and testroot454470 (with children) in testroot

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13259

18 files changed:
contrib/pyzfs/libzfs_core/test/test_libzfs_core.py
scripts/zfs-tests.sh
tests/zfs-tests/tests/functional/cli_root/zdb/zdb_block_size_histogram.ksh
tests/zfs-tests/tests/functional/cli_root/zfs_bookmark/zfs_bookmark_cliargs.ksh
tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_003_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_004_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_005_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_021_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_022_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_clear_retained.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_duplicates.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_errors.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_devices.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_indirect.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_vdevs.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_wholedisk.ksh
tests/zfs-tests/tests/functional/xattr/cleanup.ksh
tests/zfs-tests/tests/functional/xattr/xattr_004_pos.ksh

index 2567f7ebf83d4d6bcc7dc8ae99da3c288d46fbba..9b1aea193f44a94da073fa957d1174145b403071 100644 (file)
@@ -1903,6 +1903,8 @@ class ZFSTest(unittest.TestCase):
             with self.assertRaises(lzc_exc.StreamIOError) as ctx:
                 lzc.lzc_send(snap, None, fd)
             os.close(fd)
+            os.unlink(output.name)
+
         self.assertEqual(ctx.exception.errno, errno.EBADF)
 
     def test_recv_full(self):
index 01b3d38db469ac947d66e1b79cd5c813d8f90be4..e7d04110e394b3892beeb510dab70cb57ee94010 100755 (executable)
@@ -747,7 +747,7 @@ if [ -d "$RESULTS_DIR" ]; then
        cat "$RESULTS_FILE" "$REPORT_FILE" >"$RESULTS_DIR/results"
 fi
 
-rm -f "$RESULTS_FILE" "$REPORT_FILE"
+rm -f "$RESULTS_FILE" "$REPORT_FILE" "$TEST_LIST" "$TEMP_RESULTS_FILE"
 
 if [ -n "$SINGLETEST" ]; then
        rm -f "$RUNFILES" >/dev/null 2>&1
index 9a960cecc38bc1a812e98eeba6caa40f29652e00..0a4d24fa695a6341c97f5aaef73ca67b1578196d 100755 (executable)
@@ -145,7 +145,6 @@ function histo_check_test_pool
        typeset -i this_rs
        typeset -i this_ri
        typeset -i sum_filesizes=0
-       typeset stripped
 
        let histo_check_pool_size=$(get_pool_prop size ${pool})
        if [[ ! ${histo_check_pool_size} =~ ${re_number} ]]; then
@@ -243,6 +242,8 @@ function histo_check_test_pool
                        fi
                fi
        done < ${stripped}
+       rm "${stripped}"
+
        if [ ${fail_value} -gt 0 ]; then
                if [ ${error_count} -eq 1 ]; then
                        log_note "hctp: There was ${error_count} error"
index 3a1cddb5c64ab44dd51a441340be2358b55d73e3..ec21c81aba1b1ce9795df8c67ffec25e8abcb7d4 100755 (executable)
@@ -62,6 +62,8 @@ function cleanup
 
        bkmarkexists "$DATASET#$TESTBMCOPY" && \
                destroy_dataset "$DATASET#$TESTBMCOPY"
+
+       log_must rm -f "$TEST_BASE_DIR/zfstest_datastream.$$"
 }
 
 log_assert "'zfs bookmark' should work only when passed valid arguments."
index 6484de9c91a8d2d92111e48f6743c7c28cb00e39..ac3bc891c86f8db35cec007c7fe1141d93c7929f 100755 (executable)
@@ -49,6 +49,7 @@ verify_runnable "both"
 function cleanup
 {
        snapexists $SNAPFS && destroy_dataset $SNAPFS -Rf
+       log_must rm -df "/tmp/mnt$$"
 }
 
 log_onexit cleanup
index 9e69366c8793485bb30169893e91fb8ba87f1f34..bd01623b3627523045830e1bd50256c7263acdab 100755 (executable)
@@ -49,24 +49,23 @@ verify_runnable "both"
 function cleanup
 {
        datasetexists $TESTPOOL/$TESTFS1 && destroy_dataset $TESTPOOL/$TESTFS1 -f
+       log_must rm -df "/tmp/mnt$$"
 }
 
 log_onexit cleanup
 
 
-log_assert "'zfs create -o property=value filesystem' can successfully create \
-          a ZFS filesystem with correct property set."
+log_assert "'zfs create -o property=value filesystem' can successfully create" \
+          "a ZFS filesystem with correct property set."
 
 typeset -i i=0
 while (( $i < ${#RW_FS_PROP[*]} )); do
        log_must zfs create -o ${RW_FS_PROP[$i]} $TESTPOOL/$TESTFS1
-       datasetexists $TESTPOOL/$TESTFS1 || \
-               log_fail "zfs create $TESTPOOL/$TESTFS1 fail."
-       propertycheck $TESTPOOL/$TESTFS1 ${RW_FS_PROP[i]} || \
-               log_fail "${RW_FS_PROP[i]} is failed to set."
+       log_must datasetexists $TESTPOOL/$TESTFS1
+       log_must propertycheck $TESTPOOL/$TESTFS1 ${RW_FS_PROP[i]}
        log_must_busy zfs destroy -f $TESTPOOL/$TESTFS1
        (( i = i + 1 ))
 done
 
-log_pass "'zfs create -o property=value filesystem' can successfully create \
-         a ZFS filesystem with correct property set."
+log_pass "'zfs create -o property=value filesystem' can successfully create" \
+         "a ZFS filesystem with correct property set."
index 98cf70938e873ca848230d69bb5df8481a76e5a0..1321854d21cd51c0a40f3dbabe4cf10751a6bb92 100755 (executable)
@@ -48,15 +48,16 @@ verify_runnable "both"
 
 function cleanup
 {
-       datasetexists $TESTPOOL/$TESTFS1 && \
+       datasetexists $TESTPOOL/$TESTFS1 &&
                destroy_dataset $TESTPOOL/$TESTFS1 -f
+       log_must rm -df "/tmp/mnt$$"
 }
 
 log_onexit cleanup
 
 
-log_assert "'zfs create -o property=value filesystem' can successfully create \
-          a ZFS filesystem with multiple properties set."
+log_assert "'zfs create -o property=value filesystem' can successfully create" \
+          "a ZFS filesystem with multiple properties set."
 
 typeset -i i=0
 typeset opts=""
@@ -69,17 +70,15 @@ while (( $i < ${#RW_FS_PROP[*]} )); do
 done
 
 log_must zfs create $opts $TESTPOOL/$TESTFS1
-datasetexists $TESTPOOL/$TESTFS1 || \
-       log_fail "zfs create $TESTPOOL/$TESTFS1 fail."
+log_must datasetexists $TESTPOOL/$TESTFS1
 
 i=0
 while (( $i < ${#RW_FS_PROP[*]} )); do
         if [[ ${RW_FS_PROP[$i]} != *"checksum"* ]]; then
-               propertycheck $TESTPOOL/$TESTFS1 ${RW_FS_PROP[i]} || \
-                       log_fail "${RW_FS_PROP[i]} is failed to set."
+               log_must propertycheck $TESTPOOL/$TESTFS1 ${RW_FS_PROP[i]}
        fi
        (( i = i + 1 ))
 done
 
-log_pass "'zfs create -o property=value filesystem' can successfully create \
-         a ZFS filesystem with multiple properties set."
+log_pass "'zfs create -o property=value filesystem' can successfully create" \
+         "a ZFS filesystem with multiple properties set."
index 655f887b60ad5704e4338754e2c3354a722ce059..264c75279d17df538613231b7f4cef2c7b542a91 100755 (executable)
@@ -49,12 +49,13 @@ verify_runnable "global"
 function cleanup
 {
        datasetexists $TESTPOOL && destroy_pool $TESTPOOL
+       log_must rm -df "/tmp/mnt$$"
 }
 
 log_onexit cleanup
 
-log_assert "'zpool create -O property=value pool' can successfully create a pool \
-               with correct filesystem property set."
+log_assert "'zpool create -O property=value pool' can successfully create a pool" \
+               "with correct filesystem property set."
 
 set -A RW_FS_PROP "quota=536870912" \
                  "reservation=536870912" \
@@ -80,14 +81,11 @@ fi
 typeset -i i=0
 while (( $i < ${#RW_FS_PROP[*]} )); do
        log_must zpool create -O ${RW_FS_PROP[$i]} -f $TESTPOOL $DISKS
-       datasetexists $TESTPOOL || \
-               log_fail "zpool create $TESTPOOL fail."
-       propertycheck $TESTPOOL ${RW_FS_PROP[i]} || \
-               log_fail "${RW_FS_PROP[i]} is failed to set."
+       log_must datasetexists $TESTPOOL
+       log_must propertycheck $TESTPOOL ${RW_FS_PROP[i]}
        log_must zpool destroy $TESTPOOL
        (( i = i + 1 ))
 done
 
-log_pass "'zpool create -O property=value pool' can successfully create a pool \
-               with correct filesystem property set."
-
+log_pass "'zpool create -O property=value pool' can successfully create a pool" \
+               "with correct filesystem property set."
index 4a918c0a683a41acc0bbf87ca7b7a5aa2af5460e..717fcaa6ec51ef31fabeff3d4eb39d6032d1eddf 100755 (executable)
@@ -49,12 +49,13 @@ verify_runnable "global"
 function cleanup
 {
        poolexists $TESTPOOL && destroy_pool $TESTPOOL
+       log_must rm -df "/tmp/mnt$$"
 }
 
 log_onexit cleanup
 
-log_assert "'zpool create -O property=value pool' can successfully create a pool \
-               with multiple filesystem properties set."
+log_assert "'zpool create -O property=value pool' can successfully create a pool" \
+               "with multiple filesystem properties set."
 
 set -A RW_FS_PROP "quota=536870912" \
                  "reservation=536870912" \
@@ -81,15 +82,13 @@ while (( $i < ${#RW_FS_PROP[*]} )); do
 done
 
 log_must zpool create $opts -f $TESTPOOL $DISKS
-datasetexists $TESTPOOL || log_fail "zpool create $TESTPOOL fail."
+log_must datasetexists $TESTPOOL
 
 i=0
 while (( $i < ${#RW_FS_PROP[*]} )); do
-       propertycheck $TESTPOOL ${RW_FS_PROP[i]} || \
-                       log_fail "${RW_FS_PROP[i]} is failed to set."
+       log_must propertycheck $TESTPOOL ${RW_FS_PROP[i]}
        (( i = i + 1 ))
 done
 
-log_pass "'zpool create -O property=value pool' can successfully create a pool \
-               with multiple filesystem properties set."
-
+log_pass "'zpool create -O property=value pool' can successfully create a pool" \
+               "with multiple filesystem properties set."
index 9b5b5e1a0227305827860fb60618f63837d56f44..c16094f540386e50af1ab2b63ca77a3bee2bf5ac 100755 (executable)
@@ -64,7 +64,7 @@ function cleanup
        if poolexists $POOL ; then
                zpool export $POOL
        fi
-       log_must rm -f $VDEV1 $VDEV2 $VDEV3
+       log_must rm -fd $VDEV1 $VDEV2 $VDEV3 $SUPPLY $MOUNTDIR
 }
 
 function damage_and_repair
@@ -130,4 +130,3 @@ else
        log_note observed $errcnt new checksum errors after a scrub
        log_pass "$assertion"
 fi
-
index 08ab6a2fabcfc9c67d67d93814574160dd82f194..9097ac008334fe0126b05a8b6d541404cfe67abb 100755 (executable)
@@ -56,7 +56,7 @@ function cleanup
        if poolexists $POOL ; then
                destroy_pool $POOL
        fi
-       log_must rm -f $VDEV1 $VDEV2
+       log_must rm -fd $VDEV1 $VDEV2 $MOUNTDIR
 }
 
 log_assert "Duplicate I/O ereport errors are not posted"
index b77437416317dc26bb69048494cf85a0087c5107..82a1a1131f0646a6296fa0f913669a9d7275df20 100755 (executable)
@@ -59,7 +59,7 @@ function cleanup
        if poolexists $POOL ; then
                log_must destroy_pool $POOL
        fi
-       log_must rm -f $VDEV1 $VDEV2 $VDEV3
+       log_must rm -fd $VDEV1 $VDEV2 $VDEV3 $MOUNTDIR
 }
 
 log_assert "Check that the number of zpool errors match the number of events"
index d64c30d5c5617de7e6fe158fadef8e7a69dddac6..83b12ab784cd67c6ed77bf6ac8d2a29d4b741a02 100755 (executable)
@@ -33,7 +33,7 @@ function cleanup
 {
        destroy_pool $TESTPOOL
        destroy_pool $TESTPOOL2
-       rm -f $FILEDEV_PREFIX*
+       rm -fd $FILEDEV_PREFIX* $altroot
 }
 
 function setup_mirror # <conf>
index 13f0d08b7f200d47a12f72cfd7d713fc620ec667..e6e5d245793fe14dcd44d819bbb40c717cd702b7 100755 (executable)
@@ -43,7 +43,7 @@ function cleanup
        if poolexists $TESTPOOL2 ; then
                destroy_pool $TESTPOOL2
        fi
-       rm -f $VDEV_TEMP $VDEV_M1 $VDEV_M2
+       rm -fd $VDEV_TEMP $VDEV_M1 $VDEV_M2 $altroot
 }
 log_onexit cleanup
 
@@ -64,6 +64,6 @@ log_must zpool remove $TESTPOOL $VDEV_TEMP
 log_must wait_for_removal $TESTPOOL
 log_must zpool split -R $altroot $TESTPOOL $TESTPOOL2
 log_must poolexists $TESTPOOL2
-log_must test "$(get_pool_prop 'altroot' $TESTPOOL2)" == "$altroot"
+log_must test "$(get_pool_prop 'altroot' $TESTPOOL2)" = "$altroot"
 
 log_pass "'zpool split' works on pools with indirect VDEVs."
index d2be9b65cceb1388fce201090aadeff9da91357e..fff98cf83e84759ce11a59e4a83fd8806b716b56 100755 (executable)
@@ -33,7 +33,7 @@ function cleanup
 {
        destroy_pool $TESTPOOL
        destroy_pool $TESTPOOL2
-       rm -f $FILEDEV_PREFIX*
+       rm -fd $FILEDEV_PREFIX* $altroot
 }
 
 #
index 085856c428add17bd515c015f84849e7fb1bb5e8..0725b77a3db28cfc65daaf1ac167a0910374fe79 100755 (executable)
@@ -44,7 +44,7 @@ function cleanup
        destroy_pool $TESTPOOL
        destroy_pool $TESTPOOL2
        unload_scsi_debug
-       rm -f "$FILE_DEVICE"
+       rm -fd "$FILE_DEVICE" "$ALTROOT"
 }
 
 function setup_mirror
index ab0fbf8124c8799f27335659d8e5f1072fe531b1..625718cfeac89ee7af629686124e7b9960c2f62f 100755 (executable)
@@ -31,7 +31,7 @@
 . $STF_SUITE/tests/functional/xattr/xattr_common.kshlib
 
 USES_NIS=$(<$TEST_BASE_DIR/zfs-xattr-test-nis.txt)
-rm $TEST_BASE_DIR/zfs-xattr-test-nis.txt
+rm $TEST_BASE_DIR/zfs-xattr-test-nis.txt $TEST_BASE_DIR/zfs-xattr-test-user.txt
 
 if [ "${USES_NIS}" == "true" ]
 then
index 786322b30a97d770676d97aa1be7607433f7f1d8..2ed040d864c48d3f57b10ed9d9553147ca310954 100755 (executable)
@@ -50,8 +50,8 @@ verify_runnable "global"
 function cleanup {
        if ismounted /tmp/$NEWFS_DEFAULT_FS.$$ $NEWFS_DEFAULT_FS; then
                log_must umount /tmp/$NEWFS_DEFAULT_FS.$$
-               log_must rm -rf /tmp/$NEWFS_DEFAULT_FS.$$
        fi
+       log_must rm -rf /tmp/$NEWFS_DEFAULT_FS.$$
 }
 
 log_assert "Files from $NEWFS_DEFAULT_FS with xattrs copied to zfs retain xattr info."