summaryrefslogtreecommitdiff
path: root/tests/rm/r-1
blob: 1736501decbf6c872019dcb3186f9890286cee18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh

: ${RM=rm}
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

tmp=$TMPDIR/t-rm.$$

test_failure=0

mkdir $tmp || test_failure=1
mkdir $tmp/a $tmp/a/a || test_failure=1
> $tmp/b || test_failure=1

cat <<EOF > $tmp/$test.E || test_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 $test_failure = 1; then
  echo 'failure in testing framework'
  exit 1
fi

LANGUAGE=C
export LANGUAGE
LANG=C
export LANG

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