]> www.infradead.org Git - users/hch/misc.git/commitdiff
perf test shell lock_contention: Extra debug diagnostics
authorIan Rogers <irogers@google.com>
Thu, 21 Aug 2025 16:38:18 +0000 (09:38 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 3 Sep 2025 15:34:54 +0000 (12:34 -0300)
In test_record_concurrent, as stderr is sent to /dev/null, error
messages are hidden. Change this to gather the error messages and dump
them on failure.

Some minor sh->bash changes to add some more diagnostics in
trap_cleanup.

Reviewed-by: James Clark <james.clark@linaro.org>
Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.ibm.com>
Cc: Blake Jones <blakejones@google.com>
Cc: Chun-Tse Shao <ctshao@google.com>
Cc: Collin Funk <collin.funk1@gmail.com>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jan Polensky <japo@linux.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Li Huafei <lihuafei1@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Nam Cao <namcao@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steinar H. Gunderson <sesse@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20250821163820.1132977-5-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/shell/lock_contention.sh

index d33d9e4392b065ba50218a0b595f052f4c23a5b7..7248a74ca2a3257dbbbbc8c5dd7a9e77b9248334 100755 (executable)
@@ -7,14 +7,17 @@ set -e
 err=0
 perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
 result=$(mktemp /tmp/__perf_test.result.XXXXX)
+errout=$(mktemp /tmp/__perf_test.errout.XXXXX)
 
 cleanup() {
        rm -f ${perfdata}
        rm -f ${result}
+       rm -f ${errout}
        trap - EXIT TERM INT
 }
 
 trap_cleanup() {
+       echo "Unexpected signal in ${FUNCNAME[1]}"
        cleanup
        exit ${err}
 }
@@ -75,10 +78,12 @@ test_bpf()
 test_record_concurrent()
 {
        echo "Testing perf lock record and perf lock contention at the same time"
-       perf lock record -o- -- perf bench sched messaging -p 2> /dev/null | \
+       perf lock record -o- -- perf bench sched messaging -p 2> ${errout} | \
        perf lock contention -i- -E 1 -q 2> ${result}
        if [ "$(cat "${result}" | wc -l)" != "1" ]; then
                echo "[Fail] Recorded result count is not 1:" "$(cat "${result}" | wc -l)"
+               cat ${errout}
+               cat ${result}
                err=1
                exit
        fi