#!/bin/ksh
#
#pragma ident "@(#)tests2.tst	1.6      01/07/27 SMI"
# 
# Copyright 2004 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/dd.stf	# harddrive test
dls=				# data list
prgdir=prgs			# program directory
dfoutp=				# df output
fsys=				# file system
mpt=				# mount point

# functions

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

### MAIN ###

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

dls=`/opt/SUNWstaf/prgs/sliceinfo | sed -n '2p'`
dfoutp=`df -kl`

# list harddrive info
if [ -z "$dls" ] 
then
	echo "No Harddrives found."
	exit 1
else
	echo "$dls" | while read inline
	do
		echo "h:<HR><B><U>Storage tests - dd</U></B>:"							
		fsys=`echo "$inline" | awk '{print $1}'`
		mpt=`echo "$inline" | awk '{print $2}'`
		slc=`echo "$fsys" | sed 's/\// /g' | awk '{print $3}'`		
		echo "h:Default Hardrive slice = $slc:\nh:Default mount point = $mpt:"
		echo "$dfoutp" | grep -w "$fsys" | awk '{print "h:Available (KB) = "$4":"}'
		echo "X:4:$testcmd"
		echo "T:Enter target slice for dd to run on:$slc"    
		echo "x:5:"

		go_fun runt 1 0 10 1
	done
fi

