xfs/{263,106}: erase max warnings printout
[xfstests-dev.git] / tests / generic / 109
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2015 SUSE Linux Products GmbH. All Rights Reserved.
4 #
5 # FS QA Test No. 109
6 #
7 # Test rename for various sizes of directories. This is motivated by a bug
8 # in XFS where directory entry file type was not updated properly on rename.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16 status=1        # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 _cleanup()
20 {
21         cd /
22         rm -f $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27
28 # real QA test starts here
29 _supported_fs generic
30 _supported_os Linux
31 _require_scratch
32 _require_symlinks
33
34 rm -f $seqres.full
35
36 echo "Silence is golden"
37
38 filldir()
39 {
40         for (( i = 0; i < $1; i++ )); do
41                 echo -n > "fname$i"
42         done
43 }
44
45 # Test renaming of file, symlink over file, symlink, non-existent
46 # name
47 renamedir()
48 {
49         touch fs1
50         touch fs2
51         touch fs3
52         touch fd1
53         touch fd2
54         ln -s foo ss1
55         ln -s foo ss2
56         ln -s foo ss3
57         ln -s foo sd1
58         ln -s foo sd2
59
60         mv -T fs1 fd1
61         mv -T fs2 sd1
62         mv -T fs3 ed1
63
64         mv -T ss1 fd2
65         mv -T ss2 sd2
66         mv -T ss3 ed2
67 }
68
69 _scratch_mkfs >> $seqres.full 2>&1
70 _scratch_mount >> $seqres.full 2>&1
71
72 # Test different directory sizes to test various directory formats
73 for f in 1 2 3 4 5 8 12 18 27 40 60 90 135 202 303 454 681 1020 1530 2295; do
74         mkdir $SCRATCH_MNT/dir$f
75         pushd $SCRATCH_MNT/dir$f >/dev/null
76         filldir $f
77         renamedir
78         popd >/dev/null
79 done
80
81 status=0
82 exit