| #!/bin/sh |
| |
|
|
| |
|
|
| |
| |
| |
| |
|
|
| |
| |
| |
| |
|
|
| |
| |
|
|
| . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src |
| print_ver_ ls |
|
|
| |
| |
| TZ=UTC0 |
| export TZ |
|
|
| t1='1998-01-15 21:00' |
| t2='1998-01-15 22:00' |
| t3='1998-01-15 23:00' |
|
|
| u1='1998-01-14 11:00' |
| u2='1998-01-14 12:00' |
| u3='1998-01-14 13:00' |
|
|
| touch -m -d "$t3" a || framework_failure_ |
| touch -m -d "$t2" B || framework_failure_ |
| touch -m -d "$t1" c || framework_failure_ |
|
|
| |
| for def_sort in '' '--sort=name' '-U --sort=name' '-t --sort=name'; do |
| set -- $(ls $def_sort a B c) |
| test "$*" = 'B a c' || fail=1 |
| done |
|
|
| touch -a -d "$u3" c || framework_failure_ |
| touch -a -d "$u2" B || framework_failure_ |
| |
| sleep 2 |
| touch -a -d "$u1" a || framework_failure_ |
| |
| |
| { ln a a-ctime && rm a-ctime; } || framework_failure_ |
|
|
|
|
| |
| set -- $(ls -t -c a c) |
| test "$*" = 'a c' || fail=1 |
| set -- $(ls -c a c) |
| test "$*" = 'a c' || fail=1 |
|
|
| |
| |
| sleep 2 |
|
|
| |
| ln c d || framework_failure_ |
|
|
| |
| set -- $(ls --full -l --time=mtime a) |
| case "$*" in |
| *" $t3:00.000000000 +0000 a") ;; |
| *) |
| |
| cat >&2 << EOF |
| A basic test of touch -m has just failed, so the subsequent |
| tests in this file will not be run. |
| |
| In the output below, the date of last modification for 'a' should |
| have been $t3. |
| EOF |
| ls --full -l a |
| skip_ "touch -m -d '$t3' didn't work" |
| ;; |
| esac |
|
|
| |
| set -- $(ls --full -lu a) |
| case "$*" in |
| *" $u1:00.000000000 +0000 a") ;; |
| *) |
| |
| cat >&2 << EOF |
| A fundamental touch -a test has just failed, so the subsequent |
| tests in this file will not be run. |
| |
| In the output below, the date of last access for 'a' should |
| have been $u1. |
| EOF |
| ls --full -lu a |
| Exit 77 |
| ;; |
| esac |
|
|
| set -- $(ls -ut a B c) |
| test "$*" = 'c B a' || fail=1 |
| set -- $(ls -u a B c) |
| test "$*" = 'c B a' || fail=1 |
| test $fail = 1 && ls -l --full-time --time=access a B c |
|
|
| set -- $(ls -t a B c) |
| test "$*" = 'a B c' || fail=1 |
| set -- $(ls --time=mtime a B c) |
| test "$*" = 'a B c' || fail=1 |
| test $fail = 1 && ls -l --full-time a B c |
|
|
| |
| set -- $(ls -ct a c) |
| if test "$*" = 'c a'; then |
| : ok |
| else |
| |
| |
| cat >&2 << \EOF |
| failed ls ctime test -- this failure is expected at least for SunOS4.1.4 |
| and for tmpfs file systems on Solaris 5.5.1. |
| It is also expected to fail on a btrfs file system until |
| https://bugzilla.redhat.com/591068 is addressed. |
|
|
| In the output below, 'c' should have had a ctime more recent than |
| that of 'a', but does not. |
| EOF |
| |
| ls -ctl --full-time a c |
| fail=1 |
| fi |
|
|
| |
| |
| |
| |
|
|
| if gettext --version >/dev/null 2>&1; then |
|
|
| default_tf1='%b %e %Y' |
| en_tf1=$(LC_ALL=en_US gettext coreutils "$default_tf1") |
|
|
| if test "$default_tf1" = "$en_tf1"; then |
| LC_ALL=en_US ls -l c >en_output |
| ls -l --time-style=long-iso c >liso_output |
| if compare en_output liso_output; then |
| fail=1 |
| echo "Long ISO TIME_FMT being used for en_US locale." >&2 |
| fi |
| fi |
| fi |
|
|
| Exit $fail |
|
|