#! /bin/sh # Compute a very basic test coverage of FreeBSD utilities. Any utility with at # least one test is considered to be covered. # Drop into an SVN checkout of svn+ssh://repo.freebsd.org/base/head and run like # `sh testcount.sh` ndirs=0 ntests=0 for d in bin cddl/sbin cddl/usr.bin cddl/usr.sbin sbin usr.bin usr.sbin; do ndirs=$(( $ndirs + `find $d -depth 1 -type d \ | egrep -v '\' \ | wc -l` )) ntests=$(( $ntests + `find $d -depth 2 -type d -name tests \ | wc -l` )) done # As a special case, the tests for sbin/geom live in tests/sys/geom ntests=$(( $ntests + 1)) printf "Binaries:\t\t%4d\n" $ndirs printf "Tested Binaries:\t%4d\n" $ntests printf "Coverage\t\t%7.2f%%\n" `echo "100 * $ntests / $ndirs" | bc -l`