Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4444196rdh; Wed, 29 Nov 2023 01:28:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IENYYQIfZbD1QtG+fA2LMyix2hm3V/sPheB3ITFKLqmXgV60zUrbFaWT7Gy0vyTBYcgSbPN X-Received: by 2002:a05:6a20:1612:b0:18b:8dfa:8946 with SMTP id l18-20020a056a20161200b0018b8dfa8946mr19425795pzj.13.1701250127886; Wed, 29 Nov 2023 01:28:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701250127; cv=none; d=google.com; s=arc-20160816; b=OmvSUefMFRnAe4i18wZTXJlNTEeQGTQNIS15w1qivXL7O78FBLnHRgSVlCCRyBoWjr IRso0ioJ1Fgzyo5G7WQbIDswpmIec+4BAKuQ8aesJpCFWpG0mR/CG+I9QnIyWQmBsplA Pemy76KhnkGaBGedkvs/JXgcUBmXSKP7Ly7iyHMaNn12efPOjAnPVKKOxfK0EswpDSsW Pa3SlwrNKFins6jkg0kzz0xZzO9FMJf6VlXYKLT38VhAHD9Z3Gooy3kXbScN/7l+ZIsV Ht/g5+Fe1R7pLZNTA3IAnG1kQIh5WCBxCBWmMIoZcpJDh0JQymeE71qyZKBD4q7gorgT CJsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from:cc :references:to:content-language:subject:user-agent:mime-version:date :message-id; bh=k6ydFyrnLQPTZpU7PS5P9fT8MP4WTc+7rbDxvHjESko=; fh=bHuAevP8p6bDhIz4Eso3o6FU970PGVQKvbTOjvn7Fi8=; b=dF5EdNEt36WaUmcvsFJ7TZW+KT5KfN4hBp/3oWV58cBTtRdhdDEFwLH9PLERKBq2Mp AtVY6F7s1mBKSlCW1N04uwdroR48Nd/081HAJxClHuZmDgv8gk4bD8velrdvnkmxS6VY yXLmdII+WzRLlzZZLRVSInfmH2xW7a74H3dxBnS8u6UyGNZBwQFQHKnt7U1b1T7bB7lA vlZBSU32XpbhTROpG9Klx8wSWzdHHKxJsV7tUcz8XrSMbHOaljlIscpHdRrRMKpnbuI+ OYlIFyr6kOFSAN2yStNdVShRmPHmsIdnYnq73nGl78dXfhW9CBiCftk14EpnPaAwg7Jd 913g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id w19-20020aa78593000000b006cda1d3eed4si187889pfn.136.2023.11.29.01.28.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 01:28:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 2834F8051A32; Wed, 29 Nov 2023 01:28:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231540AbjK2J2S (ORCPT + 99 others); Wed, 29 Nov 2023 04:28:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231134AbjK2J17 (ORCPT ); Wed, 29 Nov 2023 04:27:59 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 211AC1FDB; Wed, 29 Nov 2023 01:27:58 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0746E2F4; Wed, 29 Nov 2023 01:28:45 -0800 (PST) Received: from [192.168.1.3] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3A2A93F6C4; Wed, 29 Nov 2023 01:27:56 -0800 (PST) Message-ID: <03b314c6-ed6d-ae17-5bc5-0170139f7feb@arm.com> Date: Wed, 29 Nov 2023 09:27:55 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v1 2/2] perf test: Add basic list test Content-Language: en-US To: Adrian Hunter , Ian Rogers , Athira Rajeev References: <20231129081004.1918096-1-irogers@google.com> <20231129081004.1918096-2-irogers@google.com> Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Kan Liang , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org From: James Clark In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.9 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 29 Nov 2023 01:28:45 -0800 (PST) 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 >> --- >> 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 > >