Message ID | 20231129081004.1918096-2-irogers@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp189368vqn; Wed, 29 Nov 2023 00:11:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IH/XZni3m+NmZnQ5eUq+1mat5NoNVNm5O3/d3p18EvKMqZYQIKSKFkdIsGnyFq3G4eGYLM8 X-Received: by 2002:a9d:6b18:0:b0:6d8:2883:cb5a with SMTP id g24-20020a9d6b18000000b006d82883cb5amr9641162otp.24.1701245486915; Wed, 29 Nov 2023 00:11:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701245486; cv=none; d=google.com; s=arc-20160816; b=vnc0p3I1rshX/bWioEbTZQdmwYMI/Tlv785l+5k8IXC3fS/rTtL1ccEt5bhpx9QgUL WoQm9YqUdIESZmOgJ74nOH2g/JyVkBk1fCo/PyLw6Z4aQ0rQrZGaNVqzFGUANeWhkNmT BIk/oGgHjYdhsSPNkdlVk31oYw8g+F4y3Wdu56AdnvdHtTskE+dkJLRUvsGZO87jtS+3 5zlGHT+XEFGMbpO/a8AzXfhRo/lUfmiRiZgFky+euHg8yrxYgETUPLBd8C5K8jx2KzCY eKGqJp9rtp2d+PEXnsa3etuLff976RGtZxFdz6IhBfBYp/ihvu8941fk6LpXGSihiRJE i70A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=pfx1JC4eBOGrcYnY6xicCWpxUTppoeccvNEbp92VzIk=; fh=OxO30iphCJ5T7Q0u7v9RAoN8TrpFE3bNOof1u+XBh30=; b=P2OKT460pIg2OL6laZEYBoXtaL/2BehDIBIDLvkX5GXhqVV/qCSLCDgjimjk04lJMg RCI2j6wGRNKat/2JIch6m0PnnAzqA4FFTfLl9fCJsCg5NxH2Kwga3z1xSfxz/MpU/nQH kNELXxWcaozQw04x0jVvOhPezR6Xm1q8ztEOYaUFMrkXS+o+t7wGp5nqwpZaSgUOT3xC pWmFQVYfOrAqw6wt6Axhfner7LTX8w0yZlgoKsr7g9kHL5QCyj66irxa+HQuxyW/b09J 4FdyByjZNVMkRY5h1jteiqZfP9YXH+w+MrEZuqXqW9f5I/wahKaTyhof1OZE8C5hWWY3 sOzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=c1+LsFpW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id i27-20020a63585b000000b005c602ff4068si1240201pgm.438.2023.11.29.00.11.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 00:11:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=c1+LsFpW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 59CED8077FFF; Wed, 29 Nov 2023 00:10:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229517AbjK2IK2 (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Wed, 29 Nov 2023 03:10:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229513AbjK2IK1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 29 Nov 2023 03:10:27 -0500 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEB5F10F0 for <linux-kernel@vger.kernel.org>; Wed, 29 Nov 2023 00:10:32 -0800 (PST) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-5cd1172b815so5415367b3.0 for <linux-kernel@vger.kernel.org>; Wed, 29 Nov 2023 00:10:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701245432; x=1701850232; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=pfx1JC4eBOGrcYnY6xicCWpxUTppoeccvNEbp92VzIk=; b=c1+LsFpWXVZa9f0P5WSJVas0Ky1Ns9z08OWReCQPUx8UbCCItqqEjvqKl9VaEWy/T8 +KVwuU6p8GeqL84vzu9l2ePUgs154JheZQq+kFRA6eb0XGF5SQqR0fKtljCEUlxCO4mn D4n8LB1H18QLEMUBV05lbnVllpkBtSl++Ankn+zpMLqLcPQw8UfhBeVdNAwdhXCe45ex bEN5J6Fx4j9jRZ+mKczV96Bz0+gYWgXpqBsQAdNXYxkeg+mJLCuCUnULQ0Y28bc4K4rF dJ4RyLAfPIzZ79PeyQ1kmBlcAId4DIzHFFuVS2qe4AzRYdC1nBJDRbe2b4byUD/na57w HnVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701245432; x=1701850232; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pfx1JC4eBOGrcYnY6xicCWpxUTppoeccvNEbp92VzIk=; b=hemnjsavLDh1k1cGvt7WF4Qo9y2Afvaubd8AZhQxelFQFnBgHpU+KL5HmsxwsC/3mz ghqCHhLFOc7ahYCQZtKt35mJ/S/rM79Nqzxp/JlHFeqNypqZSYBVNSuvF3lsF0FQC7FN CeApoZKOpyLCSWECnaSZJqLGvE2ugEo+sAg0+YJp/kcIE9fWnrXWGUL3HNhOUw65ehPj xZ8Y0uDcgTpZp0dlkjcQIEjAgLMkA6yZ4w+2z+tDupe/2J0G2hklYh07QsZFx/aVqrfU UshjcdFqW3o59UWZOGB/nCh9/L5kRqzgGRBj583x6YLbHb2wMAEw/j5knnHBBml0eXdi 5wSw== X-Gm-Message-State: AOJu0Yyo5WIXu7wvCgKQfLgEa2MJESetnkdtXZvysBbUyrmnbY+LrZRZ +67g9S7caoLQ42JCoTDocPMBahnRbdBe X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:763b:80fa:23ca:96f8]) (user=irogers job=sendgmr) by 2002:a05:690c:2b0a:b0:5d0:8fb3:559c with SMTP id em10-20020a05690c2b0a00b005d08fb3559cmr253486ywb.0.1701245431941; Wed, 29 Nov 2023 00:10:31 -0800 (PST) Date: Wed, 29 Nov 2023 00:10:04 -0800 In-Reply-To: <20231129081004.1918096-1-irogers@google.com> Message-Id: <20231129081004.1918096-2-irogers@google.com> Mime-Version: 1.0 References: <20231129081004.1918096-1-irogers@google.com> X-Mailer: git-send-email 2.43.0.rc1.413.gea7ed67945-goog Subject: [PATCH v1 2/2] perf test: Add basic list test From: Ian Rogers <irogers@google.com> To: 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>, Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, Kan Liang <kan.liang@linux.intel.com>, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 29 Nov 2023 00:10:47 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783885187789756462 X-GMAIL-MSGID: 1783885187789756462 |
Series |
[v1,1/2] perf list: Fix json segfault
|
|
Commit Message
Ian Rogers
Nov. 29, 2023, 8:10 a.m. UTC
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
Comments
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 > + 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
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 > >
On Wed, Nov 29, 2023 at 1:27 AM James Clark <james.clark@arm.com> wrote: > > > > 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. Sounds good to me. Fwiw, the instance where I lifted this code was: https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/tests/shell/stat+json_output.sh?h=perf-tools-next#n12 With this change: ``` diff --git a/tools/perf/tests/Makefile.tests b/tools/perf/tests/Makefile.tests index fdaca5f7a946..06de6d3f4842 100644 --- a/tools/perf/tests/Makefile.tests +++ b/tools/perf/tests/Makefile.tests @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 # Athira Rajeev <atrajeev@linux.vnet.ibm.com>, 2023 -PROGS := $(shell find tests/shell -perm -o=x -type f -name '*.sh') +PROGS := $(shell find tests/shell -executable -type f -name '*.sh') FILE_NAME := $(notdir $(PROGS)) FILE_NAME := $(FILE_NAME:%=.%) LOGS := $(join $(dir $(PROGS)),$(FILE_NAME)) ``` shellcheck now runs for me. I'll try adding the posix check into the patch series, as well as fixing other instances I can see. Thanks, Ian > >> + 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 > > > >
Em Wed, Nov 29, 2023 at 09:21:12AM -0800, Ian Rogers escreveu: > On Wed, Nov 29, 2023 at 1:27 AM James Clark <james.clark@arm.com> wrote: > > > > > > > > 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. > > Sounds good to me. Fwiw, the instance where I lifted this code was: > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/tests/shell/stat+json_output.sh?h=perf-tools-next#n12 > > With this change: > ``` > diff --git a/tools/perf/tests/Makefile.tests b/tools/perf/tests/Makefile.tests > index fdaca5f7a946..06de6d3f4842 100644 > --- a/tools/perf/tests/Makefile.tests > +++ b/tools/perf/tests/Makefile.tests > @@ -1,7 +1,7 @@ > # SPDX-License-Identifier: GPL-2.0 > # Athira Rajeev <atrajeev@linux.vnet.ibm.com>, 2023 > > -PROGS := $(shell find tests/shell -perm -o=x -type f -name '*.sh') > +PROGS := $(shell find tests/shell -executable -type f -name '*.sh') > FILE_NAME := $(notdir $(PROGS)) > FILE_NAME := $(FILE_NAME:%=.%) > LOGS := $(join $(dir $(PROGS)),$(FILE_NAME)) > ``` > > shellcheck now runs for me. I'll try adding the posix check into the > patch series, as well as fixing other instances I can see. So I'll wait for a v2 for this one, ok? - Arnaldo
On Wed, Nov 29, 2023 at 12:30 PM Arnaldo Carvalho de Melo <acme@kernel.org> wrote: > > Em Wed, Nov 29, 2023 at 09:21:12AM -0800, Ian Rogers escreveu: > > On Wed, Nov 29, 2023 at 1:27 AM James Clark <james.clark@arm.com> wrote: > > > > > > > > > > > > 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. > > > > Sounds good to me. Fwiw, the instance where I lifted this code was: > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/tests/shell/stat+json_output.sh?h=perf-tools-next#n12 > > > > With this change: > > ``` > > diff --git a/tools/perf/tests/Makefile.tests b/tools/perf/tests/Makefile.tests > > index fdaca5f7a946..06de6d3f4842 100644 > > --- a/tools/perf/tests/Makefile.tests > > +++ b/tools/perf/tests/Makefile.tests > > @@ -1,7 +1,7 @@ > > # SPDX-License-Identifier: GPL-2.0 > > # Athira Rajeev <atrajeev@linux.vnet.ibm.com>, 2023 > > > > -PROGS := $(shell find tests/shell -perm -o=x -type f -name '*.sh') > > +PROGS := $(shell find tests/shell -executable -type f -name '*.sh') > > FILE_NAME := $(notdir $(PROGS)) > > FILE_NAME := $(FILE_NAME:%=.%) > > LOGS := $(join $(dir $(PROGS)),$(FILE_NAME)) > > ``` > > > > shellcheck now runs for me. I'll try adding the posix check into the > > patch series, as well as fixing other instances I can see. > > So I'll wait for a v2 for this one, ok? Yep, sent: https://lore.kernel.org/lkml/20231129213428.2227448-1-irogers@google.com/ There are 2 fixes, one for perf list and the other for the shellcheck log file building stuff. The shellcheck stuff took a little longer PTAL. Thanks, Ian > - Arnaldo
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 + 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