diff mbox

xfstests: generic/315: allow a little tolerance for our used check

Message ID 1375124156-17620-1-git-send-email-jbacik@fusionio.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Josef Bacik July 29, 2013, 6:55 p.m. UTC
So df in btrfs is tricky at best, and relying on it for accurate information is
not great, but it's the best way to verify this test.  To get around btrfs being
inconsistent sometimes just use _within_tolerance to check our new df value to
make sure that our truncate did something.  With this patch I no longer see
transient failures of this test.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
---
 tests/generic/315 |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

jeff.liu July 30, 2013, 3:48 a.m. UTC | #1
On 07/30/2013 02:55 AM, Josef Bacik wrote:

> So df in btrfs is tricky at best, and relying on it for accurate information is
> not great, but it's the best way to verify this test.  To get around btrfs being
> inconsistent sometimes just use _within_tolerance to check our new df value to
> make sure that our truncate did something.  With this patch I no longer see
> transient failures of this test.  Thanks,
> 
> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
> ---
>  tests/generic/315 |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/tests/generic/315 b/tests/generic/315
> index 7cfc40d..9c01b5e 100644
> --- a/tests/generic/315
> +++ b/tests/generic/315
> @@ -73,7 +73,8 @@ sync
>  
>  # Preallocated disk space should be released
>  avail_done=`df -P $TEST_DIR | awk 'END {print $4}'`
> -[ "$avail_done" -eq "$avail_begin" ] || _fail "Available disk space ($avail_done KiB)"
> +_within_tolerance "df" $avail_done $avail_begin 1%
> +[ $? -eq 0 ] || _fail "Available disk space ($avail_done KiB) wanted ($avail_begin KiB)"

Looks good to me.
Reviewed-by: Jie Liu <jeff.liu@oracle.com>

Thanks,
-Jeff
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Myers July 30, 2013, 6:51 p.m. UTC | #2
On Tue, Jul 30, 2013 at 11:48:10AM +0800, Jeff Liu wrote:
> On 07/30/2013 02:55 AM, Josef Bacik wrote:
> 
> > So df in btrfs is tricky at best, and relying on it for accurate information is
> > not great, but it's the best way to verify this test.  To get around btrfs being
> > inconsistent sometimes just use _within_tolerance to check our new df value to
> > make sure that our truncate did something.  With this patch I no longer see
> > transient failures of this test.  Thanks,
> > 
> > Signed-off-by: Josef Bacik <jbacik@fusionio.com>
> > ---
> >  tests/generic/315 |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> > 
> > diff --git a/tests/generic/315 b/tests/generic/315
> > index 7cfc40d..9c01b5e 100644
> > --- a/tests/generic/315
> > +++ b/tests/generic/315
> > @@ -73,7 +73,8 @@ sync
> >  
> >  # Preallocated disk space should be released
> >  avail_done=`df -P $TEST_DIR | awk 'END {print $4}'`
> > -[ "$avail_done" -eq "$avail_begin" ] || _fail "Available disk space ($avail_done KiB)"
> > +_within_tolerance "df" $avail_done $avail_begin 1%
> > +[ $? -eq 0 ] || _fail "Available disk space ($avail_done KiB) wanted ($avail_begin KiB)"
> 
> Looks good to me.
> Reviewed-by: Jie Liu <jeff.liu@oracle.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tests/generic/315 b/tests/generic/315
index 7cfc40d..9c01b5e 100644
--- a/tests/generic/315
+++ b/tests/generic/315
@@ -73,7 +73,8 @@  sync
 
 # Preallocated disk space should be released
 avail_done=`df -P $TEST_DIR | awk 'END {print $4}'`
-[ "$avail_done" -eq "$avail_begin" ] || _fail "Available disk space ($avail_done KiB)"
+_within_tolerance "df" $avail_done $avail_begin 1%
+[ $? -eq 0 ] || _fail "Available disk space ($avail_done KiB) wanted ($avail_begin KiB)"
 
 # success, all done
 exit