On 10/04/2010 03:53 AM, Pádraig Brady wrote:
+case $(stat --format %x a) in
+ *.000000000*) sleep 2;; # worst case file system is FAT
+ *) # FIXME: sleep .1 would be sufficient if %X showed nanoseconds
+ sleep 1;; # should be adequate for any system with subsecond resolution
+esac
+
+touch a || fail=1
+test "x$btime" = x$(stat --format %W a) || fail=1
+test "x$atime" != x$(stat --format %X a) || fail=1
+test "x$mtime" != x$(stat --format %Y a) || fail=1
+test "x$ctime" != x$(stat --format %Z a) || fail=1
+
+Exit $fail
Note the above test fits the pattern of "requiring a delay to pass"
and so can use the retry_delay_ functionality used elsewhere.
The advantage is that the delay is 1s rather than 2 on
1s resolution file systems like ext3.
I like it.
+# Wait up to 2.17s for timestamps to change.
+# ----------------------------------------
+# iterations file system resolution e.g.
+# ----------------------------------------
+# 1 nano or micro second ext4
+# 4 1 second ext3
+# 5 2 second FAT
And the table is nice, too.
+# ----------------------------------------
+check_timestamps_updated()
+{
+ local delay="$1"
I guess we're blindly assuming that coreutils testsuite is requiring a
shell that supports 'local'?
--
Eric Blake [email protected] +1-801-349-2682
Libvirt virtualization library http://libvirt.org