On 09/03/19 23:22, Pádraig Brady wrote:
> On 07/03/19 15:50, Assaf Gordon wrote:
> I can't repro the test-N failures, on solaris 10 or 11,
> on tmpfs or nfs. What file system are you running those
> SunOS tests on? Should we restrict the test to local file systems.
> I'm guessing the stat(1) is updating atime.

Looking at your logs I see this is only for
the first test for newly created files.
Perhaps the subsecond components of [am]time differ on those systems?
Attached is a patch to include the subsecond part in the comparison.

cheers,
Pádraig
>From 8e2682ae45cbe7dfe41e93738f00ae80d75abd3a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Sat, 9 Mar 2019 23:48:06 -0800
Subject: [PATCH] tests: test-N: fix false failure on SunOS

* tests/misc/test-N.sh: The subsecond values for atime and mtime
were seen to differ for newly created files on SunOS.
So we include the subsecond portion when comparing stat values.
Reported by Assaf Gordon
---
 tests/misc/test-N.sh | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tests/misc/test-N.sh b/tests/misc/test-N.sh
index e4a95c8..d7f0aa9 100755
--- a/tests/misc/test-N.sh
+++ b/tests/misc/test-N.sh
@@ -19,9 +19,13 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ test stat
 
-stat_mtime() { env stat -c '%Y' "$1"; }
-stat_atime() { env stat -c '%X' "$1"; }
-stat_test_N() { env test "$(stat_mtime "$1")" -gt "$(stat_atime "$1")"; }
+stat_test_N() {
+  mtime=$(env stat -c '%.Y' "$1")
+  atime=$(env stat -c '%.X' "$1")
+  test "$mtime" = "$atime" && return 1
+  latest=$(printf '%s\n' "$mtime" "$atime" | sort -g | tail -n1)
+  test "$mtime" = "$latest"
+}
 
 # For a freshly touched file, atime should equal mtime: 'test -N' returns 1.
 touch file || framework_failure_
-- 
2.9.3

Reply via email to