From: James Clark <james.clark@arm.com>
To: Adrian Hunter <adrian.hunter@intel.com>,
Ian Rogers <irogers@google.com>,
Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
Kan Liang <kan.liang@linux.intel.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v1 2/2] perf test: Add basic list test
Date: Wed, 29 Nov 2023 09:27:55 +0000 [thread overview]
Message-ID: <03b314c6-ed6d-ae17-5bc5-0170139f7feb@arm.com> (raw)
In-Reply-To: <a54d0a93-aacd-4c69-a34c-8628b0e18ee7@intel.com>
On 29/11/2023 09:00, Adrian Hunter wrote:
> On 29/11/23 10:10, Ian Rogers wrote:
>> Test that json output produces valid json.
>>
>> Signed-off-by: Ian Rogers <irogers@google.com>
>> ---
>> tools/perf/tests/shell/list.sh | 29 +++++++++++++++++++++++++++++
>> 1 file changed, 29 insertions(+)
>> create mode 100755 tools/perf/tests/shell/list.sh
>>
>> diff --git a/tools/perf/tests/shell/list.sh b/tools/perf/tests/shell/list.sh
>> new file mode 100755
>> index 000000000000..286879a9837a
>> --- /dev/null
>> +++ b/tools/perf/tests/shell/list.sh
>> @@ -0,0 +1,29 @@
>> +#!/bin/sh
>> +# perf list tests
>> +# SPDX-License-Identifier: GPL-2.0
>> +
>> +set -e
>> +err=0
>> +
>> +if [ "x$PYTHON" == "x" ]
>> +then
>> + if which python3 > /dev/null
>
> 'which' isn't always present. Maybe
>
> python3 --version >/dev/null 2>&1 && PYTHON=python3
>
Now that we have shellcheck integrated into the build, we could enable
the POSIX mode test which would warn against this usage of which and
suggest the alternative.
At the moment though there are several other usages of which already in
the tests. And probably enabling POSIX mode would come with hundreds of
other warnings to fix.
I'm not saying we shouldn't change this instance though, just adding the
info for the discussion.
>> + then
>> + PYTHON=python3
>> + elif which python > /dev/null
>> + then
>> + PYTHON=python
>> + else
>> + echo Skipping test, python not detected please set environment variable PYTHON.
>> + exit 2
>> + fi
>> +fi
>> +
>> +test_list_json() {
>> + echo "Json output test"
>> + perf list -j | $PYTHON -m json.tool
>> + echo "Json output test [Success]"
>> +}
>> +
>> +test_list_json
>> +exit $err
>
>
next prev parent reply other threads:[~2023-11-29 9:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-29 8:10 [PATCH v1 1/2] perf list: Fix json segfault Ian Rogers
2023-11-29 8:10 ` [PATCH v1 2/2] perf test: Add basic list test Ian Rogers
2023-11-29 9:00 ` Adrian Hunter
2023-11-29 9:27 ` James Clark [this message]
2023-11-29 17:21 ` Ian Rogers
2023-11-29 20:30 ` Arnaldo Carvalho de Melo
2023-11-29 21:37 ` Ian Rogers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=03b314c6-ed6d-ae17-5bc5-0170139f7feb@arm.com \
--to=james.clark@arm.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=atrajeev@linux.vnet.ibm.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox