| #!/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 $(git grep -l -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=$(git grep 'KUNIT_CASE' | grep -Ev '^Documentation/|get_metrics.sh|include/kunit/test.h' | 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" |