tests: factor 350 fail=0 initializations into test-lib.sh
[platform/upstream/coreutils.git] / tests / rm / deep-1
1 #!/bin/sh
2 # Test "rm" with a deep hierarchy.
3
4 # Copyright (C) 1997, 2002-2004, 2006-2009 Free Software Foundation, Inc.
5
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19 # This is a bit of a torture test for mkdir -p, too.
20 # GNU rm performs *much* better on systems that have a d_type member
21 # in the directory structure because then it does only one stat per
22 # command line argument.
23
24 # If this test takes too long on your system, blame the OS.
25
26 if test "$VERBOSE" = yes; then
27   set -x
28   rm --version
29 fi
30
31 . $srcdir/test-lib.sh
32
33 umask 022
34
35
36 k20=/k/k/k/k/k/k/k/k/k/k/k/k/k/k/k/k/k/k/k/k
37 k200=$k20$k20$k20$k20$k20$k20$k20$k20$k20$k20
38
39 # Be careful not to exceed max file name length (usu 512?).
40 # Doing so wouldn't affect GNU mkdir or GNU rm, but any tool that
41 # operates on the full pathname (like `test') would choke.
42 k_deep=$k200$k200
43
44 t=t
45 # Create a directory in $t with lots of `k' components.
46 deep=$t$k_deep
47 mkdir -p $deep || fail=1
48
49 # Make sure the deep dir was created.
50 test -d $deep || fail=1
51
52 rm -r $t || fail=1
53
54 # Make sure all of $t was deleted.
55 test -d $t && fail=1
56
57 Exit $fail