generic/520: Remove sync in clean_dir
[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
40 rm -f $seqres.full
41 [ "X$TEST_DIR" = "X" ] && exit 1
42 cd $TEST_DIR
43 rm -fr test
44 mkdir test || exit 1
45 cd $TEST_DIR/test
46 mount > t_mtab
47
48 mtab()
49 {
50         rm -f $mtab_output
51         $here/src/t_mtab 50 $mtab_output &
52         $here/src/t_mtab 50 $mtab_output &
53         $here/src/t_mtab 50 $mtab_output &
54         wait
55         cat $mtab_output
56
57         $here/src/t_mtab 10000
58
59         echo directory entries:
60         ls | grep mtab
61         echo directory entries >> $seqres.full
62         ls -li >> $seqres.full
63 }
64
65 # directory with only a few entries
66 mtab
67
68 # directory with a hundred more entries, each 4chars wide
69 addentries 100 4
70 mtab
71
72 # directory with a thousand more entries, each 8chars wide
73 addentries 1000 8
74 mtab
75
76 status=0
77 exit