update 114 for new getparents interface and xfs_io parent command.
[xfstests-dev.git] / 013
1 #! /bin/sh
2 # FS QA Test No. 013
3 #
4 # fsstress
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
8 #-----------------------------------------------------------------------
9 #
10 # creator
11 owner=dxm@sgi.com
12
13 seq=`basename $0`
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=0        # success is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
20
21 _cleanup()
22 {
23     cd /
24     # we might get here with a RO FS
25     mount -o remount,rw $TEST_DEV >/dev/null 2>&1
26     # now remove fsstress directory.
27     # N.B. rm(1) on IRIX can find problems when building up a long pathname
28     # such that what it has is greater the 1024 chars and will 
29     # stop and complain - so get rid of complaint
30     # Ref. pv#935754
31     rm -rf $testdir/fsstress.$$.* 2>&1 | grep -v 'Path too long'
32     _cleanup_testdir
33 }
34
35 _filesize()
36 {
37     ls -l $1 | $AWK_PROG '{print "    filesize = " $5}'
38 }
39
40 # get standard environment, filters and checks
41 . ./common.rc
42 . ./common.filter
43
44 _do_test()
45 {
46     _n="$1"
47     _param="$2"
48     _count="$3"
49     
50     out=$testdir/fsstress.$$.$_n
51     rm -rf $out
52     if ! mkdir $out
53     then
54         echo "    failed to mkdir $out"
55         status=1
56         exit
57     fi
58     
59     echo ""
60     echo "-----------------------------------------------"
61     echo "fsstress.$_n : $_param"
62     echo "-----------------------------------------------"
63     # -m limits number of users/groups so check doesn't fail (malloc) later
64     dbgoutfile=$seq.full
65     if ! $here/ltp/fsstress $_param $FSSTRESS_AVOID -v -m 8 -n $_count -d $out >>$dbgoutfile 2>&1
66     then
67         echo "    fsstress (count=$_count) returned $? - see $seq.full"
68         
69         echo "--------------------------------------"       >>$here/$seq.full
70         echo "$_n - output from fsstress:"                  >>$here/$seq.full
71         echo "--------------------------------------"       >>$here/$seq.full
72         echo "<NOT LOGGED>"                                 >>$here/$seq.full
73         #cat $tmp.out                                       >>$here/$seq.full
74         status=1
75     fi
76
77     _check_test_fs
78 }
79
80
81 # real QA test starts here
82 _supported_fs xfs udf
83 _supported_os IRIX Linux
84
85 _setup_testdir
86
87 rm -f $here/$seq.full
88 echo "brevity is wit..."
89
90 count=1000
91 procs=20
92
93 _check_test_fs
94
95 # the default
96
97 _do_test 1 "-r" $count
98
99 # and the default with multiprocess
100
101 _do_test 2 "-p $procs -r" $count
102
103 # from Glen's notes
104
105 _do_test 3 "-p 4 -z -f rmdir=10 -f link=10 -f creat=10 -f mkdir=10 -f rename=30 -f stat=30 -f unlink=30 -f truncate=20" $count
106
107 # if all ok by here then probably don't need $seq.full
108 rm -f $seq.full
109
110 exit
111
112 # Test with error injection:
113
114 # (error injection)
115 # fsstress -n 1000 -d $scratch -p 4 -z -f rmdir=10 -f link=10 -f creat=10 \
116 #          -f mkdir=10 -f rename=30 -f stat=30 -f unlink=30 -f truncate=20 \
117 #          -e 1
118
119 # Error values 1 - 6 test IFLUSH
120 #         1 - corrupt buffer being flushed to di_core.di_magic
121 #         2 - corrupt inode being flushed i_d.di_magic
122 #         3 - corrupt S_IFREG format check
123 #         4 - corrupt S_IFDIR format check
124 #         5 - corrupt i_d.di_nextents
125 #         6 - corrupt i_d.di_forkoff > sb_inodesize