Commit 04e75822 authored by Mike Hibler's avatar Mike Hibler
Browse files

In disktest, use tdd (timed dd) if it is present.

Also, some cleanup.
parent 8dca3ce8
......@@ -34,6 +34,10 @@ else
checkutils="sourced"
fi
if [ -z "${BINDIR-""}" -a -f "/etc/emulab/paths.sh" ]; then
source /etc/emulab/paths.sh
fi
declare mfsmode="" #are we running in a MFS
if [ -f /etc/emulab/ismfs ] ; then
mfsmode=1
......@@ -43,7 +47,7 @@ fi
declare errext_val # used?
# Gobal Vars
# Global Vars
declare NOSM="echo" #do nothing command
declare host #emulab hostname
declare failed="" #major falure to be commicated to user
......@@ -590,4 +594,3 @@ timesys() {
done
} > $out 2>&1
}
......@@ -610,14 +610,19 @@ getwspeed() {
args="bs=64k count=8000"
fi
# do we have a working dd
canwe=$(which dd)
canwe=$(ls -l $canwe | grep busybox)
dd=$(which dd)
canwe=$(ls -l $dd | grep busybox)
[[ $canwe ]] && { echo bad_dd; return 0; }
# if we have a timed dd, use it
tdd=$(which tdd)
[[ $tdd ]] && { export TDD_DD=$dd; dd="$tdd timeout=5"; }
add_on_exit 'rm -f /tmp/ddresultw'
mynn=${#todo_exit[*]}
todo_exit[$mynn]='those are mine'
{
$(dd if=/dev/zero of=$hdname $args)
$($dd if=/dev/zero of=$hdname $args)
} > /tmp/ddresultw 2>&1
res=$(grep bytes /tmp/ddresultw)
echo $(parsedd $res)
......@@ -632,12 +637,17 @@ getrspeed() {
args="bs=64k count=8000"
fi
# do we have a working dd
canwe=$(which dd)
canwe=$(ls -l $canwe | grep busybox)
dd=$(which dd)
canwe=$(ls -l $dd | grep busybox)
[[ $canwe ]] && { echo bad_dd; return 0; }
# if we have a timed dd, use it
tdd=$(which tdd)
[[ $tdd ]] && { export TDD_DD=$dd; dd="$tdd timeout=5"; }
add_on_exit 'rm -f /tmp/ddresultr'
{
$(dd of=/dev/null if=$hdname $args)
$($dd of=/dev/null if=$hdname $args)
} > /tmp/ddresultr 2>&1
res=$(grep bytes /tmp/ddresultr)
echo $(parsedd $res)
......
......@@ -22,19 +22,6 @@
# }}}
#
mywhich() {
mypath=$(env | grep PATH)
mypath=${mypath/PATH=/}
mypath=${mypath//:/ }
for i in $mypath ; do
if [ -e $i/$1 ] ; then
echo $i/$1
return 0
fi
done
return 1
}
if [ -z "$BINDIR" ] ; then
if [ -r /etc/emulab/paths.sh ] ; then
source /etc/emulab/paths.sh
......@@ -45,7 +32,6 @@ if [ -z "$BINDIR" ] ; then
fi
PROJDIR=/proj/emulab-ops
#don't try and source unless runing in a full bash shell
source checkutils.sh
gatherinv_main() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment