2 # Test some of ls's sorting options.
4 # Copyright (C) 1998, 1999, 2000, 2001, 2004 Free Software Foundation,
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 if test "$VERBOSE" = yes; then
27 # Avoid any possible glitches due to daylight-saving changes near the
28 # time stamps used during the test.
32 # Avoid glitches due to the environment specifying `ls' styles.
39 mkdir $tmp || framework_failure=1
40 cd $tmp || framework_failure=1
50 touch -m -d "$t3" a || framework_failure=1
51 touch -m -d "$t2" b || framework_failure=1
52 touch -m -d "$t1" c || framework_failure=1
54 touch -a -d "$u3" c || framework_failure=1
55 touch -a -d "$u2" b || framework_failure=1
56 # Make sure A has ctime at least 1 second more recent than C's.
58 touch -a -d "$u1" a || framework_failure=1
62 # A has ctime more recent than C.
64 test "$*" = 'a c' || fail=1
66 # Sleep so long in an attempt to avoid spurious failures
67 # due to NFS caching and/or clock skew.
70 # Create a link, updating c's ctime.
71 ln c d || framework_failure=1
73 # Before we go any further, verify that touch's -m option works.
74 set -- `ls --full -l a`
76 *" $t3:00.000000000 +0000 a") ;;
78 # This might be what's making HPUX 11 systems fail this test.
80 A basic test of touch -m has just failed, so the subsequent
81 tests in this file will not be run.
83 In the output below, the date of last modification for \`a' should
92 # Now test touch's -a option.
93 set -- `ls --full -lu a`
95 *" $u1:00.000000000 +0000 a") ;;
97 # This might be what's making HPUX 11 systems fail this test.
99 A basic test of touch -a has just failed, so the subsequent
100 tests in this file will not be run.
102 In the output below, the date of last access for \`a' should
110 if test $framework_failure = 1; then
111 echo 'failure in testing framework'
116 test "$*" = 'c b a' && : || fail=1
117 test $fail = 1 && ls -l --full-time --time=access a b c
120 test "$*" = 'a b c' && : || fail=1
121 test $fail = 1 && ls -l --full-time a b c
123 # Now, C should have ctime more recent than A.
125 if test "$*" = 'c a'; then
128 # In spite of documentation, (e.g., stat(2)), neither link nor chmod
129 # update a file's st_ctime on SunOS4.1.4.
131 failed ls ctime test -- this failure is expected at least for SunOS4.1.4
132 and for tmpfs file systems on Solaris 5.5.1.
134 In the output below, `c' should have had a ctime more recent than
135 that of `a', but does not.
138 ls -ctl --full-time a c