| #!/bin/bash |
| |
| VERBOSE= |
| [[ $1 == "-v" ]] && VERBOSE=y |
| |
| unique_contributors_num=$(git --no-pager shortlog --no-merges -n -s -- include/kunit lib/kunit tools/testing/kunit/ | wc -l) |
| patches_not_from_team_num=$(git log --pretty=oneline --perl-regexp \ |
| --author='^((?!Brendan Higgins|David Gow|Heidi Fahim|Felix Guo|Avinash Kondareddy|Daniel Latypov).*)$' \ |
| -- include/kunit lib/kunit tools/testing/kunit/ | wc -l) |
| |
| # Manual list of files to exclude in `all_tests`. |
| not_tests='lib/kunit/test.c |
| ' |
| |
| all_tests=$(for file_name in $(grep -Hrnl -e '#include <kunit/test.h>' | grep -E 'test|_kunit\.c' | grep -v '^Documentation') |
| do |
| if [[ ! $not_tests =~ (^|[[:space:]])"$file_name"($|[[:space:]]) ]] ; then |
| printf "$file_name\n" |
| fi |
| done) |
| |
| tests_total_num=$(echo "$all_tests" | wc -l) |
| test_authors=$(git --no-pager shortlog --no-merges -n -s -- $all_tests) |
| test_author_num=$(echo "$test_authors" | wc -l) |
| test_case_num=$(find ./ -type f ! -wholename '*/Documentation/*' ! -name 'test.h' ! -name 'get_metrics.sh' -print0 | |
| xargs -0 grep 'KUNIT_CASE' | wc -l) |
| |
| |
| if [[ -n $VERBOSE ]]; then |
| printf "All tests:\t$all_tests\n" |
| printf "Test authors:\t$test_authors\n" |
| fi |
| printf "Unique contributors:\t$unique_contributors_num\n" |
| printf "Number of patches:\t$patches_not_from_team_num\n" |
| printf "Number of total tests:\t$tests_total_num\n" |
| printf "Number of test authors:\t$test_author_num\n" |
| printf "Number of test cases:\t$test_case_num\n" |