fstests: use _require_symlinks on all necessary tests
[xfstests-dev.git] / tests / generic / 397
index ba92089135ef18d6535d9142f0deba7480050481..c2245bd50385e173447e8129ce439e9b32560598 100755 (executable)
@@ -1,4 +1,7 @@
 #! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2016 Google, Inc.  All Rights Reserved.
+#
 # FS QA Test generic/397
 #
 # Test accessing encrypted files and directories, both with and without the
@@ -7,26 +10,6 @@
 # need to run all the xfstests with encryption enabled.  Access without the
 # encryption key, on the other hand, should result in some particular behaviors.
 #
-#-----------------------------------------------------------------------
-# Copyright (c) 2016 Google, Inc.  All Rights Reserved.
-#
-# Author: Eric Biggers <ebiggers@google.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write the Free Software Foundation,
-# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#-----------------------------------------------------------------------
-#
-
 seq=`basename $0`
 seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
@@ -53,8 +36,8 @@ rm -f $seqres.full
 # real QA test starts here
 _supported_fs generic
 _supported_os Linux
+_require_symlinks
 _require_scratch_encryption
-_require_xfs_io_command "set_encpolicy"
 _require_command "$KEYCTL_PROG" keyctl
 
 _new_session_keyring
@@ -63,8 +46,8 @@ _scratch_mkfs_encrypted &>> $seqres.full
 _scratch_mount
 
 mkdir $SCRATCH_MNT/edir $SCRATCH_MNT/ref_dir
-keydesc=$(_generate_encryption_key)
-$XFS_IO_PROG -c "set_encpolicy $keydesc" $SCRATCH_MNT/edir
+keydesc=$(_generate_session_encryption_key)
+_set_encpolicy $SCRATCH_MNT/edir $keydesc
 for dir in $SCRATCH_MNT/edir $SCRATCH_MNT/ref_dir; do
        touch $dir/empty > /dev/null
        $XFS_IO_PROG -t -f -c "pwrite 0 4k" $dir/a > /dev/null
@@ -110,7 +93,7 @@ filter_create_errors()
            -e 's/Operation not permitted/Required key not available/'
 }
 
-_unlink_encryption_key $keydesc
+_unlink_session_encryption_key $keydesc
 _scratch_cycle_mount
 
 # Check that unencrypted names aren't there