coreutils
[Top][All Lists]
Advanced

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

Re: [coreutils] [PATCH 1/2] stat: support printing birthtime


From: Eric Blake
Subject: Re: [coreutils] [PATCH 1/2] stat: support printing birthtime
Date: Mon, 04 Oct 2010 08:13:25 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.4

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   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]