.
[coreutils.git] / tests / rm / deep-1
blob1fc4d1922a2ee0a2ce54f2a8b06dba87eddfd5d8
1 #!/bin/sh
3 # This is a bit of a torture test for mkdir -p, too.
4 # GNU rm performs *much* better on systems that have a d_type member
5 # in the directory structure because then it does only one stat per
6 # command line argument.
8 # If this test takes too long on your system, blame the OS.
10 : ${RM=rm}
11 : ${MKDIR=mkdir}
13 test=deep-1
15 # Don't require use of TMPDIR.
16 : ${RM_TMPDIR=.}
18 if test "$VERBOSE" = yes; then
19 set -x
20 $RM --version
23 umask 022
25 fail=0
27 tmp=$RM_TMPDIR/t-rm.$$
29 k20=/k/k/k/k/k/k/k/k/k/k/k/k/k/k/k/k/k/k/k/k
30 k200=$k20$k20$k20$k20$k20$k20$k20$k20$k20$k20
32 # Be careful not to exceed max file name length (usu 512?).
33 # Doing so wouldn't affect GNU mkdir or GNU rm, but any tool that
34 # operates on the full pathname (like `test') would choke.
35 k_deep=$k200$k200
37 # Create a directory in $tmp with lots of `k' components.
38 deep=$tmp$k_deep
39 echo "creating a hierarchy 400 deep in $tmp..." |tr -d '\012'
40 $MKDIR -p $deep || fail=1
41 echo done
43 # Make sure the deep dir was created.
44 test -d $deep || fail=1
46 echo "deleting $tmp..." |tr -d '\012'
47 $RM -r $tmp || fail=1
48 echo done
50 # Make sure all of $tmp was deleted.
51 test -d $tmp && fail=1
53 exit $fail