xfstests: introduce a common directory
[xfstests-dev.git] / tests / generic / 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 seqres=$RESULT_DIR/$seq
28 seqres=$RESULT_DIR/$seq
29 seqres=$RESULT_DIR/$seq
30 echo "QA output created by $seq"
31
32 here=`pwd`
33 tmp=/tmp/$$
34 status=1        # failure is the default!
35 trap "_cleanup; exit \$status" 0 1 2 3 15
36
37 # seed and options for fsstress known to cause curruptions
38 seed=1122413794
39 fss_ops=" -z \
40     -f attr_remove=100 \
41     -f attr_set=100 \
42     -f chown=3 \
43     -f creat=4 \
44     -f dread=4 \
45     -f dwrite=4 \
46     -f fdatasync=1 \
47     -f fsync=1 \
48     -f getdents=1 \
49     -f link=1 \
50     -f mkdir=2 \
51     -f mknod=2 \
52     -f read=1 \
53     -f readlink=1 \
54     -f rename=2 \
55     -f rmdir=1 \
56     -f setxattr=1 \
57     -f stat=1 \
58     -f symlink=2 \
59     -f sync=1 \
60     -f truncate=2 \
61     -f unlink=1 \
62     -f write=4 \
63     -s $seed \
64     -m 31 -n 1000 -p 1"
65
66 ITERATIONS=10
67
68 _cleanup()
69 {
70     cd /
71     rm -f $tmp.*
72     _cleanup_testdir
73 }
74
75 # get standard environment, filters and checks
76 . ./common/rc
77 . ./common/filter
78 . ./common/attr
79
80 # real QA test starts here
81 _supported_fs generic
82 _supported_os IRIX Linux
83
84 _setup_testdir
85 _require_scratch
86 _require_attrs
87
88 rm -f $seqres.full
89 umount $SCRATCH_DEV >/dev/null 2>&1
90 echo "*** MKFS ***"                         >>$seqres.full
91 echo ""                                     >>$seqres.full
92 _scratch_mkfs                               >>$seqres.full 2>&1 \
93     || _fail "mkfs failed"
94 _scratch_mount                              >>$seqres.full 2>&1 \
95     || _fail "mount failed"
96
97 mkdir -p $SCRATCH_MNT/fsstress
98
99 echo
100 echo Running fsstress in serial:
101 i=0
102 while [ $i -lt $ITERATIONS ]; do
103     echo fsstress iteration: $i | tee -a $seqres.full
104     $FSSTRESS_PROG \
105         -d $SCRATCH_MNT/fsstress \
106         $fss_ops -S c >>$seqres.full 2>&1
107
108     let i=$i+1
109 done
110
111 cd /
112 umount $SCRATCH_MNT
113 echo 
114 echo Checking filesystem
115 _check_scratch_fs
116 _scratch_mount
117
118 status=$?
119 exit