2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2016 SUSE Linux Products GmbH. All Rights Reserved.
7 # Test that the filesystem's implementation of the listxattrs system call lists
8 # all the xattrs an inode has.
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
14 status=1 # failure is the default!
15 trap "_cleanup; exit \$status" 0 1 2 3 15
23 # get standard environment, filters and checks
28 # real QA test starts here
35 _scratch_mkfs >>$seqres.full 2>&1
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
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