1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-18 09:46:33 +02:00
Files
coreutils/tests/ls/time-1
1998-01-10 11:56:26 +00:00

57 lines
843 B
Bash
Executable File

#!/bin/sh
# Test some of ls's sorting options.
: ${LS=ls}
test=time-1
if test "$VERBOSE" = yes; then
set -x
$LS --version
fi
tmp=t-ls.$$
# We're going to LS from a subdir. Prepend ../ if $LS is not an
# absolute file name.
case $LS in
/*) ;;
*) LS=../$LS
esac
test_failure=0
mkdir $tmp || test_failure=1
cd $tmp || test_failure=1
: > a || test_failure=1
sleep 1
: > b || test_failure=1
: > c || test_failure=1
sleep 1
cat a || test_failure=1
mv c d || test_failure=1
if test $test_failure = 1; then
echo 'failure in testing framework'
exit 1
fi
fail=0
# A was accessed more recently.
set `$LS -u a b`
test "$*" = 'a b' && : || fail=1
# B was modified more recently.
set `$LS -t a b`
test "$*" = 'b a' && : || fail=1
# D has newer ctime.
set `$LS -c a d`
test "$*" = 'd a' && : || fail=1
cd ..
rm -rf $tmp
exit $fail