xfs: fix old fuzz test invocations of xfs_repair
[xfstests-dev.git] / tests / overlay / 030
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2017 CTERA Networks. All Rights Reserved.
4 #
5 # FS QA Test No. 030
6 #
7 # Run the t_immutable test program for immutable/append-only files
8 # and directories in an overlayfs upper directory.
9 #
10 # This test is similar and was derived from generic/079, but
11 # the original test is _notrun with FSTYP=overlay on kernel < v5.10
12 # because prior to commit 61536bed2149 ("ovl: support [S|G]ETFLAGS
13 # and FS[S|G]ETXATTR ioctls for directories"), t_immutable -c would
14 # fail to prepare immutable/append-only directories on the overlay
15 # mount path.
16 #
17 seq=`basename $0`
18 seqres=$RESULT_DIR/$seq
19 echo "QA output created by $seq"
20
21 here=`pwd`
22 timmutable=$here/src/t_immutable
23 upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
24 tmp=/tmp/$$
25 status=1        # failure is the default!
26 trap "_cleanup; exit \$status" 0 1 2 3 15
27
28 _cleanup()
29 {
30         $timmutable -r $upperdir/t_immutable &> /dev/null
31         rm -f $tmp.*
32 }
33
34 # get standard environment, filters and checks
35 . ./common/rc
36 . ./common/filter
37
38 _supported_fs overlay
39
40 _require_chattr ia
41 _require_test_program "t_immutable"
42 _require_scratch
43
44 _scratch_mkfs
45
46 # Preparing immutable files in uppper dir
47 mkdir -p $upperdir
48 $timmutable -C $upperdir/t_immutable >$tmp.out 2>&1
49 if grep -q -e 'Operation not supported' -e "Inappropriate ioctl" $tmp.out; then
50         _notrun "Setting immutable/append flag not supported"
51 fi
52
53 _scratch_mount
54
55 # Test immutability of files in overlay
56 $timmutable $SCRATCH_MNT/t_immutable 2>&1
57 status=$?
58 exit