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