summaryrefslogtreecommitdiffstats
path: root/tests/basic/afr
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2016-01-20 14:58:48 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-01-25 03:36:32 -0800
commitfa6545a323df920768dd25989537e6a350c10432 (patch)
treebc11f0bf06a1c51bbcaf66330292bfea6aa5d58f /tests/basic/afr
parent4e9ef2cc5ca8f5568bfb6328a756f4a824f69639 (diff)
tests: Fix sparse-file-self-heal.t
Backport of http://review.gluster.org/13233 Psuedo Problem: https://build.gluster.org/job/rackspace-regression-2GB-triggered/16682/consoleFull The 'zeroedfile' disk usage comparision which is failing in this .t file fails so only on XFS. The test passes when the backend is on a s̶a̶n̶e̶r̶ different filesystem like EXT4 or BTRFS. This is due to the speculative preallocation in XFS which can reserve different disk space on different XFS mounts for the same version and same file operation. See BZ 1277992 for an example of XFS behaviour. Fix: Don't compare the disk usage of the file on the bricks of the replica: instead, check that the disk space consumed is atleast equal to the size of the file. Also remove sparse-file-self-heal.t from is_bad_test() Change-Id: If43f59549136ebf91f17ff9d958954b3587afe56 BUG: 1300210 Signed-off-by: Ravishankar N <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/13265 Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'tests/basic/afr')
-rw-r--r--tests/basic/afr/sparse-file-self-heal.t32
1 files changed, 22 insertions, 10 deletions
diff --git a/tests/basic/afr/sparse-file-self-heal.t b/tests/basic/afr/sparse-file-self-heal.t
index a8fc095ad26..67d9c4f5182 100644
--- a/tests/basic/afr/sparse-file-self-heal.t
+++ b/tests/basic/afr/sparse-file-self-heal.t
@@ -80,11 +80,17 @@ EXPECT "1" has_holes $B0/${V0}0/big2bigger
USED_KB=`du -s $B0/${V0}0/FILE|cut -f1`
TEST [ $USED_KB -lt 1000000 ]
-#Check that the non-sparse file consumes the same disk space in both bricks post
-#self-heal
-USED_KB1=`du -s $B0/${V0}0/zeroedfile|cut -f1`
-USED_KB2=`du -s $B0/${V0}1/zeroedfile|cut -f1`
-TEST [ $USED_KB1 -eq $USED_KB2 ]
+#Check that the non-sparse file has the same file size on both bricks and that
+#the disk usage is greater than or equal to the file size. We could have checked
+#that the disk usage is just equal to the file size but XFS does speculative
+#preallocation due to which disk usage can be more than the file size.
+STAT_SIZE1=$(stat -c "%s" $B0/${V0}0/zeroedfile)
+STAT_SIZE2=$(stat -c "%s" $B0/${V0}1/zeroedfile)
+TEST [ $STAT_SIZE1 -eq $STAT_SIZE2 ]
+USED_KB1="$((`stat -c %b $B0/${V0}0/zeroedfile` * `stat -c %B $B0/${V0}0/zeroedfile`))"
+TEST [ $USED_KB1 -ge $STAT_SIZE1 ]
+USED_KB2="$((`stat -c %b $B0/${V0}1/zeroedfile` * `stat -c %B $B0/${V0}1/zeroedfile`))"
+TEST [ $USED_KB2 -ge $STAT_SIZE2 ]
TEST rm -f $M0/*
@@ -150,10 +156,16 @@ EXPECT "0" has_holes $B0/${V0}0/small
USED_KB=`du -s $B0/${V0}0/FILE|cut -f1`
TEST [ $USED_KB -lt 1000000 ]
-#Check that the non-sparse file consumes the same disk space in both bricks post
-#self-heal.
-USED_KB1=`du -s $B0/${V0}0/zeroedfile|cut -f1`
-USED_KB2=`du -s $B0/${V0}1/zeroedfile|cut -f1`
-TEST [ $USED_KB1 -eq $USED_KB2 ]
+#Check that the non-sparse file has the same file size on both bricks and that
+#the disk usage is greater than or equal to the file size. We could have checked
+#that the disk usage is just equal to the file size but XFS does speculative
+#preallocation due to which disk usage can be more than the file size.
+STAT_SIZE1=$(stat -c "%s" $B0/${V0}0/zeroedfile)
+STAT_SIZE2=$(stat -c "%s" $B0/${V0}1/zeroedfile)
+TEST [ $STAT_SIZE1 -eq $STAT_SIZE2 ]
+USED_KB1="$((`stat -c %b $B0/${V0}0/zeroedfile` * `stat -c %B $B0/${V0}0/zeroedfile`))"
+TEST [ $USED_KB1 -ge $STAT_SIZE1 ]
+USED_KB2="$((`stat -c %b $B0/${V0}1/zeroedfile` * `stat -c %B $B0/${V0}1/zeroedfile`))"
+TEST [ $USED_KB2 -ge $STAT_SIZE2 ]
cleanup