common/rc: add _scratch_{u}mount_idmapped() helpers
[xfstests-dev.git] / tests / xfs / 301
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 301
6 #
7 # Verify multi-stream xfsdump/restore preserves extended attributes
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     _cleanup_dump
21     cd /
22     rm -f $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28 . ./common/dump
29 . ./common/attr
30
31 # real QA test starts here
32
33 # Modify as appropriate.
34 _supported_fs xfs
35 _require_scratch
36
37 # Extended attributes
38 attr_name=attrname
39 attr_value=1234
40
41 rm -f $seqres.full
42
43 _create_dumpdir_fill_ea
44
45 # Create and add wholly-sparse file to the dump directory
46 $XFS_IO_PROG -f -c "truncate 1t" $dump_dir/sparsefile >> $seqres.full 2>&1 \
47         || _fail "could not create \"$dump_dir\"/sparsefile"
48
49 # Set the xattr on sparsefile
50 $ATTR_PROG -s $attr_name -V $attr_value $dump_dir/sparsefile >> $seqres.full 2>&1 \
51         || _fail "could not set ATTR for \"$dump_dir\"/sparsefile"
52
53 _do_dump_multi_file --multi 4  >> $seqres.full 2>&1
54 _do_restore_multi_file --multi 4 >> $seqres.full 2>&1
55 _diff_compare_eas
56
57 status=0
58 exit