OSDN Git Service

tests: fix left-over e2fsprogs-tmp files not getting clean up
authorTheodore Ts'o <tytso@mit.edu>
Mon, 9 Jun 2014 14:34:17 +0000 (10:34 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 4 Jul 2014 20:39:49 +0000 (16:39 -0400)
In addition, incorporate the test name into the e2fsprogs-tmp to make
it easier to debug left-over temp files in the future.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
tests/f_mmp/script
tests/f_mmp_garbage/script
tests/m_mmp/script
tests/t_mmp_1on/script
tests/t_mmp_2off/script
tests/test_one.in

index d921672..9ff16c9 100644 (file)
@@ -1,7 +1,8 @@
 FSCK_OPT=-yf
 
-TMPFILE=$test_name.tmp
-> $TMPFILE
+# use current directory instead of /tmp becase tmpfs doesn't support DIO
+rm -f $TMPFILE
+TMPFILE=$(mktemp ./tmp-$test_name.XXXXXX)
 
 stat -f $TMPFILE | grep -q "Type: tmpfs"
 if [ $? = 0 ]; then
@@ -21,8 +22,8 @@ fi
 
 kill_debugfs() {
        trap 0
-       PID=$(ps -o pid,command | grep -v awk |
-               awk "/debugfs -w $TMPFILE/ { print \$1 }")
+       PID=$(ps -o pid,command | grep -v grep |
+               grep "debugfs -w $TMPFILE" | awk "{ print \$1 }")
        [ "x$PID" != "x" ] && kill -9 $PID
 }
 
index 02cc12a..6d451a6 100644 (file)
@@ -1,7 +1,8 @@
 FSCK_OPT=-yf
 
-TMPFILE=$test_name.tmp
-> $TMPFILE
+# use current directory instead of /tmp becase tmpfs doesn't support DIO
+rm -f $TMPFILE
+TMPFILE=$(mktemp ./tmp-$test_name.XXXXXX)
 
 stat -f $TMPFILE | grep -q "Type: tmpfs"
 if [ $? = 0 ] ; then
index 02b0b4b..6a9394d 100644 (file)
@@ -2,8 +2,11 @@ DESCRIPTION="enable MMP during mke2fs"
 FS_SIZE=65536
 MKE2FS_DEVICE_SECTSIZE=2048
 export MKE2FS_DEVICE_SECTSIZE
-TMPFILE=$test_name.tmp
-> $TMPFILE
+
+# use current directory instead of /tmp becase tmpfs doesn't support DIO
+rm -f $TMPFILE
+TMPFILE=$(mktemp ./tmp-$test_name.XXXXXX)
+
 stat -f $TMPFILE | grep -q "Type: tmpfs"
 if [ $? = 0 ]; then
        rm -f $TMPFILE
index 8fc8158..cfed2ca 100644 (file)
@@ -1,7 +1,8 @@
 FSCK_OPT=-yf
 
-TMPFILE=$test_name.tmp
-> $TMPFILE
+# use current directory instead of /tmp becase tmpfs doesn't support DIO
+rm -f $TMPFILE
+TMPFILE=$(mktemp ./tmp-$test_name.XXXXXX)
 
 stat -f $TMPFILE | grep -q "Type: tmpfs"
 if [ $? = 0 ] ; then
index 1dee14e..6556201 100644 (file)
@@ -1,7 +1,8 @@
 FSCK_OPT=-yf
 
-TMPFILE=$test_name.tmp
-> $TMPFILE
+# use current directory instead of /tmp becase tmpfs doesn't support DIO
+rm -f $TMPFILE
+TMPFILE=$(mktemp ./tmp-$test_name.XXXXXX)
 
 stat -f $TMPFILE | grep -q "Type: tmpfs"
 if [ $? = 0 ]; then
index d053fd7..01a9260 100644 (file)
@@ -28,9 +28,10 @@ fi
 
 . $TEST_CONFIG
 
-TMPFILE=$(mktemp -t e2fsprogs-tmp.XXXXXX)
-
 test_name=`echo $test_dir | sed -e 's;.*/;;'`
+
+TMPFILE=$(mktemp -t e2fsprogs-tmp-$test_name.XXXXXX)
+
 if [ -f $test_dir ] ; then
        exit 0;
 fi