generic: test adding filesystem-level fscrypt key via key_id
[xfstests-dev.git] / tests / generic / 079
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 079
6 #
7 # Run the t_immutable test program for immutable/append-only files.
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 timmutable=$here/src/t_immutable
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     echo "*** cleaning up"
23     $timmutable -r $SCRATCH_MNT/$seq
24 }
25
26 # get standard environment, filters and checks
27 . ./common/rc
28 . ./common/filter
29 . ./common/attr
30
31 _supported_fs generic
32 _supported_os Linux
33
34 _require_chattr ia
35 _require_test_program "t_immutable"
36 _require_scratch
37
38 # real QA test starts here
39 _scratch_mkfs >/dev/null 2>&1 || _fail "mkfs failed"
40 _scratch_mount
41
42 echo "*** starting up"
43 $timmutable -c $SCRATCH_MNT/$seq >$tmp.out 2>&1
44 if grep -q -e 'Operation not supported' -e "Inappropriate ioctl" $tmp.out; then
45     rm -f $tmp.out
46     _notrun "Setting immutable/append flag not supported"
47 fi
48 cat $tmp.out
49 rm -f $tmp.out
50 status=$?
51 exit