maint: avoid a syntax check failure
[coreutils.git] / tests / du / bigtime.sh
blobaf9de4c9227c20fcba3a2640e17c434e576e7868
1 #!/bin/sh
2 # Exercise du on a file with a big timestamp.
4 # Copyright (C) 2010-2024 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 <https://www.gnu.org/licenses/>.
19 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
20 print_ver_ du
22 export LC_ALL=C
23 export TZ=UTC0
25 # 2**63 - 1
26 bignum=9223372036854775807
28 touch -d @$bignum future 2>/dev/null &&
29 future_time=$(ls -l future) &&
30 case "$future_time" in
31 *" $bignum "*)
32 : ;;
33 *' Dec 4 300627798676 '*)
34 skip_ "file system and localtime both handle big timestamps" ;;
36 skip_ "file system or localtime mishandles big timestamps:" \
37 "$future_time" ;;
38 esac || skip_ "file system cannot represent big timestamps"
40 printf "0\t$bignum\tfuture\n" > exp || framework_failure_
41 printf "du: time '$bignum' is out of range\n" > err_ok || framework_failure_
43 du --time future >out 2>err || fail=1
45 # On some systems an empty file occupies 4 blocks.
46 # Map the number of blocks to 0.
47 sed 's/^[0-9][0-9]*/0/' out > k && mv k out
49 compare exp out || fail=1
50 compare err err_ok || fail=1
52 Exit $fail