selftests/mm: dump a summary in run_vmtests.sh
authorPeter Xu <peterx@redhat.com>
Wed, 12 Apr 2023 16:41:17 +0000 (12:41 -0400)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 18 Apr 2023 23:30:02 +0000 (16:30 -0700)
Dump a summary after running whatever test specified.  Useful for human
runners to identify any kind of failures (besides exit code).

Link: https://lkml.kernel.org/r/20230412164117.327720-1-peterx@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Axel Rasmussen <axelrasmussen@google.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Dmitry Safonov <0x7f454c46@gmail.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Zach O'Keefe <zokeefe@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/run_vmtests.sh

index c0f93b6..ddf40f8 100644 (file)
@@ -5,6 +5,9 @@
 # Kselftest framework requirement - SKIP code is 4.
 ksft_skip=4
 
+count_pass=0
+count_fail=0
+count_skip=0
 exitcode=0
 
 usage() {
@@ -149,11 +152,14 @@ run_test() {
                "$@"
                local ret=$?
                if [ $ret -eq 0 ]; then
+                       count_pass=$(( count_pass + 1 ))
                        echo "[PASS]"
                elif [ $ret -eq $ksft_skip ]; then
+                       count_skip=$(( count_skip + 1 ))
                        echo "[SKIP]"
                        exitcode=$ksft_skip
                else
+                       count_fail=$(( count_fail + 1 ))
                        echo "[FAIL]"
                        exitcode=1
                fi
@@ -279,4 +285,6 @@ CATEGORY="soft_dirty" run_test ./soft-dirty
 # COW tests
 CATEGORY="cow" run_test ./cow
 
+echo "SUMMARY: PASS=${count_pass} SKIP=${count_skip} FAIL=${count_fail}"
+
 exit $exitcode