xfstests: include test subdirectory support
[xfstests-dev.git] / 117
1 #! /bin/bash
2 # FS QA Test No. 117
3 #
4 # Attempt to cause filesystem corruption with serial fsstresses doing
5 # extended attributes writes - pv 940655
6 #
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2005 Silicon Graphics, Inc.  All Rights Reserved.
9 #
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
13 #
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22 #
23 #-----------------------------------------------------------------------
24 #
25
26 seq=`basename $0`
27 echo "QA output created by $seq"
28
29 here=`pwd`
30 tmp=/tmp/$$
31 status=1        # failure is the default!
32 trap "_cleanup; exit \$status" 0 1 2 3 15
33
34 # seed and options for fsstress known to cause curruptions
35 seed=1122413794
36 fss_ops=" -z \
37     -f attr_remove=100 \
38     -f attr_set=100 \
39     -f chown=3 \
40     -f creat=4 \
41     -f dread=4 \
42     -f dwrite=4 \
43     -f fdatasync=1 \
44     -f fsync=1 \
45     -f getdents=1 \
46     -f link=1 \
47     -f mkdir=2 \
48     -f mknod=2 \
49     -f read=1 \
50     -f readlink=1 \
51     -f rename=2 \
52     -f rmdir=1 \
53     -f setxattr=1 \
54     -f stat=1 \
55     -f symlink=2 \
56     -f sync=1 \
57     -f truncate=2 \
58     -f unlink=1 \
59     -f write=4 \
60     -s $seed \
61     -m 31 -n 1000 -p 1"
62
63 ITERATIONS=10
64
65 _cleanup()
66 {
67     cd /
68     rm -f $tmp.*
69     _cleanup_testdir
70 }
71
72 # get standard environment, filters and checks
73 . ./common.rc
74 . ./common.filter
75 . ./common.attr
76
77 # real QA test starts here
78 _supported_fs generic
79 _supported_os IRIX Linux
80
81 _setup_testdir
82 _require_scratch
83 _require_attrs
84
85 rm -f $seq.full
86 umount $SCRATCH_DEV >/dev/null 2>&1
87 echo "*** MKFS ***"                         >>$seq.full
88 echo ""                                     >>$seq.full
89 _scratch_mkfs                               >>$seq.full 2>&1 \
90     || _fail "mkfs failed"
91 _scratch_mount                              >>$seq.full 2>&1 \
92     || _fail "mount failed"
93
94 mkdir -p $SCRATCH_MNT/fsstress
95
96 echo
97 echo Running fsstress in serial:
98 i=0
99 while [ $i -lt $ITERATIONS ]; do
100     echo fsstress iteration: $i | tee -a $seq.full
101     $FSSTRESS_PROG \
102         -d $SCRATCH_MNT/fsstress \
103         $fss_ops -S c >>$seq.full 2>&1
104
105     let i=$i+1
106 done
107
108 cd /
109 umount $SCRATCH_MNT
110 echo 
111 echo Checking filesystem
112 _check_scratch_fs
113 _scratch_mount
114
115 status=$?
116 exit