From 08223ad92346c9ffa54857d03f359ea44d02f3b4 Mon Sep 17 00:00:00 2001 From: wangchao Date: Thu, 11 Dec 2003 02:19:12 +0000 Subject: [PATCH] b=1135 r=Andreas Add a regression test script to test OST out-of-space. --- lustre/tests/ost_oos.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lustre/tests/ost_oos.sh diff --git a/lustre/tests/ost_oos.sh b/lustre/tests/ost_oos.sh new file mode 100644 index 0000000..73d1ec0 --- /dev/null +++ b/lustre/tests/ost_oos.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +export NAME=${NAME:-local} +export OSTSIZE=10000 + +MOUNT=${MOUNT:-/mnt/lustre} + +echo "mnt.." +sh llmount.sh +echo "done" +echo "" + +SUCCESS=1 + +FREESPACE=`df |grep $MOUNT|tr -s ' '|cut -d ' ' -f4` + +rm -f /tmp/oosfile +dd if=/dev/zero of=$MOUNT/oosfile count=$[$FREESPACE + 1] bs=1k 2>/tmp/oosfile + +RECORDSOUT=`grep "records out" /tmp/oosfile|cut -d + -f1` + +[ -z "`grep "No space left on device" /tmp/oosfile`" ] && \ + echo "failed:dd not return ENOSPC" && SUCCESS=0 + +[ $FREESPACE -lt $RECORDSOUT ] && \ + echo "failed:the space written by dd larger than available space" && \ + SUCCESS=0 + +FILESIZE=`ls -l $MOUNT/oosfile|tr -s ' '|cut -d ' ' -f5` +[ $RECORDSOUT -ne $[$FILESIZE/1024] ] && \ + echo "failed:the space written by dd not equal to the size of file" && \ + SUCCESS=0 + +[ $SUCCESS -eq 1 ] && echo "Success!" + +rm -f $MOUNT/oosfile* +rm -f /tmp/oosfile + +echo "" +echo "cln.." +sh llmountcleanup.sh -- 1.8.3.1