public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] generic/297: fix the delta time based on stat
@ 2022-06-10  2:35 Wang Yugui
  2022-06-10  4:24 ` Zorro Lang
  0 siblings, 1 reply; 7+ messages in thread
From: Wang Yugui @ 2022-06-10  2:35 UTC (permalink / raw)
  To: fstests; +Cc: Wang Yugui

stat -c '%Y' report seconds as int, so the delta 2.01s may result as 3s.

Signed-off-by: Wang Yugui <wangyugui@e16-tech.com>
---
 tests/generic/297 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/generic/297 b/tests/generic/297
index 6bdc3e1c..e3082202 100755
--- a/tests/generic/297
+++ b/tests/generic/297
@@ -51,7 +51,7 @@ for i in $(seq 0 $fnr); do
 	touch $TEST_DIR/after
 	before=$(stat -c '%Y' $TEST_DIR/before)
 	after=$(stat -c '%Y' $TEST_DIR/after)
-	delta=$((after - before))
+	delta=$((after - before -1)) # 2.01s may result as 3s; so -1
 	test $delta -gt $timeout && break
 done
 
@@ -64,7 +64,7 @@ $TIMEOUT_PROG -s INT ${kill_after}s $XFS_IO_PROG -f -c "reflink $testdir/file1 0
 touch $TEST_DIR/after
 before=$(stat -c '%Y' $TEST_DIR/before)
 after=$(stat -c '%Y' $TEST_DIR/after)
-delta=$((after - before))
+delta=$((after - before - 1)) # 2.01s may result as 3s; so -1
 echo "reflink of $n bytes took $delta seconds" >> $seqres.full
 test $delta -gt $timeout && _fail "reflink didn't stop in time, n=$n t=$delta"
 
-- 
2.36.1


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

end of thread, other threads:[~2022-06-10  6:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-10  2:35 [PATCH] generic/297: fix the delta time based on stat Wang Yugui
2022-06-10  4:24 ` Zorro Lang
2022-06-10  4:36   ` Wang Yugui
2022-06-10  5:03     ` Dave Chinner
2022-06-10  5:12       ` Wang Yugui
2022-06-10  5:19     ` Zorro Lang
2022-06-10  6:00       ` Wang Yugui

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