fstests: check for filesystem FS_IOC_FSSETXATTR support
[xfstests-dev.git] / tests / xfs / 209
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 209
6 #
7 # Make sure setting cowextsz on a directory propagates it to subfiles.
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1    # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20     cd /
21     rm -rf $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27 . ./common/reflink
28
29 # real QA test starts here
30 _supported_os Linux
31 _supported_fs xfs
32 _require_scratch_reflink
33 _require_cp_reflink
34 _require_xfs_io_command "fiemap"
35 _require_xfs_io_command "cowextsize"
36
37 rm -f $seqres.full
38
39 echo "Format and mount"
40 _scratch_mkfs > $seqres.full 2>&1
41 _scratch_mount >> $seqres.full 2>&1
42
43 testdir=$SCRATCH_MNT/test-$seq
44 mkdir $testdir
45
46 echo "Set extsz and cowextsz on directory"
47 $XFS_IO_PROG -c "cowextsize 1048576" $testdir >> $seqres.full
48
49 echo "Create a fake tree structure"
50 seq 1 2 | while read nr; do
51         mkdir "$testdir/dir-$nr"
52         seq 1 4 | while read nnr; do
53                 touch "$testdir/dir-$nr/file-$nnr"
54         done
55 done
56 _scratch_cycle_mount
57
58 echo "Check cowextsize settings"
59 seq 1 2 | while read nr; do
60         seq 1 4 | while read nnr; do
61                 file="$testdir/dir-$nr/file-$nnr"
62                 $XFS_IO_PROG -c "cowextsize" $file | _filter_scratch
63         done
64 done
65
66 # success, all done
67 status=0
68 exit