[PATCH 02/24] generic/60[01]: fix test failure when setting new grace limit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

The setquota command can extend a quota grace period by a certain number
of seconds.  The extension is provided as a number of seconds relative
to right now.  However, if the system clock increments the seconds count
after this test assigns $now but before setquota gets called, the test
will fail because $get and $set will be off by that 1 second.  Allow for
that.

Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
 tests/generic/600 |    4 +++-
 tests/generic/601 |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)


diff --git a/tests/generic/600 b/tests/generic/600
index 7ea0d6c2..42e4ee55 100755
--- a/tests/generic/600
+++ b/tests/generic/600
@@ -60,7 +60,9 @@ let set=now+100
 setquota -T -u $qa_user 0 100 $SCRATCH_MNT 2>&1 | grep -v "^setquota"
 get=`repquota -up $SCRATCH_MNT | grep  "^$qa_user" | awk '{print $NF}'`
 
-if [ "$get" != "$set" ]; then
+# Either the new expiry must match; or be one second after the set time, to
+# deal with the seconds counter incrementing.
+if [ "$get" != "$set" ] && [ "$get" -ne "$((set + 1))" ]; then
 	echo "set grace to $set but got grace $get"
 fi
 
diff --git a/tests/generic/601 b/tests/generic/601
index 1baa6a90..b412ee8a 100755
--- a/tests/generic/601
+++ b/tests/generic/601
@@ -71,7 +71,9 @@ $XFS_QUOTA_PROG -x -c "timer -u -i 100 $qa_user" $SCRATCH_MNT
 # raw ("since epoch") grace expiry
 get=`repquota -up $SCRATCH_MNT | grep  "^$qa_user" | awk '{print $NF}'`
 
-if [ "$get" != "$set" ]; then
+# Either the new expiry must match; or be one second after the set time, to
+# deal with the seconds counter incrementing.
+if [ "$get" != "$set" ] && [ "$get" -ne "$((set + 1))" ]; then
 	echo "set grace to $set but got grace $get"
 fi
 




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux