2 # Test some of ls's sorting options.
4 # Copyright (C) 1998-2016 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 .
"${srcdir=.}/tests/init.sh"; path_prepend_ .
/src
22 # Avoid any possible glitches due to daylight-saving changes near the
23 # time stamps used during the test.
35 touch -m -d "$t3" a || framework_failure_
36 touch -m -d "$t2" b || framework_failure_
37 touch -m -d "$t1" c || framework_failure_
39 touch -a -d "$u3" c || framework_failure_
40 touch -a -d "$u2" b || framework_failure_
41 # Make sure A has ctime at least 1 second more recent than C's.
43 touch -a -d "$u1" a || framework_failure_
44 # Updating the atime is usually enough to update the ctime, but on
45 # Solaris 10's tmpfs, ctime is not updated, so force an update here:
46 { ln a a-ctime
&& rm a-ctime
; } || framework_failure_
49 # A has ctime more recent than C.
51 test "$*" = 'a c' || fail
=1
53 # Sleep so long in an attempt to avoid spurious failures
54 # due to NFS caching and/or clock skew.
57 # Create a link, updating c's ctime.
58 ln c d || framework_failure_
60 # Before we go any further, verify that touch's -m option works.
61 set -- $
(ls --full -l a
)
63 *" $t3:00.000000000 +0000 a") ;;
65 # This might be what's making HPUX 11 systems fail this test.
67 A basic test of touch -m has just failed, so the subsequent
68 tests in this file will not be run.
70 In the output below, the date of last modification for 'a' should
78 # Ensure that touch's -a option works.
79 set -- $
(ls --full -lu a
)
81 *" $u1:00.000000000 +0000 a") ;;
83 # This might be what's making HPUX 11 systems fail this test.
85 A fundamental touch -a test has just failed, so the subsequent
86 tests in this file will not be run.
88 In the output below, the date of last access for 'a' should
97 test "$*" = 'c b a' && : || fail
=1
98 test $fail = 1 && ls -l --full-time --time=access a b c
101 test "$*" = 'a b c' && : || fail
=1
102 test $fail = 1 && ls -l --full-time a b c
104 # Now, C should have ctime more recent than A.
106 if test "$*" = 'c a'; then
109 # In spite of documentation, (e.g., stat(2)), neither link nor chmod
110 # update a file's st_ctime on SunOS4.1.4.
112 failed
ls ctime
test -- this failure is expected
at least
for SunOS4.1
.4
113 and
for tmpfs
file systems on Solaris
5.5.1.
114 It is also expected to fail on a btrfs
file system
until
115 http
://bugzilla.redhat.com
/591068 is addressed.
117 In the output below
, 'c' should have had a ctime
more recent than
118 that of
'a', but does not.
121 ls -ctl --full-time a c
125 # This check is ineffective if:
126 # en_US locale is not on the system.
127 # The system en_US message catalog has a specific TIME_FMT translation,
128 # which was inadvertently the case between coreutils 8.1 and 8.5 inclusive.
130 if gettext --version >/dev
/null
2>&1; then
132 default_tf1
='%b %e %Y'
133 en_tf1
=$
(LC_ALL
=en_US
gettext coreutils
"$default_tf1")
135 if test "$default_tf1" = "$en_tf1"; then
136 LC_ALL
=en_US
ls -l c
>en_output
137 ls -l --time-style=long-iso c
>liso_output
138 if compare en_output liso_output
; then
140 echo "Long ISO TIME_FMT being used for en_US locale." >&2