2 # Make sure touch can set the mtime on an empty file.
4 # Copyright (C) 1998, 1999, 2000, 2005, 2006 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 2 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, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 # Volker Borchert reported that touch 3.16r (and presumably all before that)
23 # fails to work on SunOS 4.1.3 with `most of the recommended patches' when
24 # the empty file is on an NFS-mounted 4.2 volume.
26 if test "$VERBOSE" = yes; then
31 . $srcdir/../envvar-check
33 DEFAULT_SLEEP_SECONDS=2
34 SLEEP_SECONDS=${SLEEP_SECONDS=$DEFAULT_SLEEP_SECONDS}
38 # FIXME: find writable directories on other partitions
39 # and run the test in those directories, too.
45 for d in $TOUCH_DIR_LIST; do
47 > $d/a || framework_failure=1
48 test -f $d/a || framework_failure=1
49 > $d/b || framework_failure=1
50 test -f $d/b || framework_failure=1
51 > $d/c || framework_failure=1
52 test -f $d/c || framework_failure=1
55 if test $framework_failure = 1; then
56 echo 'failure in testing framework'
60 echo sleeping for $SLEEP_SECONDS seconds...
62 for d in $TOUCH_DIR_LIST; do
64 set x `ls -t $d/a $d/b`
65 test "$*" = "x $d/a $d/b" || fail=1
68 echo sleeping for $SLEEP_SECONDS seconds...
70 for d in $TOUCH_DIR_LIST; do
72 set x `ls -t $d/a $d/b`
73 test "$*" = "x $d/b $d/a" || fail=1
75 if touch - 1< $d/c 2> /dev/null; then
76 set x `ls -t $d/a $d/c`
77 test "$*" = "x $d/c $d/a" || fail=1
83 if test $fail != 0; then
85 *** This test has just failed. That can happen when the test is run in an
86 *** NFS-mounted directory on a system whose clock is not well synchronized
87 *** with that of the NFS server. If you think that is the reason, set the
88 *** environment variable SLEEP_SECONDS to some number of seconds larger than
89 *** the default of $DEFAULT_SLEEP_SECONDS and rerun the test.