xfstests 240: test non-aligned AIO hole-filling
[xfstests-dev.git] / 127
1 #! /bin/bash
2 # FSQA Test No. 127
3 #
4 # fsx tests modified from CXFSQA tests
5 #   - fsx_00_lite
6 #   - fsx_05_lite_mmap
7 #   - fsx_10_std,
8 #   - fsx_15_std_mmap
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=allanr@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     _cleanup_testdir
42 }
43
44 # get standard environment, filters and checks
45 . ./common.rc
46 . ./common.filter
47
48 FSX_FILE_SIZE=262144
49 FSX_ARGS="-q -l $FSX_FILE_SIZE -o 65536 -S 191110531 -N 100000"
50
51 _fsx_lite_nommap()
52 {
53     echo "=== FSX Light Mode, No Memory Mapping ==="
54     dd if=/dev/zero of=$testdir/fsx_lite_nommap bs=${FSX_FILE_SIZE} count=1 > /dev/null 2>&1
55     if ! ltp/fsx $FSX_ARGS -L -R -W $testdir/fsx_lite_nommap > $tmp.output 2>&1
56     then
57         echo "ltp/fsx $FSX_ARGS -L -R -W $testdir/fsx_lite_nommap"
58         cat $tmp.output
59         return 1
60     fi
61     cat $tmp.output
62     return 0
63 }
64
65 _fsx_lite_mmap()
66 {
67     echo "=== FSX Light Mode, Memory Mapping ==="
68     dd if=/dev/zero of=$testdir/fsx_lite_mmap bs=${FSX_FILE_SIZE} count=1 > /dev/null 2>&1
69     if ! ltp/fsx $FSX_ARGS -L $testdir/fsx_lite_mmap > $tmp.output 2>&1
70     then
71         echo "ltp/fsx $FSX_ARGS -L fsx_lite_mmap"
72         cat $tmp.output
73         return 1
74     fi
75     cat $tmp.output
76     return 0
77 }
78
79 _fsx_std_nommap()
80 {
81     echo "=== FSX Standard Mode, No Memory Mapping ==="
82     if ! ltp/fsx $FSX_ARGS -R -W $testdir/fsx_std_nommap > $tmp.output 2>&1
83     then
84         echo "ltp/fsx $FSX_ARGS -R -W fsx_std_nommap"
85         cat $tmp.output
86         return 1
87     fi
88     cat $tmp.output
89     return 0
90 }
91
92 _fsx_std_mmap()
93 {
94     echo "=== FSX Standard Mode, Memory Mapping ==="
95     if ! ltp/fsx $FSX_ARGS $testdir/fsx_std_mmap > $tmp.output 2>&1
96     then
97         echo "ltp/fsx $FSX_ARGS fsx_std_mmap"
98         cat $tmp.output
99         return 1
100     fi
101     cat $tmp.output
102     return 0
103 }
104
105 # real QA test starts here
106 _supported_fs generic
107 _supported_os Linux
108
109 _setup_testdir
110
111 _fsx_lite_nommap
112 _fsx_lite_mmap
113
114 _fsx_std_nommap
115 _fsx_std_mmap
116
117 #flush cache after write
118 FSX_ARGS="-f $FSX_ARGS"
119 _fsx_std_nommap
120 _fsx_std_mmap
121
122
123 status=0
124 _cleanup
125 exit