From: Darrick J. Wong Date: Tue, 27 Aug 2024 18:46:39 +0000 (-0700) Subject: xfs/004: fix column extraction code X-Git-Tag: v2024.09.08~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=18c331d98c29c3c09927eb4a2c2be53655c7e478;p=xfstests-dev.git xfs/004: fix column extraction code 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 using awk. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Zorro Lang --- diff --git a/tests/xfs/004 b/tests/xfs/004 index 8b2fd9b3..473b82c9 100755 --- a/tests/xfs/004 +++ b/tests/xfs/004 @@ -82,14 +82,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 ]