All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tests: for mktemp the exes must be the final characters of the name
@ 2014-06-04 12:28 Benno Schulenberg
  2014-06-04 22:31 ` Andreas Dilger
  0 siblings, 1 reply; 10+ messages in thread
From: Benno Schulenberg @ 2014-06-04 12:28 UTC (permalink / raw)
  To: linux-ext4

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
 tests/scripts/resize_test |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tests/scripts/resize_test b/tests/scripts/resize_test
index c9a7a1c..1e5756c 100755
--- a/tests/scripts/resize_test
+++ b/tests/scripts/resize_test
@@ -21,7 +21,7 @@ if truncate -s $SIZE_2 $TMPFILE 2> /dev/null; then
 	echo "using $TMPFILE" >> $LOG
 else
 	rm $TMPFILE
-	export TMPFILE=$(TMPDIR=. mktemp -t $test_name.XXXXXX.tmp)
+	export TMPFILE=$(TMPDIR=. mktemp -t $test_name.tmp.XXXXXX)
 	touch $TMPFILE
 	echo "using $TMPFILE" >> $LOG
 	if ! truncate -s $SIZE_2 $TMPFILE >> $LOG 2>&1; then
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] tests: for mktemp the exes must be the final characters of the name
  2014-06-04 12:28 [PATCH] tests: for mktemp the exes must be the final characters of the name Benno Schulenberg
@ 2014-06-04 22:31 ` Andreas Dilger
  2014-06-05  3:28   ` Theodore Ts'o
  2014-06-09 14:49   ` Theodore Ts'o
  0 siblings, 2 replies; 10+ messages in thread
From: Andreas Dilger @ 2014-06-04 22:31 UTC (permalink / raw)
  To: Benno Schulenberg; +Cc: linux-ext4

[-- Attachment #1: Type: text/plain, Size: 1210 bytes --]

On Jun 4, 2014, at 6:28 AM, Benno Schulenberg <bensberg@justemail.net> wrote:
> Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
> ---
> tests/scripts/resize_test |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/tests/scripts/resize_test b/tests/scripts/resize_test
> index c9a7a1c..1e5756c 100755
> --- a/tests/scripts/resize_test
> +++ b/tests/scripts/resize_test
> @@ -21,7 +21,7 @@ if truncate -s $SIZE_2 $TMPFILE 2> /dev/null; then
> 	echo "using $TMPFILE" >> $LOG
> else
> 	rm $TMPFILE
> -	export TMPFILE=$(TMPDIR=. mktemp -t $test_name.XXXXXX.tmp)
> +	export TMPFILE=$(TMPDIR=. mktemp -t $test_name.tmp.XXXXXX)

The goal was that the temporary file ended with ".tmp" so that it would
be removed by "make clean" in case the test fails or is interrupted, so
it would be good to update the "make clean" rules to find these files.

I also notice that there are occasional e2fsprogs-tmp.XXXXXX files left
behind in /tmp after testing, and it would be nice if they contained the
test name so they can be found if there is a problem.

It looks like the same could be done in tests/test_one.in:

TMPFILE=$(mktemp -t e2fsprogs-$test_name.tmp.XXXXXX)


Cheers, Andreas






[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] tests: for mktemp the exes must be the final characters of the name
  2014-06-04 22:31 ` Andreas Dilger
@ 2014-06-05  3:28   ` Theodore Ts'o
  2014-06-09 14:49   ` Theodore Ts'o
  1 sibling, 0 replies; 10+ messages in thread
From: Theodore Ts'o @ 2014-06-05  3:28 UTC (permalink / raw)
  To: Andreas Dilger; +Cc: Benno Schulenberg, linux-ext4

On Wed, Jun 04, 2014 at 04:31:21PM -0600, Andreas Dilger wrote:
> On Jun 4, 2014, at 6:28 AM, Benno Schulenberg <bensberg@justemail.net> wrote:
> > Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
> > ---
> > tests/scripts/resize_test |    2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/tests/scripts/resize_test b/tests/scripts/resize_test
> > index c9a7a1c..1e5756c 100755
> > --- a/tests/scripts/resize_test
> > +++ b/tests/scripts/resize_test
> > @@ -21,7 +21,7 @@ if truncate -s $SIZE_2 $TMPFILE 2> /dev/null; then
> > 	echo "using $TMPFILE" >> $LOG
> > else
> > 	rm $TMPFILE
> > -	export TMPFILE=$(TMPDIR=. mktemp -t $test_name.XXXXXX.tmp)
> > +	export TMPFILE=$(TMPDIR=. mktemp -t $test_name.tmp.XXXXXX)
> 
> The goal was that the temporary file ended with ".tmp" so that it would
> be removed by "make clean" in case the test fails or is interrupted, so
> it would be good to update the "make clean" rules to find these files.

The problem is that using a template where the XXXXXX is in the middle
of the file name is a GNU coreutils extension.  It's not supported by
Mac OSX, *BSD's, and Ubuntu 10.04 and before (and presumably similar
vintage enterprise distros).

With older coreutils, "mktemp /tmp/foo.XXXXXX.bar" will out and out
fail.  That's what Benno noticed.  On OSX, "mktemp
/tmp/foo.XXXXXX.bar" will return /tmp/foo.XXXXXX.bar, unless that file
already exists, in which case it will bomb out.

If the goal is to make sure we remove temporary files, what we can do
is to use a template of "/tmp/e2fs-$test_name-tmp.XXXXXX", and then
include "rm /tmp/e2fs-*-tmp.???????" in the "make clean" rule.

Cheers,

						- Ted


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] tests: for mktemp the exes must be the final characters of the name
  2014-06-04 22:31 ` Andreas Dilger
  2014-06-05  3:28   ` Theodore Ts'o
@ 2014-06-09 14:49   ` Theodore Ts'o
  2014-06-09 14:50     ` [PATCH 1/2] tests: fix left-over e2fsprogs-tmp files not getting clean up Theodore Ts'o
  1 sibling, 1 reply; 10+ messages in thread
From: Theodore Ts'o @ 2014-06-09 14:49 UTC (permalink / raw)
  To: Andreas Dilger; +Cc: Benno Schulenberg, linux-ext4

On Wed, Jun 04, 2014 at 04:31:21PM -0600, Andreas Dilger wrote:
> 
> I also notice that there are occasional e2fsprogs-tmp.XXXXXX files left
> behind in /tmp after testing, and it would be nice if they contained the
> test name so they can be found if there is a problem.

I looked into this and it was caused by bugs in the mmp tests.  They
were setting TMPFILE without using mktemp, and overriding the TMPFILE
already set up by the test infrastructure.

The other reason why we have left-over temp files is caused by someone
interrupting the "make check" run.

						- Ted



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] tests: fix left-over e2fsprogs-tmp files not getting clean up
  2014-06-09 14:49   ` Theodore Ts'o
@ 2014-06-09 14:50     ` Theodore Ts'o
  2014-06-09 14:50       ` [PATCH 2/2] tests: clean up the temp file if test_one is interrupted Theodore Ts'o
  2014-06-09 20:34       ` [PATCH 1/2] tests: fix left-over e2fsprogs-tmp files not getting clean up Andreas Dilger
  0 siblings, 2 replies; 10+ messages in thread
From: Theodore Ts'o @ 2014-06-09 14:50 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: bensberg, Theodore Ts'o

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(-)

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)

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] tests: clean up the temp file if test_one is interrupted
  2014-06-09 14:50     ` [PATCH 1/2] tests: fix left-over e2fsprogs-tmp files not getting clean up Theodore Ts'o
@ 2014-06-09 14:50       ` Theodore Ts'o
  2014-06-09 20:34       ` [PATCH 1/2] tests: fix left-over e2fsprogs-tmp files not getting clean up Andreas Dilger
  1 sibling, 0 replies; 10+ messages in thread
From: Theodore Ts'o @ 2014-06-09 14:50 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: bensberg, Theodore Ts'o

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 tests/test_one.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/test_one.in b/tests/test_one.in
index 01a9260..eb28313 100644
--- a/tests/test_one.in
+++ b/tests/test_one.in
@@ -31,6 +31,7 @@ fi
 test_name=`echo $test_dir | sed -e 's;.*/;;'`
 
 TMPFILE=$(mktemp -t e2fsprogs-tmp-$test_name.XXXXXX)
+trap 'rm -f $TMPFILE ; exit' 1 2 15
 
 if [ -f $test_dir ] ; then
 	exit 0;
-- 
2.0.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] tests: fix left-over e2fsprogs-tmp files not getting clean up
  2014-06-09 14:50     ` [PATCH 1/2] tests: fix left-over e2fsprogs-tmp files not getting clean up Theodore Ts'o
  2014-06-09 14:50       ` [PATCH 2/2] tests: clean up the temp file if test_one is interrupted Theodore Ts'o
@ 2014-06-09 20:34       ` Andreas Dilger
  2014-06-09 23:45         ` Theodore Ts'o
  1 sibling, 1 reply; 10+ messages in thread
From: Andreas Dilger @ 2014-06-09 20:34 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Ext4 Developers List, bensberg

[-- Attachment #1: Type: text/plain, Size: 2989 bytes --]

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






[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] tests: fix left-over e2fsprogs-tmp files not getting clean up
  2014-06-09 20:34       ` [PATCH 1/2] tests: fix left-over e2fsprogs-tmp files not getting clean up Andreas Dilger
@ 2014-06-09 23:45         ` Theodore Ts'o
  2014-06-10  0:47           ` Andreas Dilger
  0 siblings, 1 reply; 10+ messages in thread
From: Theodore Ts'o @ 2014-06-09 23:45 UTC (permalink / raw)
  To: Andreas Dilger; +Cc: Ext4 Developers List, bensberg

On Mon, Jun 09, 2014 at 02:34:45PM -0600, Andreas Dilger wrote:
> 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.

Ah, ok.  How about this then?

						- Ted

>From c34e6a131f049f008945967f2272b7c8efc1b282 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Mon, 9 Jun 2014 10:34:17 -0400
Subject: [PATCH] tests: fix left-over e2fsprogs-tmp files not getting clean up

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         | 5 +++--
 tests/f_mmp_garbage/script | 5 +++--
 tests/m_mmp/script         | 7 +++++--
 tests/t_mmp_1on/script     | 5 +++--
 tests/t_mmp_2off/script    | 5 +++--
 tests/test_one.in          | 5 +++--
 6 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/tests/f_mmp/script b/tests/f_mmp/script
index d921672..664f74f 100644
--- a/tests/f_mmp/script
+++ b/tests/f_mmp/script
@@ -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
diff --git a/tests/f_mmp_garbage/script b/tests/f_mmp_garbage/script
index 02cc12a..6d451a6 100644
--- a/tests/f_mmp_garbage/script
+++ b/tests/f_mmp_garbage/script
@@ -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
diff --git a/tests/m_mmp/script b/tests/m_mmp/script
index 02b0b4b..6a9394d 100644
--- a/tests/m_mmp/script
+++ b/tests/m_mmp/script
@@ -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
diff --git a/tests/t_mmp_1on/script b/tests/t_mmp_1on/script
index 8fc8158..cfed2ca 100644
--- a/tests/t_mmp_1on/script
+++ b/tests/t_mmp_1on/script
@@ -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
diff --git a/tests/t_mmp_2off/script b/tests/t_mmp_2off/script
index 1dee14e..6556201 100644
--- a/tests/t_mmp_2off/script
+++ b/tests/t_mmp_2off/script
@@ -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
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)

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] tests: fix left-over e2fsprogs-tmp files not getting clean up
  2014-06-09 23:45         ` Theodore Ts'o
@ 2014-06-10  0:47           ` Andreas Dilger
  2014-06-10  1:41             ` Theodore Ts'o
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Dilger @ 2014-06-10  0:47 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Ext4 Developers List, bensberg

This looks better.

It would also be good to fix the "make clean" rule to clean up
these temp files. 

Cheers, Andreas

> On Jun 9, 2014, at 17:45, Theodore Ts'o <tytso@mit.edu> wrote:
> 
>> On Mon, Jun 09, 2014 at 02:34:45PM -0600, Andreas Dilger wrote:
>> 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.
> 
> Ah, ok.  How about this then?
> 
>                        - Ted
> 
> From c34e6a131f049f008945967f2272b7c8efc1b282 Mon Sep 17 00:00:00 2001
> From: Theodore Ts'o <tytso@mit.edu>
> Date: Mon, 9 Jun 2014 10:34:17 -0400
> Subject: [PATCH] tests: fix left-over e2fsprogs-tmp files not getting clean up
> 
> 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         | 5 +++--
> tests/f_mmp_garbage/script | 5 +++--
> tests/m_mmp/script         | 7 +++++--
> tests/t_mmp_1on/script     | 5 +++--
> tests/t_mmp_2off/script    | 5 +++--
> tests/test_one.in          | 5 +++--
> 6 files changed, 20 insertions(+), 12 deletions(-)
> 
> diff --git a/tests/f_mmp/script b/tests/f_mmp/script
> index d921672..664f74f 100644
> --- a/tests/f_mmp/script
> +++ b/tests/f_mmp/script
> @@ -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
> diff --git a/tests/f_mmp_garbage/script b/tests/f_mmp_garbage/script
> index 02cc12a..6d451a6 100644
> --- a/tests/f_mmp_garbage/script
> +++ b/tests/f_mmp_garbage/script
> @@ -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
> diff --git a/tests/m_mmp/script b/tests/m_mmp/script
> index 02b0b4b..6a9394d 100644
> --- a/tests/m_mmp/script
> +++ b/tests/m_mmp/script
> @@ -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
> diff --git a/tests/t_mmp_1on/script b/tests/t_mmp_1on/script
> index 8fc8158..cfed2ca 100644
> --- a/tests/t_mmp_1on/script
> +++ b/tests/t_mmp_1on/script
> @@ -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
> diff --git a/tests/t_mmp_2off/script b/tests/t_mmp_2off/script
> index 1dee14e..6556201 100644
> --- a/tests/t_mmp_2off/script
> +++ b/tests/t_mmp_2off/script
> @@ -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
> 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
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] tests: fix left-over e2fsprogs-tmp files not getting clean up
  2014-06-10  0:47           ` Andreas Dilger
@ 2014-06-10  1:41             ` Theodore Ts'o
  0 siblings, 0 replies; 10+ messages in thread
From: Theodore Ts'o @ 2014-06-10  1:41 UTC (permalink / raw)
  To: Andreas Dilger; +Cc: Ext4 Developers List, bensberg

On Mon, Jun 09, 2014 at 06:47:51PM -0600, Andreas Dilger wrote:
> 
> It would also be good to fix the "make clean" rule to clean up
> these temp files. 

The second patch should take care of nuking them the temp file when
the user types control-C.  I wouldn't be against deleting tmp files in
the build directory, but I wouldn't want to delete files in /tmp as
part of a make clean rule --- consider what might happen if the the
user types "make clean" in one build tree while running "make check"
in another.

					- Ted

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-06-10  1:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-04 12:28 [PATCH] tests: for mktemp the exes must be the final characters of the name Benno Schulenberg
2014-06-04 22:31 ` Andreas Dilger
2014-06-05  3:28   ` Theodore Ts'o
2014-06-09 14:49   ` Theodore Ts'o
2014-06-09 14:50     ` [PATCH 1/2] tests: fix left-over e2fsprogs-tmp files not getting clean up Theodore Ts'o
2014-06-09 14:50       ` [PATCH 2/2] tests: clean up the temp file if test_one is interrupted Theodore Ts'o
2014-06-09 20:34       ` [PATCH 1/2] tests: fix left-over e2fsprogs-tmp files not getting clean up Andreas Dilger
2014-06-09 23:45         ` Theodore Ts'o
2014-06-10  0:47           ` Andreas Dilger
2014-06-10  1:41             ` Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.