fstests: use _require_symlinks on all necessary tests
[xfstests-dev.git] / tests / generic / 396
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Google, Inc.  All Rights Reserved.
4 #
5 # FS QA Test generic/396
6 #
7 # Test that FS_IOC_SET_ENCRYPTION_POLICY correctly validates the fscrypt_policy
8 # structure that userspace passes to it.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16 status=1        # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 _cleanup()
20 {
21         cd /
22         rm -f $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28 . ./common/encrypt
29
30 # remove previous $seqres.full before test
31 rm -f $seqres.full
32
33 # real QA test starts here
34 _supported_fs generic
35 _supported_os Linux
36 _require_scratch_encryption
37
38 _scratch_mkfs_encrypted &>> $seqres.full
39 _scratch_mount
40 dir=$SCRATCH_MNT/dir
41 mkdir $dir
42
43 echo -e "\n*** Invalid contents encryption mode ***"
44 _set_encpolicy $dir -c 0xFF |& _filter_scratch
45
46 echo -e "\n*** Invalid filenames encryption mode ***"
47 _set_encpolicy $dir -n 0xFF |& _filter_scratch
48
49 echo -e "\n*** Invalid flags ***"
50 _set_encpolicy $dir -f 0xFF |& _filter_scratch
51
52 echo -e "\n*** Invalid policy version ***"
53 _set_encpolicy $dir -v 0xFF |& _filter_scratch
54
55 # Currently, the only supported combination of modes is AES-256-XTS for contents
56 # and AES-256-CTS for filenames.  Nothing else should be accepted.
57 echo -e "\n*** Invalid combinations of modes ***"
58 _set_encpolicy $dir -c AES-256-CTS -n AES-256-CTS |& _filter_scratch
59 _set_encpolicy $dir -c AES-256-CTS -n AES-256-XTS |& _filter_scratch
60 _set_encpolicy $dir -c AES-256-XTS -n AES-256-XTS |& _filter_scratch
61
62 # success, all done
63 status=0
64 exit