Whamcloud - gitweb
LU-160 Reduce OST size requirement for test 155
[fs/lustre-release.git] / lustre / tests / ost_oos.sh
1 #!/bin/bash
2
3 export NAME=${NAME:-local}
4 export OSTSIZE=10000
5
6 MOUNT=${MOUNT:-/mnt/lustre}
7
8 echo "mnt.."
9 sh llmount.sh
10 echo "done"
11 echo ""
12
13 SUCCESS=1
14
15 FREESPACE=`df |grep $MOUNT|tr -s ' '|cut -d ' ' -f4`
16
17 rm -f /tmp/oosfile
18 dd if=/dev/zero of=$MOUNT/oosfile count=$[$FREESPACE + 1] bs=1k 2>/tmp/oosfile
19
20 RECORDSOUT=`grep "records out" /tmp/oosfile|cut -d + -f1`
21
22 [ -z "`grep "No space left on device" /tmp/oosfile`" ] && \
23         echo "failed:dd not return ENOSPC" && SUCCESS=0
24
25 [ $FREESPACE -lt $RECORDSOUT ] && \
26         echo "failed:the space written by dd larger than available space" && \
27         SUCCESS=0
28
29 FILESIZE=`ls -l $MOUNT/oosfile|tr -s ' '|cut -d ' ' -f5`
30 [ $RECORDSOUT -ne $[$FILESIZE/1024] ] && \
31         echo "failed:the space written by dd not equal to the size of file" && \
32         SUCCESS=0
33
34 [ $SUCCESS -eq 1 ] && echo "Success!"
35
36 rm -f $MOUNT/oosfile*
37 rm -f /tmp/oosfile
38
39 echo ""
40 echo "cln.."
41 sh llmountcleanup.sh