Currently, when running test suites (perf test), users must scroll
through hundreds of lines of console output to manually tally the number
of passed, skipped, or failed test cases.
Introduce an automated, global execution summary printed at the absolute
tail of the test run:
1. Track counts mid-flight inside the print_test_result() accumulator,
clearly separating pass counts into standalone main tests vs.
individual subtests (where num_test_cases > 1).
2. Accumulate the precise descriptions of all failed test cases
directly into a global string buffer, formatted with their suite
indices (e.g., 3.1: Parse event definition strings) for effortless
cross-referencing.
3. Define a summary printer function print_tests_summary() that
emits a colored outline of the final pass, skip, and fail totals,
followed by the explicit list of failed tests.
4. Invoke the summary printer right before freeing the test array at
the absolute tail of __cmd_test(), guaranteeing that the summary is
successfully printed even if an internal emergency signal cleanup
occurs or if the user interrupts the run early.
Example output:
```
$ sudo perf test -v
1: vmlinux symtab matches kallsyms : Skip
2: Detect openat syscall event : Ok
3: Detect openat syscall event on all cpus : Ok
...
163: perf trace summary : Ok
=== Test Summary ===
Passed main tests : 123
Passed subtests : 145
Skipped tests : 22
Failed tests : 6
List of failed tests:
92: perf kvm tests
95: kernel lock contention analysis test
120: perf metrics value validation
124: Check branch stack sampling
143: perftool-testsuite_probe
158: test Intel TPEBS counting mode
```
Assisted-by: Gemini-CLI:Google Gemini 3 Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@linaro.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>