235: do smaller test IO
[xfstests-dev.git] / 275
1 #! /bin/bash
2 # FS QA Test No. 275
3 #
4 # The posix write test. when write size is larger than disk free size,
5 # should write as more as possible
6 #
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2011-2012 Fujitsu, 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 #creator
26 owner=wu.bo@cn.fujitsu.com
27
28 seq=`basename $0`
29 echo "QA output created by $seq"
30
31 here=`pwd`
32 tmp=/tmp/$$
33 status=0    # success is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
35
36 _cleanup()
37 {
38         cd /
39         rm -f $SCRATCH_MNT/* $tmp.*
40         _scratch_unmount
41 }
42
43 . ./common.rc
44 . ./common.filter
45
46 # real QA test starts here
47 _supported_fs generic
48 _supported_os IRIX Linux
49 _require_scratch
50
51 echo "------------------------------"
52 echo "write lack test"
53 echo "------------------------------"
54
55 rm -f $seq.full
56
57 umount $SCRATCH_DEV 2>/dev/null
58 _scratch_mkfs_sized $((1 * 1024 * 1024 * 1024)) >>$seq.full 2>&1
59 _scratch_mount
60
61 rm -rf $SCRATCH_MNT/*
62 cd $SCRATCH_MNT
63
64 dd if=/dev/zero of=tmp1 bs=4K count=1 >/dev/null 2>&1
65 if [ $? -ne 0 ]
66 then
67         echo "create file err"
68         status=1
69         exit
70 fi
71
72 dd if=/dev/zero of=tmp2 bs=1M >/dev/null 2>&1
73 dd if=/dev/zero of=tmp3 bs=4K >/dev/null 2>&1
74 sync
75
76 rm -f tmp1
77 sync
78
79 dd if=/dev/zero of=tmp1 bs=8K count=1 >/dev/null 2>&1
80 _filesize=`du tmp1 | awk '{print $1}'`
81 if [ $_filesize -ne 4 ]
82 then
83         echo "write file err"
84         status=1
85         exit
86 fi
87
88 echo "done"
89 exit