xfs: force file creation to the data device for certain layout tests
[xfstests-dev.git] / tests / generic / 337
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2016 SUSE Linux Products GmbH. All Rights Reserved.
4 #
5 # FSQA Test No. 337
6 #
7 # Test that the filesystem's implementation of the listxattrs system call lists
8 # all the xattrs an inode has.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13 tmp=/tmp/$$
14 status=1        # failure is the default!
15 trap "_cleanup; exit \$status" 0 1 2 3 15
16
17 _cleanup()
18 {
19         cd /
20         rm -f $tmp.*
21 }
22
23 # get standard environment, filters and checks
24 . ./common/rc
25 . ./common/filter
26 . ./common/attr
27
28 # real QA test starts here
29 _supported_fs generic
30 _require_scratch
31 _require_attrs
32
33 rm -f $seqres.full
34
35 _scratch_mkfs >>$seqres.full 2>&1
36 _scratch_mount
37
38 # Create our test file with a few xattrs. The first 3 xattrs have a name that
39 # when given as input to a crc32c function result in the same checksum. This
40 # made btrfs list only one of the xattrs through listxattrs system call (because
41 # it packs xattrs with the same name checksum into the same btree item).
42 touch $SCRATCH_MNT/testfile
43 $SETFATTR_PROG -n user.foobar -v 123 $SCRATCH_MNT/testfile
44 $SETFATTR_PROG -n user.WvG1c1Td -v qwerty $SCRATCH_MNT/testfile
45 $SETFATTR_PROG -n user.J3__T_Km3dVsW_ -v hello $SCRATCH_MNT/testfile
46 $SETFATTR_PROG -n user.something -v pizza $SCRATCH_MNT/testfile
47 $SETFATTR_PROG -n user.ping -v pong $SCRATCH_MNT/testfile
48
49 # Now call getfattr with --dump, which calls the listxattrs system call.
50 # It should list all the xattrs we have set before.
51 _getfattr --absolute-names --dump $SCRATCH_MNT/testfile | _filter_scratch
52
53 status=0
54 exit