public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* xfstests: fix 108 through config mechanism
@ 2010-12-09 14:40 Boris Ranto
  2010-12-10 14:37 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Boris Ranto @ 2010-12-09 14:40 UTC (permalink / raw)
  To: xfs

Test case 108 can fail beacuse of the incorrect amount of spaces in its output.
This can be overrided by passing -b option to diff (quotation of man page):
       -b  --ignore-space-change
              Ignore changes in the amount of white space.

Since there is currently no mechanism to pass any option to diff I suggest following mechanism:
Every test can have its config file ($sef.config) where all its test-run configuration can be stored.
Also it should contain variable CONFIG_OPTIONS that specifies what options are created/modified.
The check script'll only source the config file if it exists and unset all the modified variables that are listed in CONFIG_OPTIONS variable once they're not needed.

This configuration mechanism could (with additional patch to the file check) also help handle multiple output files that might be beneficial in few test cases.

Patch that fixes test case 108 and adds described mechanism of test configuration:

diff -urpN a/xfstests/108.config b/xfstests/108.config
--- a/xfstests/108.config       1970-01-01 01:00:00.000000000 +0100
+++ b/xfstests/108.config       2010-12-09 11:24:51.626367533 +0100
@@ -0,0 +1,2 @@
+export CONFIG_OPTIONS="DIFF_OPTIONS CONFIG_OPTIONS"
+export DIFF_OPTIONS="-b"
diff -urpN a/xfstests/check b/xfstests/check
--- a/xfstests/check    2010-12-09 11:34:26.709247611 +0100
+++ b/xfstests/check    2010-12-09 11:37:13.857370558 +0100
@@ -226,6 +226,11 @@ do
     else
        # really going to try and run this one
        #
+       CONFIG_OPTIONS="CONFIG_OPTIONS"
+       if [ -f $seq.config ]
+       then
+               source $seq.config
+       fi
        rm -f $seq.out.bad
        lasttime=`sed -n -e "/^$seq /s/.* //p" <check.time`
        if [ "X$lasttime" != X ]; then
@@ -273,7 +278,7 @@ do
                echo " - no qualified output"
                err=true
            else
-               if diff $seq.out $tmp.out >/dev/null 2>&1
+               if diff $DIFF_OPTIONS $seq.out $tmp.out >/dev/null 2>&1
                then
                    if $err
                    then
@@ -286,12 +291,12 @@ do
                else
                    echo " - output mismatch (see $seq.out.bad)"
                    mv $tmp.out $seq.out.bad
-                   $diff $seq.out $seq.out.bad
+                   $diff $DIFF_OPTIONS $seq.out $seq.out.bad
                    err=true
                fi
            fi
        fi
-
+       unset $CONFIG_OPTIONS
     fi

     # come here for each test, except when $showme is true

Signed-off-by: Boris Ranto <branto@redhat.com>

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

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

* Re: xfstests: fix 108 through config mechanism
  2010-12-09 14:40 xfstests: fix 108 through config mechanism Boris Ranto
@ 2010-12-10 14:37 ` Christoph Hellwig
  2010-12-14 14:53   ` Boris Ranto
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2010-12-10 14:37 UTC (permalink / raw)
  To: Boris Ranto; +Cc: xfs

I don't rally like the per-test option.  What about adding a
_filter_xfs_quota helper that uses sed to output a canonical
number of whitespaces?

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

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

* Re: xfstests: fix 108 through config mechanism
  2010-12-10 14:37 ` Christoph Hellwig
@ 2010-12-14 14:53   ` Boris Ranto
  2010-12-14 19:17     ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Boris Ranto @ 2010-12-14 14:53 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Fri, 2010-12-10 at 09:37 -0500, Christoph Hellwig wrote:
> I don't rally like the per-test option.  What about adding a
> _filter_xfs_quota helper that uses sed to output a canonical
> number of whitespaces?
> 

I didn't like it much either but I found it quite easy to implement with quite high probability of future usage.

I found the following modification sufficient although I'm not sure I put the _filter_spaces in right place (I'd say it's quite universal so it could find a usage in other cases):

diff -urpN a/xfstests/108 b/xfstests/108
--- a/xfstests/108	2010-12-09 11:34:37.733245986 +0100
+++ b/xfstests/108	2010-12-14 14:50:16.813494309 +0100
@@ -72,9 +72,9 @@ test_accounting()
 	for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
 		$here/src/lstat64 $file | head -3 | _filter_scratch
 	done
-	xfs_quota -c "quota -hnb -$type $id" $QARGS | _filter_scratch
-	xfs_quota -c "quota -hni -$type $id" $QARGS | _filter_scratch
-	xfs_quota -c "quota -hnr -$type $id" $QARGS | _filter_scratch
+	xfs_quota -c "quota -hnb -$type $id" $QARGS | _filter_scratch | _filter_spaces
+	xfs_quota -c "quota -hni -$type $id" $QARGS | _filter_scratch | _filter_spaces
+	xfs_quota -c "quota -hnr -$type $id" $QARGS | _filter_scratch | _filter_spaces
 }
 
 export MOUNT_OPTIONS="-opquota"
diff -urpN a/xfstests/108.out b/xfstests/108.out
--- a/xfstests/108.out	2010-12-09 11:24:48.973251551 +0100
+++ b/xfstests/108.out	2010-12-14 15:01:33.640484268 +0100
@@ -32,11 +32,11 @@ projid = 3
   Size: 16777216     Filetype: Regular File
   Mode: (0600/-rw-------)         Uid: (1)  Gid: (2)
 Disk quotas for User #1 (1)
-Filesystem   Blocks  Quota  Limit Warn/Time    Mounted on
-SCRATCH_DEV        48M      0      0  00 [------] SCRATCH_MNT
+Filesystem Blocks Quota Limit Warn/Time Mounted on
+SCRATCH_DEV 48M 0 0 00 [------] SCRATCH_MNT
 Disk quotas for User #1 (1)
-Filesystem    Files  Quota  Limit Warn/Time    Mounted on
-SCRATCH_DEV          3      0      0  00 [------] SCRATCH_MNT
+Filesystem Files Quota Limit Warn/Time Mounted on
+SCRATCH_DEV 3 0 0 00 [------] SCRATCH_MNT
 
 ### test group accounting
 
@@ -64,11 +64,11 @@ projid = 3
   Size: 16777216     Filetype: Regular File
   Mode: (0600/-rw-------)         Uid: (1)  Gid: (2)
 Disk quotas for Group #2 (2)
-Filesystem   Blocks  Quota  Limit Warn/Time    Mounted on
-SCRATCH_DEV        48M      0      0  00 [------] SCRATCH_MNT
+Filesystem Blocks Quota Limit Warn/Time Mounted on
+SCRATCH_DEV 48M 0 0 00 [------] SCRATCH_MNT
 Disk quotas for Group #2 (2)
-Filesystem    Files  Quota  Limit Warn/Time    Mounted on
-SCRATCH_DEV          3      0      0  00 [------] SCRATCH_MNT
+Filesystem Files Quota Limit Warn/Time Mounted on
+SCRATCH_DEV 3 0 0 00 [------] SCRATCH_MNT
 
 ### create files, setting up ownership (type=p)
   File: "SCRATCH_MNT/buffer"
@@ -94,8 +94,8 @@ projid = 3
   Size: 16777216     Filetype: Regular File
   Mode: (0600/-rw-------)         Uid: (1)  Gid: (2)
 Disk quotas for Project #3 (3)
-Filesystem   Blocks  Quota  Limit Warn/Time    Mounted on
-SCRATCH_DEV        48M      0      0  00 [------] SCRATCH_MNT
+Filesystem Blocks Quota Limit Warn/Time Mounted on
+SCRATCH_DEV 48M 0 0 00 [------] SCRATCH_MNT
 Disk quotas for Project #3 (3)
-Filesystem    Files  Quota  Limit Warn/Time    Mounted on
-SCRATCH_DEV          3      0      0  00 [------] SCRATCH_MNT
+Filesystem Files Quota Limit Warn/Time Mounted on
+SCRATCH_DEV 3 0 0 00 [------] SCRATCH_MNT
diff -urpN a/xfstests/common.filter b/xfstests/common.filter
--- a/xfstests/common.filter	2010-12-09 11:24:44.315240233 +0100
+++ b/xfstests/common.filter	2010-12-14 14:45:53.566228712 +0100
@@ -224,5 +224,10 @@ _filter_scratch()
 	sed -e "s,$SCRATCH_DEV,SCRATCH_DEV,g" -e "s,$SCRATCH_MNT,SCRATCH_MNT,g"
 }
 
+_filter_spaces()
+{
+	sed -e 's/ [ ]*/ /g'
+}
+
 # make sure this script returns success
 /bin/true

Signed-off-by: Boris Ranto <branto@redhat.com>

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

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

* Re: xfstests: fix 108 through config mechanism
  2010-12-14 14:53   ` Boris Ranto
@ 2010-12-14 19:17     ` Christoph Hellwig
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2010-12-14 19:17 UTC (permalink / raw)
  To: Boris Ranto; +Cc: Christoph Hellwig, xfs

On Tue, Dec 14, 2010 at 03:53:37PM +0100, Boris Ranto wrote:
> I didn't like it much either but I found it quite easy to implement with quite high probability of future usage.
> 
> I found the following modification sufficient although I'm not sure I put the _filter_spaces in right place (I'd say it's quite universal so it could find a usage in other cases):

This patch looks good to me.  Can you resent it in the correct format:

 - a descriptive subject
 - mail body containing a short explanation, than the signed-off-by
   line, then the actual patch.

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

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

end of thread, other threads:[~2010-12-14 19:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-09 14:40 xfstests: fix 108 through config mechanism Boris Ranto
2010-12-10 14:37 ` Christoph Hellwig
2010-12-14 14:53   ` Boris Ranto
2010-12-14 19:17     ` Christoph Hellwig

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