coreutils/tests/rm/r-1
Jim Meyering 7cbb85937a Source lang-default rather than open-coding
the setting/exporting of LANG, LC_ALL, and LANGUAGE.
2000-10-22 13:08:43 +00:00

56 lines
1017 B
Bash
Executable File

#!/bin/sh
test=r-1
# TMPDIR should be an absolute dir for this test.
# FIXME: enforce it
: ${TMPDIR=/tmp}
if test "$VERBOSE" = yes; then
set -x
rm --version
fi
pwd=`pwd`
tmp=$TMPDIR/t-rm.$$
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
trap 'exit $?' 1 2 13 15
framework_failure=0
mkdir $tmp || framework_failure=1
mkdir $tmp/a $tmp/a/a || framework_failure=1
> $tmp/b || framework_failure=1
cat <<EOF > $tmp/$test.E || framework_failure=1
removing all entries of directory \`$tmp/a'
removing all entries of directory \`$tmp/a/a'
removing the directory itself: \`$tmp/a/a'
removing the directory itself: \`$tmp/a'
removing \`$tmp/b'
EOF
if test $framework_failure = 1; then
echo 'failure in testing framework'
exit 1
fi
. $srcdir/../lang-default
fail=0
rm --verbose -r $tmp/a $tmp/b > $tmp/$test.O || fail=1
for d in $dirs; do
if test -d $d; then
fail=1
fi
done
# Compare expected and actual output.
cmp $tmp/$test.E $tmp/$test.O || fail=1
rm -rf $tmp
(exit $fail)
exit $fail