2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Red Hat, Inc. All Rights Reserved.
7 # Test that xfsdump/restore preserves file capabilities
10 _begin_fstest dump auto quick
12 # Override the default cleanup function.
20 # Import common functions.
24 # real QA test starts here
26 # Modify as appropriate.
29 _require_command "$SETCAP_PROG" setcap
30 _require_command "$GETCAP_PROG" getcap
35 echo test > $dump_dir/testfile
37 setfattr -n user.name -v value $dump_dir/testfile
38 # Now set the cap (which is also an xattr)
39 $SETCAP_PROG cap_setgid,cap_setuid+ep $dump_dir/testfile
40 # And make sure they are there on the source
41 echo "Checking for xattr on source file"
42 getfattr --absolute-names -m user.name $dump_dir/testfile | _dir_filter
43 echo "Checking for capability on source file"
44 _getcap $dump_dir/testfile | _dir_filter
45 getfattr --absolute-names -m security.capability $dump_dir/testfile | _dir_filter
47 _do_dump_file -f $tmp.df.0
50 # Basic dump/restore checks first - the file is there, right?
54 echo "Checking for xattr on restored file"
55 getfattr --absolute-names -m user.name $restore_dir/$dump_sdir/testfile | _dir_filter
56 echo "Checking for capability on restored file"
57 _getcap $restore_dir/$dump_sdir/testfile | _dir_filter
58 getfattr --absolute-names -m security.capability $restore_dir/$dump_sdir/testfile | _dir_filter