estimatecompare revision 1.1
11.1Sbouyer#!/bin/sh 21.1Sbouyer## First arg is expected number of blocks. Rest are args to be passed to dump. 31.1Sbouyerexpectedest=$1 41.1Sbouyershift 51.1Sbouyer 61.1Sbouyerecho "Expecting estimate around $expectedest blocks:" 71.1Sbouyerest=`/sbin/dump $* 2>&1 | grep estimated` 81.1Sbouyerecho $est 91.1Sbouyerblkest=`echo $est | awk '{print $3;}'` 101.1Sbouyer 111.1Sbouyerdiff=`echo $expectedest $blkest |\ 121.1Sbouyer awk '{if ($1<$2) print $2-$1; else print $1-$2;}'` 131.1Sbouyer 141.1Sbouyerthresh=10 151.1Sbouyer## Use an error threshold of $thresh blocks. The error could arise from 161.1Sbouyer## one machine with a larger / and /tmp than the system on which this 171.1Sbouyer## test was developed. 181.1Sbouyer 191.1Sbouyerif [ $diff -gt $thresh ]; then 201.1Sbouyer echo "Error: estimated $blkest blocks!" 211.1Sbouyer exit 1 221.1Sbouyerfi 23