perf test: Workaround debug output in list test

Write the JSON output to a specific file to avoid debug output
breaking it.

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.vnet.ibm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Ross Zwisler <zwisler@chromium.org>
Cc: Shirisha G <shirisha@linux.ibm.com>
Link: https://lore.kernel.org/r/20240124043015.1388867-4-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Ian Rogers 2024-01-23 20:30:13 -08:00 committed by Arnaldo Carvalho de Melo
parent 79bacb6ad7
commit a734c7f969

View File

@ -3,17 +3,32 @@
# SPDX-License-Identifier: GPL-2.0
set -e
err=0
shelldir=$(dirname "$0")
# shellcheck source=lib/setup_python.sh
. "${shelldir}"/lib/setup_python.sh
list_output=$(mktemp /tmp/__perf_test.list_output.json.XXXXX)
cleanup() {
rm -f "${list_output}"
trap - EXIT TERM INT
}
trap_cleanup() {
cleanup
exit 1
}
trap trap_cleanup EXIT TERM INT
test_list_json() {
echo "Json output test"
perf list -j | $PYTHON -m json.tool
perf list -j -o "${list_output}"
$PYTHON -m json.tool "${list_output}"
echo "Json output test [Success]"
}
test_list_json
exit $err
cleanup
exit 0