#!/bin/ksh
#
#pragma ident   "@(#)tests4.tst 1.13     05/06/01 SMI"
# 
# Copyright 2005 Sun Microsystems, Inc.All rights reserved.
# Use is subject to license terms.
#
#
#
# Original Author: Michael Koller
# Modified by:	   Alex Kaplan
#

# variables
hctsdir=SUNWhcts			# base directory
hname=$1			# test system
testcmd=tests/str/bonnie.stf	# harddrive test
prgdir=prgs			# program directory

# functions

# do function
go_fun()
{
	$prgdir/funcs "$*" 2>&1
}	

### MAIN ###
sdir=`/opt/SUNWstaf/prgs/sliceinfo | awk '{print $2}' | sed -n '3p'`
if [ -z "$sdir" ]
then
        echo "No Harddrives found."
        exit 1
fi

# create a temp dir to be used as scratch dir. added by phost 2004.07.06
sdir=$sdir/bonnie.tmp
if [ ! -d $sdir ]
then
	mkdir -p $sdir
	chmod -R 777 $sdir
fi

# change to base directory
cd `dirname $0`
while [ `basename $PWD` != $hctsdir ]
do
	cd ..
done


echo "h:<HR><B><U>Storage tests - Bonnie</U></B>:"
echo "X:4:$testcmd"
echo "h:Default scratch directory = $sdir:"
echo "T:Enter file size:200"
echo "x:5:"
echo "T:Enter number of iterations:5"
echo "x:6:"
echo "T:Enter scratch directory:$sdir"
echo "x:7:"

go_fun runt 1 0 1 1
