Message ID | 1401884926-31722-1-git-send-email-bensberg@justemail.net |
---|---|
State | Superseded, archived |
Headers | show |
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
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 -- 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
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 -- 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
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
Signed-off-by: Benno Schulenberg <bensberg@justemail.net> --- tests/scripts/resize_test | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)