NetBSD/regress/sys/fs/ffs/estimatecompare

23 lines
616 B
Bash
Executable File

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