274: Many fixups
[xfstests-dev.git] / 124
1 #! /bin/bash
2 # FSQA Test No. 124
3 #
4 # Test preallocated_rw_pattern_test modified from CXFSQA test preallocated_rw_pattern_test
5 #
6 # pat stands for pattern.  First 8 bytes contains the 64-bit number 0,
7 # second is 1, ..., until last 8 bytes (1048568-1048575) contain 131071.
8 # patw preallocates the file and then writes the pattern, patr checks it
9 #
10 #-----------------------------------------------------------------------
11 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
12 #
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License as
15 # published by the Free Software Foundation.
16 #
17 # This program is distributed in the hope that it would be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write the Free Software Foundation,
24 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
25 #
26 #-----------------------------------------------------------------------
27 #
28 # creator
29 owner=ajones@sgi.com
30
31 seq=`basename $0`
32 echo "QA output created by $seq"
33
34 here=`pwd`
35 tmp=/tmp/$$
36 status=1        # failure is the default!
37 trap "_cleanup; exit \$status" 0 1 2 3 15
38
39 _cleanup()
40 {
41     cd /
42     _cleanup_testdir
43 }
44
45 # get standard environment, filters and checks
46 . ./common.rc
47 . ./common.filter
48
49 # real QA test starts here
50 _supported_fs generic
51 _supported_os Linux
52
53 _setup_testdir
54 _require_scratch
55 _scratch_mkfs >/dev/null 2>&1
56 _scratch_mount
57
58 # Run preallo_rw_pattern on both test and scratch partitions
59 for TESTFILE in $testdir/rw_pattern.tmp $SCRATCH_MNT/rw_pattern.tmp
60   do
61   count=1
62   while (( count < 101 ))
63     do
64     src/preallo_rw_pattern_writer $TESTFILE
65     src/preallo_rw_pattern_reader $TESTFILE
66     if (test $? -ne 0) then
67         echo Read/Write Pattern Test FAILED.
68         _cleanup
69         exit 1
70     fi
71     rm $TESTFILE
72     ((count=count+1))
73   done #done for count of  100
74 done
75
76 if (test $? -eq 0 ) then
77     status=0
78 fi
79
80 umount $SCRATCH_DEV
81
82 _check_test_fs
83 _check_scratch_fs
84
85 exit