tests: remove udf/101
[xfstests-dev.git] / tests / generic / 425
1 #! /bin/bash
2 # FS QA Test No. 425
3 #
4 # Check that FIEMAP produces some output when we require an external
5 # block to hold extended attributes.
6 #
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2017 Oracle, Inc.  All Rights Reserved.
9 #
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
13 #
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22 #-----------------------------------------------------------------------
23 #
24
25 seq=`basename $0`
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
28
29 here=`pwd`
30 tmp=/tmp/$$
31 status=1        # failure is the default!
32 trap "_cleanup; exit \$status" 0 1 2 3 7 15
33
34 _cleanup()
35 {
36         cd /
37         rm -rf $tmp.*
38         wait
39 }
40
41 # get standard environment, filters and checks
42 . ./common/rc
43 . ./common/filter
44 . ./common/attr
45
46 # real QA test starts here
47 _supported_os Linux
48 _supported_fs generic
49 _require_scratch
50 _require_attrs
51 _require_xfs_io_command "fiemap" "-a"
52
53 echo "Format and mount"
54 _scratch_mkfs > $seqres.full 2>&1
55 _scratch_mount >> $seqres.full 2>&1
56
57 testdir=$SCRATCH_MNT/test-$seq
58 mkdir $testdir
59
60 echo "Create the original files"
61 testfile=$testdir/attrfile
62 touch $testfile
63 blk_sz=$(_get_file_block_size $SCRATCH_MNT)
64
65 # Assume each attr eats at least 20 bytes.  Try to fill 2 fs blocks.
66 max_attrs=$((2 * blk_sz / 20))
67
68 i=0
69 while [ $i -lt $max_attrs ]; do
70         n="$(printf "%010d" $i)"
71         $SETFATTR_PROG -n "user.$n" -v "$n" $testfile > $seqres.full 2>&1 || break
72         i=$((i + 1))
73 done
74 sync
75
76 echo "Check attr extent counts"
77 f1=$(_count_attr_extents $testfile)
78 echo "$f1 xattr extents" >> $seqres.full
79 $XFS_IO_PROG -c 'fiemap -a -v' $testfile >> $seqres.full
80 test $f1 -gt 0 || echo "Expected at least one xattr extent."
81
82 _scratch_cycle_mount
83
84 echo "Check attr extent counts after remount"
85 f1=$(_count_attr_extents $testfile)
86 echo "$f1 xattr extents" >> $seqres.full
87 $XFS_IO_PROG -c 'fiemap -a -v' $testfile >> $seqres.full
88 test $f1 -gt 0 || echo "Expected at least one xattr extent."
89
90 # success, all done
91 status=0
92 exit