fsx: introduce FSX_AVOID env var
[xfstests-dev.git] / tests / generic / 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
29 seq=`basename $0`
30 seqres=$RESULT_DIR/$seq
31 echo "QA output created by $seq"
32
33 here=`pwd`
34 tmp=/tmp/$$
35 status=1        # failure is the default!
36 trap "_cleanup; exit \$status" 0 1 2 3 15
37
38 _cleanup()
39 {
40     rm -f $tmp.output
41 }
42
43 # get standard environment, filters and checks
44 . ./common/rc
45 . ./common/filter
46
47 FSX_FILE_SIZE=262144
48 FSX_ARGS="-q -l $FSX_FILE_SIZE -o 65536 -S 191110531 -N 100000"
49
50 _fsx_lite_nommap()
51 {
52     echo "=== FSX Light Mode, No Memory Mapping ==="
53     dd if=/dev/zero of=$TEST_DIR/fsx_lite_nommap bs=${FSX_FILE_SIZE} count=1 > /dev/null 2>&1
54     if ! ltp/fsx $FSX_ARGS -L -R -W $FSX_AVOID $TEST_DIR/fsx_lite_nommap > $tmp.output 2>&1
55     then
56         echo "ltp/fsx $FSX_ARGS -L -R -W $TEST_DIR/fsx_lite_nommap"
57         cat $tmp.output
58         return 1
59     fi
60     cat $tmp.output
61     return 0
62 }
63
64 _fsx_lite_mmap()
65 {
66     echo "=== FSX Light Mode, Memory Mapping ==="
67     dd if=/dev/zero of=$TEST_DIR/fsx_lite_mmap bs=${FSX_FILE_SIZE} count=1 > /dev/null 2>&1
68     if ! ltp/fsx $FSX_ARGS -L $FSX_AVOID $TEST_DIR/fsx_lite_mmap > $tmp.output 2>&1
69     then
70         echo "ltp/fsx $FSX_ARGS -L fsx_lite_mmap"
71         cat $tmp.output
72         return 1
73     fi
74     cat $tmp.output
75     return 0
76 }
77
78 _fsx_std_nommap()
79 {
80     echo "=== FSX Standard Mode, No Memory Mapping ==="
81     if ! ltp/fsx $FSX_ARGS -R -W $FSX_AVOID $TEST_DIR/fsx_std_nommap > $tmp.output 2>&1
82     then
83         echo "ltp/fsx $FSX_ARGS -R -W fsx_std_nommap"
84         cat $tmp.output
85         return 1
86     fi
87     cat $tmp.output
88     return 0
89 }
90
91 _fsx_std_mmap()
92 {
93     echo "=== FSX Standard Mode, Memory Mapping ==="
94     if ! ltp/fsx $FSX_ARGS $FSX_AVOID $TEST_DIR/fsx_std_mmap > $tmp.output 2>&1
95     then
96         echo "ltp/fsx $FSX_ARGS fsx_std_mmap"
97         cat $tmp.output
98         return 1
99     fi
100     cat $tmp.output
101     return 0
102 }
103
104 # real QA test starts here
105 _supported_fs generic
106 _supported_os Linux
107
108 _fsx_lite_nommap
109 _fsx_lite_mmap
110
111 _fsx_std_nommap
112 _fsx_std_mmap
113
114 #flush cache after write
115 FSX_ARGS="-f $FSX_ARGS"
116 _fsx_std_nommap
117 _fsx_std_mmap
118
119 status=0
120 _cleanup
121 exit