xfstests: include test subdirectory support
[xfstests-dev.git] / 079
1 #! /bin/bash
2 # FS QA Test No. 079
3 #
4 # Run the t_immutable test program for immutable/append-only files.
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
8 #
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
12 #
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 #
22 #-----------------------------------------------------------------------
23 #
24
25 seq=`basename $0`
26 echo "QA output created by $seq"
27
28 here=`pwd`
29 timmutable=$here/src/t_immutable
30 tmp=/tmp/$$
31 status=1        # failure is the default!
32 trap "_cleanup; exit \$status" 0 1 2 3 15
33
34 _cleanup()
35 {
36     cd /
37     echo "*** cleaning up"
38     $timmutable -r $SCRATCH_MNT/$seq
39     umount $SCRATCH_MNT
40 }
41
42 # get standard environment, filters and checks
43 . ./common.rc
44 . ./common.filter
45 . ./common.attr
46
47 _supported_fs generic
48 _supported_os Linux
49
50 _require_attrs
51 _require_scratch
52
53 [ -x $timmutable ] || _notrun "t_immutable was not built for this platform"
54
55 # real QA test starts here
56 _scratch_mkfs >/dev/null 2>&1 || _fail "mkfs failed"
57 _scratch_mount || _fail "mount failed"
58
59 echo "*** starting up"
60 $timmutable -c $SCRATCH_MNT/$seq >$tmp.out 2>&1
61 if grep -q 'Operation not supported' $tmp.out; then
62     rm -f $tmp.out
63     _notrun "Setting immutable/append flag not supported"
64 fi
65 cat $tmp.out
66 rm -f $tmp.out
67 status=$?
68 exit