mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
tests: test-N: include subsecond values in gating check
* tests/misc/test-N.sh: The subsecond values for atime and mtime were potentially seen to differ on newlyl created files. So we include the subsecond portion when comparing stat values.
This commit is contained in:
1 parent
a971cd4ff7
commit
5f47cda3ab
1 file changed
+7
-3
@@ -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_
|
||||
|
||||
Reference in new issue
Block a user