common/fuzzy: try to clear blocking flags first in _scratch_fuzz_modify
[xfstests-dev.git] / tests / generic / 089
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 089
6 #
7 # Emulate the way Linux mount manipulates /etc/mtab to attempt to
8 # reproduce a possible bug in rename (see src/t_mtab.c).
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 mtab_output=$TEST_DIR/mtab_output
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
19
20 # get standard environment, filters and checks
21 . ./common/rc
22 . ./common/filter
23
24 addentries()
25 {
26         count=$1
27         pattern="%0$2d"
28
29         while [ $count -gt 0 ]; do
30                 touch `printf $pattern $count`
31                 let count=$count-1
32         done
33 }
34
35 # real QA test starts here
36 _supported_fs generic
37 _supported_os Linux
38 _require_test
39 _require_hardlinks
40
41 rm -f $seqres.full
42 [ "X$TEST_DIR" = "X" ] && exit 1
43 cd $TEST_DIR
44 rm -fr test
45 mkdir test || exit 1
46 cd $TEST_DIR/test
47 mount > t_mtab
48
49 mtab()
50 {
51         rm -f $mtab_output
52         $here/src/t_mtab 50 $mtab_output &
53         $here/src/t_mtab 50 $mtab_output &
54         $here/src/t_mtab 50 $mtab_output &
55         wait
56         cat $mtab_output
57
58         $here/src/t_mtab 10000
59
60         echo directory entries:
61         ls | grep mtab
62         echo directory entries >> $seqres.full
63         ls -li >> $seqres.full
64 }
65
66 # directory with only a few entries
67 mtab
68
69 # directory with a hundred more entries, each 4chars wide
70 addentries 100 4
71 mtab
72
73 # directory with a thousand more entries, each 8chars wide
74 addentries 1000 8
75 mtab
76
77 status=0
78 exit