public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfstests 273 274 275: do test in dedicated dir and leave test files in it
@ 2012-01-12 17:20 Eryu Guan
  2012-01-27 11:01 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Eryu Guan @ 2012-01-12 17:20 UTC (permalink / raw)
  To: xfs; +Cc: Eryu Guan

Do all testings in dedicated dir($SCRATCH_MNT/$seq) instead of
$SCRATCH_MNT and don't remove test files in _cleanup() for debug
purpose.

Signed-off-by: Eryu Guan <guaneryu@gmail.com>
---
 273 |   14 ++++++++------
 274 |    9 ++++++---
 275 |    9 ++++++---
 3 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/273 b/273
index 2965132..a7f14c1 100755
--- a/273
+++ b/273
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
 	cd /
-	rm -rf $SCRATCH_MNT/* $tmp.*
+	rm -rf $tmp.*
 	_scratch_unmount
 }
 
@@ -44,6 +44,7 @@ _cleanup()
 
 threads=50
 count=1
+WORK_DIR="$SCRATCH_MNT/$seq"
 
 _threads_set()
 {
@@ -59,14 +60,14 @@ _file_create()
 {
 	_i=0
 
-	if ! mkdir $SCRATCH_MNT/origin
+	if ! mkdir $WORK_DIR/origin
 	then
 		echo "mkdir origin err"
 		status=1
 		exit
 	fi
 
-	cd $SCRATCH_MNT/origin
+	cd $WORK_DIR/origin
 
 	_disksize=`df --block-size=1 | grep $SCRATCH_DEV | awk '{print $2}'`
 	_disksize=$(($_disksize / 3))
@@ -85,14 +86,14 @@ _porter()
 {
 	_suffix=$1
 
-	if ! mkdir $SCRATCH_MNT/sub_$_suffix
+	if ! mkdir $WORK_DIR/sub_$_suffix
 	then
 		echo "mkdir sub_xxx err"
 		status=1
 		exit
 	fi
 
-	cp -r $SCRATCH_MNT/origin $SCRATCH_MNT/sub_$_suffix >$seq.full 2>&1
+	cp -r $WORK_DIR/origin $WORK_DIR/sub_$_suffix >$seq.full 2>&1
 	if [ $? -ne 0 ]
 	then
 		echo "_porter $_suffix not complete"
@@ -106,7 +107,8 @@ _do_workload()
 	_pids=""
 	_pid=1
 	
-	rm -rf $SCRATCH_MNT/*
+	rm -rf $WORK_DIR
+	mkdir -p $WORK_DIR
 
 	_threads_set
 	_file_create
diff --git a/274 b/274
index b658004..c351c40 100755
--- a/274
+++ b/274
@@ -35,13 +35,15 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
 	cd /
-	rm -f $SCRATCH_MNT/* $tmp.*
+	rm -f $tmp.*
 	_scratch_unmount
 }
 
 . ./common.rc
 . ./common.filter
 
+WORK_DIR="$SCRATCH_MNT/$seq"
+
 # real QA test starts here
 _supported_fs generic
 _supported_os IRIX Linux
@@ -57,8 +59,9 @@ umount $SCRATCH_DEV 2>/dev/null
 _scratch_mkfs_sized $((1 * 1024 * 1024 * 1024)) >>$seq.full 2>&1
 _scratch_mount
 
-rm -rf $SCRATCH_MNT/*
-cd $SCRATCH_MNT
+rm -rf $WORK_DIR
+mkdir -p $WORK_DIR
+cd $WORK_DIR
 dd if=/dev/zero of=test bs=4K count=1 >/dev/null 2>&1
 if [ $? -ne 0 ]
 then
diff --git a/275 b/275
index 214262e..7a4d414 100755
--- a/275
+++ b/275
@@ -36,13 +36,15 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
 	cd /
-	rm -f $SCRATCH_MNT/* $tmp.*
+	rm -f $tmp.*
 	_scratch_unmount
 }
 
 . ./common.rc
 . ./common.filter
 
+WORK_DIR="$SCRATCH_MNT/$seq"
+
 # real QA test starts here
 _supported_fs generic
 _supported_os IRIX Linux
@@ -58,8 +60,9 @@ umount $SCRATCH_DEV 2>/dev/null
 _scratch_mkfs_sized $((1 * 1024 * 1024 * 1024)) >>$seq.full 2>&1
 _scratch_mount
 
-rm -rf $SCRATCH_MNT/*
-cd $SCRATCH_MNT
+rm -rf $WORK_DIR
+mkdir -p $WORK_DIR
+cd $WORK_DIR
 
 dd if=/dev/zero of=tmp1 bs=4K count=1 >/dev/null 2>&1
 if [ $? -ne 0 ]
-- 
1.7.8.3

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH] xfstests 273 274 275: do test in dedicated dir and leave test files in it
  2012-01-12 17:20 [PATCH] xfstests 273 274 275: do test in dedicated dir and leave test files in it Eryu Guan
@ 2012-01-27 11:01 ` Christoph Hellwig
  2012-01-27 16:28   ` Eryu Guan
  2012-01-27 20:42 ` Eric Sandeen
  2012-01-27 21:16 ` Eric Sandeen
  2 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2012-01-27 11:01 UTC (permalink / raw)
  To: Eryu Guan; +Cc: xfs

On Fri, Jan 13, 2012 at 01:20:15AM +0800, Eryu Guan wrote:
> Do all testings in dedicated dir($SCRATCH_MNT/$seq) instead of
> $SCRATCH_MNT and don't remove test files in _cleanup() for debug
> purpose.

What it the dedicated directory useful for?

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH] xfstests 273 274 275: do test in dedicated dir and leave test files in it
  2012-01-27 11:01 ` Christoph Hellwig
@ 2012-01-27 16:28   ` Eryu Guan
  0 siblings, 0 replies; 5+ messages in thread
From: Eryu Guan @ 2012-01-27 16:28 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Fri, Jan 27, 2012 at 7:01 PM, Christoph Hellwig <hch@infradead.org> wrote:
> On Fri, Jan 13, 2012 at 01:20:15AM +0800, Eryu Guan wrote:
>> Do all testings in dedicated dir($SCRATCH_MNT/$seq) instead of
>> $SCRATCH_MNT and don't remove test files in _cleanup() for debug
>> purpose.
>
> What it the dedicated directory useful for?

fsck.extN will complain lost+found is missing and fail 273. So my first try is
creating lost+found explicitly after removing everything in $SCRATCH_MNT.
Please see http://oss.sgi.com/archives/xfs/2012-01/msg00092.html
The whole point here is to avoid such fsck errors.

And as Dave suggested, 273 274 275 should put all files in a dedicated location
and just remove that dir instead of removing all files in
$SCRATCH_MNT. So I sent
out this as a second try. Perhaps I should mark it as v2...

Thanks,
Eryu Guan

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH] xfstests 273 274 275: do test in dedicated dir and leave test files in it
  2012-01-12 17:20 [PATCH] xfstests 273 274 275: do test in dedicated dir and leave test files in it Eryu Guan
  2012-01-27 11:01 ` Christoph Hellwig
@ 2012-01-27 20:42 ` Eric Sandeen
  2012-01-27 21:16 ` Eric Sandeen
  2 siblings, 0 replies; 5+ messages in thread
From: Eric Sandeen @ 2012-01-27 20:42 UTC (permalink / raw)
  To: Eryu Guan; +Cc: xfs

On 1/12/12 11:20 AM, Eryu Guan wrote:
> Do all testings in dedicated dir($SCRATCH_MNT/$seq) instead of
> $SCRATCH_MNT and don't remove test files in _cleanup() for debug
> purpose.
> 
> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
> ---
...

> diff --git a/274 b/274
> index b658004..c351c40 100755
> --- a/274
> +++ b/274
> @@ -35,13 +35,15 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _cleanup()
>  {
>  	cd /
> -	rm -f $SCRATCH_MNT/* $tmp.*
> +	rm -f $tmp.*
>  	_scratch_unmount
>  }
>  
>  . ./common.rc
>  . ./common.filter
>  
> +WORK_DIR="$SCRATCH_MNT/$seq"
> +
>  # real QA test starts here
>  _supported_fs generic
>  _supported_os IRIX Linux
> @@ -57,8 +59,9 @@ umount $SCRATCH_DEV 2>/dev/null
>  _scratch_mkfs_sized $((1 * 1024 * 1024 * 1024)) >>$seq.full 2>&1
>  _scratch_mount
>  
> -rm -rf $SCRATCH_MNT/*
> -cd $SCRATCH_MNT
> +rm -rf $WORK_DIR
> +mkdir -p $WORK_DIR
> +cd $WORK_DIR

I think this test could use more work; for one, I don't like cd-ing into
the dir, because then if you send output to $seq.full it doesn't go
where you expect it.  I'd rather not cd, and:

>  dd if=/dev/zero of=test bs=4K count=1 >/dev/null 2>&1

dd if=/dev/zero of=$WORK_DIR/test bs=4K count=1 >/dev/null 2>&1

then specify the full path to the files instead.

TBH I'm still trying to work out what exactly 274 is supposed to test;
there are no comments about the behavior other than:

# preallocation test

As a general plea to those writing tests, _please_ include a concise
but descriptive comment at the top so that the user knows just what
the test tests, and how it tests it.  Inline comments help too;
bash isn't always so easy to read.

I'm thinking that an overhaul for 273 and 274 like I did for
275 might be in order...

-Eric

>  if [ $? -ne 0 ]
>  then
> diff --git a/275 b/275
> index 214262e..7a4d414 100755
> --- a/275
> +++ b/275
> @@ -36,13 +36,15 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _cleanup()
>  {
>  	cd /
> -	rm -f $SCRATCH_MNT/* $tmp.*
> +	rm -f $tmp.*
>  	_scratch_unmount
>  }
>  
>  . ./common.rc
>  . ./common.filter
>  
> +WORK_DIR="$SCRATCH_MNT/$seq"
> +
>  # real QA test starts here
>  _supported_fs generic
>  _supported_os IRIX Linux
> @@ -58,8 +60,9 @@ umount $SCRATCH_DEV 2>/dev/null
>  _scratch_mkfs_sized $((1 * 1024 * 1024 * 1024)) >>$seq.full 2>&1
>  _scratch_mount
>  
> -rm -rf $SCRATCH_MNT/*
> -cd $SCRATCH_MNT
> +rm -rf $WORK_DIR
> +mkdir -p $WORK_DIR
> +cd $WORK_DIR
>  
>  dd if=/dev/zero of=tmp1 bs=4K count=1 >/dev/null 2>&1
>  if [ $? -ne 0 ]

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH] xfstests 273 274 275: do test in dedicated dir and leave test files in it
  2012-01-12 17:20 [PATCH] xfstests 273 274 275: do test in dedicated dir and leave test files in it Eryu Guan
  2012-01-27 11:01 ` Christoph Hellwig
  2012-01-27 20:42 ` Eric Sandeen
@ 2012-01-27 21:16 ` Eric Sandeen
  2 siblings, 0 replies; 5+ messages in thread
From: Eric Sandeen @ 2012-01-27 21:16 UTC (permalink / raw)
  To: Eryu Guan; +Cc: xfs

On 1/12/12 11:20 AM, Eryu Guan wrote:
> Do all testings in dedicated dir($SCRATCH_MNT/$seq) instead of
> $SCRATCH_MNT and don't remove test files in _cleanup() for debug
> purpose.
> 
> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
> ---
...


> @@ -58,8 +60,9 @@ umount $SCRATCH_DEV 2>/dev/null
>  _scratch_mkfs_sized $((1 * 1024 * 1024 * 1024)) >>$seq.full 2>&1
>  _scratch_mount
>  
> -rm -rf $SCRATCH_MNT/*
> -cd $SCRATCH_MNT
> +rm -rf $WORK_DIR
> +mkdir -p $WORK_DIR

Seems like the simplest solution is to just not rm -rf _anything_ immediately
after the mkfs.  Why bother?  All it does is remove lost+found/ ... wouldn't
it be simpler to just remove that one line?

-Eric

> +cd $WORK_DIR
>  
>  dd if=/dev/zero of=tmp1 bs=4K count=1 >/dev/null 2>&1
>  if [ $? -ne 0 ]

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

end of thread, other threads:[~2012-01-27 21:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-12 17:20 [PATCH] xfstests 273 274 275: do test in dedicated dir and leave test files in it Eryu Guan
2012-01-27 11:01 ` Christoph Hellwig
2012-01-27 16:28   ` Eryu Guan
2012-01-27 20:42 ` Eric Sandeen
2012-01-27 21:16 ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox