From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94C05C636CD for ; Thu, 2 Feb 2023 00:41:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229609AbjBBAlC (ORCPT ); Wed, 1 Feb 2023 19:41:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjBBAlA (ORCPT ); Wed, 1 Feb 2023 19:41:00 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EBF2BD for ; Wed, 1 Feb 2023 16:40:58 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EF418619AC for ; Thu, 2 Feb 2023 00:40:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A270C433EF; Thu, 2 Feb 2023 00:40:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675298457; bh=+638RvD+o/lvgldQGllUcA183Rg0ykBFb7o+NSPTUtw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MGrW5dfLVI1DywUJCS8E98Zp62gAT/ebwCVOl7A/pSdej6qE4eGfZ1BmatXoQKMC+ mY9MA6JUgn0oAWesxFRBlPgyufc9vgiL/CW4Il4PetzieU/l3z/8dSVkuQ6DO12NqV iTBmKDFhrkySLZvx0h/V4sCupJCWCY+PD6QSZZe253z2sYyGIp3QWPWc9TjZWq1bMV nU2ARofjGDz3ryGOzZ1194bt+y8U8m17I11hOmeLNu8ywl8GmRlPbds7eX7Fq3gS9P is+r3E+XukAqo1aj8bPFPZ7qLdfkOgJp/LQBn9Lvoaysqb2bqbsioyfN2l7GWsYggw IhLatb5PCduuQ== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 965F6405BE; Wed, 1 Feb 2023 21:40:54 -0300 (-03) Date: Wed, 1 Feb 2023 21:40:54 -0300 From: Arnaldo Carvalho de Melo To: Athira Rajeev Cc: jolsa@kernel.org, ak@linux.intel.com, namhyung@kernel.org, irogers@google.com, james.clark@arm.com, mpe@ellerman.id.au, linux-perf-users@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, maddy@linux.vnet.ibm.com, rnsastry@linux.ibm.com, kjain@linux.ibm.com, disgoel@linux.ibm.com Subject: Re: [PATCH 1/2] tests/shell: Add check for perf data file in record+probe_libc_inet_pton test Message-ID: References: <20230201180421.59640-1-atrajeev@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230201180421.59640-1-atrajeev@linux.vnet.ibm.com> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org Em Wed, Feb 01, 2023 at 11:34:20PM +0530, Athira Rajeev escreveu: > "probe libc's inet_pton & backtrace it with ping" test > installs a uprobe and uses perf record/script to check > the backtrace. Currently even if the "perf record" fails, > the test reports success. Logs below: > > # ./perf test -v "probe libc's inet_pton & backtrace it with ping" > 81: probe libc's inet_pton & backtrace it with ping : > --- start --- Please add spaces before --- as this separates the commit log message from the patch and ends up chopped up when I use git-am. I'm fixing it now. - Arnaldo > test child forked, pid 304211 > failed to open /tmp/perf.data.Btf: No such file or directory > test child finished with 0 > ---- end ---- > probe libc's inet_pton & backtrace it with ping: Ok > > Fix this by adding check for presence of perf.data file > before proceeding with "perf script". > > With the patch changes, test reports fail correctly. > > # ./perf test -v "probe libc's inet_pton & backtrace it with ping" > 81: probe libc's inet_pton & backtrace it with ping : > --- start --- > test child forked, pid 304358 > FAIL: perf record failed to create "/tmp/perf.data.Uoi" > test child finished with -1 > ---- end ---- > probe libc's inet_pton & backtrace it with ping: FAILED! > > Signed-off-by: Athira Rajeev > --- > tools/perf/tests/shell/record+probe_libc_inet_pton.sh | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh > index 57e7a6a470c9..08cdd902d0cf 100755 > --- a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh > +++ b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh > @@ -58,6 +58,11 @@ trace_libc_inet_pton_backtrace() { > perf_data=`mktemp -u /tmp/perf.data.XXX` > perf_script=`mktemp -u /tmp/perf.script.XXX` > perf record -e $event_name/$eventattr/ -o $perf_data ping -6 -c 1 ::1 > /dev/null 2>&1 > + # check if perf data file got created in above step. > + if [ ! -e $perf_data ]; then > + printf "FAIL: perf record failed to create \"%s\" \n" "$perf_data" > + return 1 > + fi > perf script -i $perf_data | tac | grep -m1 ^ping -B9 | tac > $perf_script > > exec 3<$perf_script > -- > 2.39.0 > -- - Arnaldo