kunit: website: add script to generate metrics for tracking KUnit stats

A while ago I wrote a script to generate stats on KUnit success metrics
in the Linux kernel. After some discussion, it seems like we should put
it somewhere where everyone can easily see it and the website doesn't
seem like a terrible place.

Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
Change-Id: I3f0a7d59e9775f94d2a4e850803ab9c98b929216
diff --git a/get_metrics.sh b/get_metrics.sh
new file mode 100755
index 0000000..4213d20
--- /dev/null
+++ b/get_metrics.sh
@@ -0,0 +1,38 @@
+#! /bin/bash
+
+unique_contributors_num=$(git --no-pager shortlog -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).*)$' \
+  -- include/kunit lib/kunit tools/testing/kunit/ | wc -l)
+
+not_tests='lib/kunit/debugfs.c
+lib/kunit/string-stream.c
+lib/kunit/try-catch.c
+lib/kunit/assert.c
+lib/kunit/debugfs.h
+lib/kunit/test.c
+init/main.c
+mm/kasan/report.c
+Documentation/dev-tools/kunit/start.rst
+get_metrics.sh
+'
+
+all_tests=$(for file_name in $(grep -Hrnl -e '#include <kunit/test.h>')
+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 -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)
+
+#printf "All tests:\t$all_tests\n"
+#printf "Test authors:\t$test_authors\n"
+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"