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