1 1.1 bouyer #!/bin/sh 2 1.1 bouyer ## First arg is expected number of blocks. Rest are args to be passed to dump. 3 1.1 bouyer expectedest=$1 4 1.1 bouyer shift 5 1.1 bouyer 6 1.1 bouyer echo "Expecting estimate around $expectedest blocks:" 7 1.1 bouyer est=`/sbin/dump $* 2>&1 | grep estimated` 8 1.1 bouyer echo $est 9 1.1 bouyer blkest=`echo $est | awk '{print $3;}'` 10 1.1 bouyer 11 1.1 bouyer diff=`echo $expectedest $blkest |\ 12 1.1 bouyer awk '{if ($1<$2) print $2-$1; else print $1-$2;}'` 13 1.1 bouyer 14 1.1 bouyer thresh=10 15 1.1 bouyer ## Use an error threshold of $thresh blocks. The error could arise from 16 1.1 bouyer ## one machine with a larger / and /tmp than the system on which this 17 1.1 bouyer ## test was developed. 18 1.1 bouyer 19 1.1 bouyer if [ $diff -gt $thresh ]; then 20 1.1 bouyer echo "Error: estimated $blkest blocks!" 21 1.1 bouyer exit 1 22 1.1 bouyer fi 23