generic: copy_file_range swapfile test
[xfstests-dev.git] / tests / generic / 486
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Oracle.  All Rights Reserved.
4 #
5 # FS QA Test No. 486
6 #
7 # Ensure that we can XATTR_REPLACE a tiny attr into a large attr.
8 # Kanda Motohiro <kanda.motohiro@gmail.com> reports that XATTR_REPLACE'ing
9 # a single-byte attr with a 2048-byte attr causes a fs shutdown because we
10 # remove the shortform attr, convert the attr fork to long format, and then
11 # try to re-add the attr having not cleared ATTR_REPLACE.
12 #
13 # Commit 7b38460dc8e4 ("xfs: don't fail when converting shortform attr to long
14 # form during ATTR_REPLACE") fixed the xfs bug.
15 #
16 seq=`basename $0`
17 seqres=$RESULT_DIR/$seq
18 echo "QA output created by $seq"
19
20 status=1        # failure is the default!
21 trap "_cleanup; exit \$status" 0 1 2 3 15
22
23 _cleanup()
24 {
25         cd /
26         rm -f $testfile
27 }
28
29 # get standard environment, filters and checks
30 . ./common/rc
31 . ./common/filter
32 . ./common/attr
33
34 # remove previous $seqres.full before test
35 rm -f $seqres.full
36
37 # real QA test starts here
38 _supported_fs generic
39 _supported_os Linux
40 _require_test_program "attr_replace_test"
41 _require_attrs
42 _require_scratch
43
44 rm -f $seqres.full
45 _scratch_mkfs >>$seqres.full 2>&1
46 _scratch_mount >>$seqres.full 2>&1
47
48 filter_attr_output() {
49         _filter_scratch | sed -e 's/has a [0-9]* byte value/has a NNNN byte value/g'
50 }
51
52 ./src/attr_replace_test $SCRATCH_MNT/hello
53 $ATTR_PROG -l $SCRATCH_MNT/hello | filter_attr_output
54
55 status=0
56 exit