diff mbox

[1/2] tests: fix left-over e2fsprogs-tmp files not getting clean up

Message ID 1402325451-5275-1-git-send-email-tytso@mit.edu
State Superseded, archived
Headers show

Commit Message

Theodore Ts'o June 9, 2014, 2:50 p.m. UTC
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         | 3 ---
 tests/f_mmp_garbage/script | 3 ---
 tests/m_mmp/script         | 2 --
 tests/t_mmp_1on/script     | 3 ---
 tests/t_mmp_2off/script    | 3 ---
 tests/test_one.in          | 5 +++--
 6 files changed, 3 insertions(+), 16 deletions(-)

Comments

Andreas Dilger June 9, 2014, 8:34 p.m. UTC | #1
On Jun 9, 2014, at 8:50 AM, Theodore Ts'o <tytso@mit.edu> wrote:
> diff --git a/tests/f_mmp/script b/tests/f_mmp/script
> index d921672..8d7ab1f 100644
> --- a/tests/f_mmp/script
> +++ b/tests/f_mmp/script
> @@ -1,8 +1,5 @@
> FSCK_OPT=-yf
> 
> -TMPFILE=$test_name.tmp
> -> $TMPFILE
> -
> stat -f $TMPFILE | grep -q "Type: tmpfs"
> if [ $? = 0 ]; then
> 	rm -f $TMPFILE
>         echo "$test_name: $test_description: skipped for tmpfs (no O_DIRECT)"
>         return 0
> fi

The reason I created these temp files on the local filesystem instead of
on /tmp where $TMPFILE normally is normally located is because tmpfs does
not support O_DIRECT.  With the current patch all of these tests would be
skipped in the default test configuration.

I think it makes more sense to change the tests to just delete $TMPFILE
before creating the local TMPFILE.

Cheers, Andreas

> diff --git a/tests/f_mmp_garbage/script b/tests/f_mmp_garbage/script
> index 02cc12a..9ff4d8e 100644
> --- a/tests/f_mmp_garbage/script
> +++ b/tests/f_mmp_garbage/script
> @@ -1,8 +1,5 @@
> FSCK_OPT=-yf
> 
> -TMPFILE=$test_name.tmp
> -> $TMPFILE
> -
> stat -f $TMPFILE | grep -q "Type: tmpfs"
> if [ $? = 0 ] ; then
> 	rm -f $TMPFILE
> diff --git a/tests/m_mmp/script b/tests/m_mmp/script
> index 02b0b4b..1ed284d 100644
> --- a/tests/m_mmp/script
> +++ b/tests/m_mmp/script
> @@ -2,8 +2,6 @@ DESCRIPTION="enable MMP during mke2fs"
> FS_SIZE=65536
> MKE2FS_DEVICE_SECTSIZE=2048
> export MKE2FS_DEVICE_SECTSIZE
> -TMPFILE=$test_name.tmp
> -> $TMPFILE
> stat -f $TMPFILE | grep -q "Type: tmpfs"
> if [ $? = 0 ]; then
> 	rm -f $TMPFILE
> diff --git a/tests/t_mmp_1on/script b/tests/t_mmp_1on/script
> index 8fc8158..b99aad9 100644
> --- a/tests/t_mmp_1on/script
> +++ b/tests/t_mmp_1on/script
> @@ -1,8 +1,5 @@
> FSCK_OPT=-yf
> 
> -TMPFILE=$test_name.tmp
> -> $TMPFILE
> -
> stat -f $TMPFILE | grep -q "Type: tmpfs"
> if [ $? = 0 ] ; then
> 	rm -f $TMPFILE
> diff --git a/tests/t_mmp_2off/script b/tests/t_mmp_2off/script
> index 1dee14e..6822278 100644
> --- a/tests/t_mmp_2off/script
> +++ b/tests/t_mmp_2off/script
> @@ -1,8 +1,5 @@
> FSCK_OPT=-yf
> 
> -TMPFILE=$test_name.tmp
> -> $TMPFILE
> -
> stat -f $TMPFILE | grep -q "Type: tmpfs"
> if [ $? = 0 ]; then
> 	rm -f $TMPFILE
> diff --git a/tests/test_one.in b/tests/test_one.in
> index d053fd7..01a9260 100644
> --- a/tests/test_one.in
> +++ b/tests/test_one.in
> @@ -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
> -- 
> 2.0.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Cheers, Andreas
diff mbox

Patch

diff --git a/tests/f_mmp/script b/tests/f_mmp/script
index d921672..8d7ab1f 100644
--- a/tests/f_mmp/script
+++ b/tests/f_mmp/script
@@ -1,8 +1,5 @@ 
 FSCK_OPT=-yf
 
-TMPFILE=$test_name.tmp
-> $TMPFILE
-
 stat -f $TMPFILE | grep -q "Type: tmpfs"
 if [ $? = 0 ]; then
 	rm -f $TMPFILE
diff --git a/tests/f_mmp_garbage/script b/tests/f_mmp_garbage/script
index 02cc12a..9ff4d8e 100644
--- a/tests/f_mmp_garbage/script
+++ b/tests/f_mmp_garbage/script
@@ -1,8 +1,5 @@ 
 FSCK_OPT=-yf
 
-TMPFILE=$test_name.tmp
-> $TMPFILE
-
 stat -f $TMPFILE | grep -q "Type: tmpfs"
 if [ $? = 0 ] ; then
 	rm -f $TMPFILE
diff --git a/tests/m_mmp/script b/tests/m_mmp/script
index 02b0b4b..1ed284d 100644
--- a/tests/m_mmp/script
+++ b/tests/m_mmp/script
@@ -2,8 +2,6 @@  DESCRIPTION="enable MMP during mke2fs"
 FS_SIZE=65536
 MKE2FS_DEVICE_SECTSIZE=2048
 export MKE2FS_DEVICE_SECTSIZE
-TMPFILE=$test_name.tmp
-> $TMPFILE
 stat -f $TMPFILE | grep -q "Type: tmpfs"
 if [ $? = 0 ]; then
 	rm -f $TMPFILE
diff --git a/tests/t_mmp_1on/script b/tests/t_mmp_1on/script
index 8fc8158..b99aad9 100644
--- a/tests/t_mmp_1on/script
+++ b/tests/t_mmp_1on/script
@@ -1,8 +1,5 @@ 
 FSCK_OPT=-yf
 
-TMPFILE=$test_name.tmp
-> $TMPFILE
-
 stat -f $TMPFILE | grep -q "Type: tmpfs"
 if [ $? = 0 ] ; then
 	rm -f $TMPFILE
diff --git a/tests/t_mmp_2off/script b/tests/t_mmp_2off/script
index 1dee14e..6822278 100644
--- a/tests/t_mmp_2off/script
+++ b/tests/t_mmp_2off/script
@@ -1,8 +1,5 @@ 
 FSCK_OPT=-yf
 
-TMPFILE=$test_name.tmp
-> $TMPFILE
-
 stat -f $TMPFILE | grep -q "Type: tmpfs"
 if [ $? = 0 ]; then
 	rm -f $TMPFILE
diff --git a/tests/test_one.in b/tests/test_one.in
index d053fd7..01a9260 100644
--- a/tests/test_one.in
+++ b/tests/test_one.in
@@ -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