2 # Exercise du on a file with a big time stamp.
4 # Copyright (C) 2010-2013 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
25 bignum
=9223372036854775807
27 touch -d @
$bignum future
2>/dev
/null
&&
28 future_time
=$
(ls -l future
) &&
29 case "$future_time" in
32 *' Dec 4 300627798676 '*)
33 skip_
"file system and localtime both handle big timestamps" ;;
35 skip_
"file system or localtime mishandles big time stamps:" \
37 esac || skip_
"file system cannot represent big time stamps"
39 printf "0\t$bignum\tfuture\n" > exp || framework_failure_
40 printf "du: time $bignum is out of range\n" > err_ok || framework_failure_
42 du
--time future
>out
2>err || fail
=1
44 # On some systems an empty file occupies 4 blocks.
45 # Map the number of blocks to 0.
46 sed 's/^[0-9][0-9]*/0/' out
> k
&& mv k out
48 compare exp out || fail
=1
49 compare err err_ok || fail
=1