From: Darrick J. Wong <djwong@xxxxxxxxxx> Now that the xfs_db freesp command prints a CDF of the free space histograms, fix the pct column extraction code to handle the two new columns by <cough> using awk. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- tests/xfs/004 | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/xfs/004 b/tests/xfs/004 index f18316b333..2d55d18801 100755 --- a/tests/xfs/004 +++ b/tests/xfs/004 @@ -84,14 +84,17 @@ then fi # check the 'pct' field from freesp command is good -perl -ne ' - BEGIN { $percent = 0; } - /free/ && next; # skip over free extent size number - if (/\s+(\d+\.\d+)$/) { - $percent += $1; - } - END { $percent += 0.5; print int($percent), "\n" } # round up -' <$tmp.xfs_db >$tmp.ans +awk ' +{ + if ($0 ~ /free/) { + next; + } + + percent += $5; +} +END { + printf("%d\n", int(percent + 0.5)); +}' < $tmp.xfs_db > $tmp.ans ans="`cat $tmp.ans`" echo "Checking percent column yields 100: $ans" if [ "$ans" != 100 ]