]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
perf tools tests shell base_probe: Enhance print_overall_results to print summary...
authorAthira Rajeev <atrajeev@linux.vnet.ibm.com>
Fri, 6 Dec 2024 13:52:54 +0000 (19:22 +0530)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 18 Dec 2024 19:24:31 +0000 (16:24 -0300)
Currently print_overall_results prints the number of fails in the
summary, example from base_probe tests in testsuite_probe:

 ## [ FAIL ] ## perf_probe :: test_invalid_options SUMMARY ::
11 failures found

test_invalid_options contains multiple tests and out of that 11 failed.
Sometimes it could happen that it is due to missing dependency in the
build or environment dependency.

Example, perf probe -L requires DWARF enabled. otherwise
it fails as below:

 ./perf probe -L
  Error: switch `L' is not available because NO_DWARF=1

"-L" is tested as one of the option in:

   for opt in '-a' '-d' '-L' '-V'; do
   <<perf probe test>>
   print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "missing argument
for $opt"

Here -a and -d doesn't require DWARF. Similarly there are few other
tests requiring DWARF.

To hint the user that missing DWARF could be one issue, update
print_overall_results to print a comment string along with summary
hinting the possible cause. Update test_invalid_options.sh and
test_line_semantics.sh to pass the info about DWARF requirement since
these tests failed when perf is built without DWARF.

Use the check for presence of DWARF with "perf check feature" and append
the hint message based on the result.

With the change:

 ## [ FAIL ] ## perf_probe :: test_invalid_options SUMMARY ::
 11 failures found :: Some of the tests need DWARF to run

Reviewed-by: Kajol Jain <kjain@linux.ibm.com>
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Disha Goel <disgoel@linux.vnet.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Veronika Molnarova <vmolnaro@redhat.com>
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20241206135254.35727-1-atrajeev@linux.vnet.ibm.com
[ Minor edits changing "dwarf" to "DWARF" as its an acronym ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/shell/base_probe/test_invalid_options.sh
tools/perf/tests/shell/base_probe/test_line_semantics.sh
tools/perf/tests/shell/common/init.sh

index 1fedfd8b0d0ddf30f393750ebb1319f64e6a1a55..0f835558a14b2069ca0c199f3664f85005c89742 100755 (executable)
@@ -22,6 +22,9 @@ if ! check_kprobes_available; then
        exit 0
 fi
 
+# Check for presence of DWARF
+$CMD_PERF check feature -q dwarf
+[ $? -ne 0 ] && HINT_FAIL="Some of the tests need DWARF to run"
 
 ### missing argument
 
@@ -75,5 +78,5 @@ done
 
 
 # print overall results
-print_overall_results "$TEST_RESULT"
+print_overall_results "$TEST_RESULT" $HINT_FAIL
 exit $?
index d8f4bde0f585ac80b7314af64d7c12dc4d49a79a..b114f3e50b7fe1317edc58a02ff752b35d83d964 100755 (executable)
@@ -23,6 +23,9 @@ if ! check_kprobes_available; then
        exit 0
 fi
 
+# Check for presence of DWARF
+$CMD_PERF check feature -q dwarf
+[ $? -ne 0 ] && HINT_FAIL="Some of the tests need DWARF to run"
 
 ### acceptable --line descriptions
 
@@ -51,5 +54,5 @@ done
 
 
 # print overall results
-print_overall_results "$TEST_RESULT"
+print_overall_results "$TEST_RESULT" $HINT_FAIL
 exit $?
index 075f17623c8eaad0c6c7468ea93837fc27f8b7a6..259706ef58994bf9c6b8d18f04494288d83d3365 100644 (file)
@@ -46,10 +46,13 @@ print_results()
 print_overall_results()
 {
        RETVAL="$1"; shift
+       TASK_COMMENT="$*"
+       test -n "$TASK_COMMENT" && TASK_COMMENT=":: $TASK_COMMENT"
+
        if [ $RETVAL -eq 0 ]; then
                _echo "$MALLPASS## [ PASS ] ##$MEND $TEST_NAME :: $THIS_TEST_NAME SUMMARY"
        else
-               _echo "$MALLFAIL## [ FAIL ] ##$MEND $TEST_NAME :: $THIS_TEST_NAME SUMMARY :: $RETVAL failures found"
+               _echo "$MALLFAIL## [ FAIL ] ##$MEND $TEST_NAME :: $THIS_TEST_NAME SUMMARY :: $RETVAL failures found $TASK_COMMENT"
        fi
        return $RETVAL
 }