Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp514610pxb; Wed, 22 Sep 2021 07:14:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfjSJsZD0TTuIGpos/lkWGh6sCbCYkfT6dwRtEaEeoDEps/WCtIxwHM/hVFuC5J9zA1BB5 X-Received: by 2002:a17:906:5f88:: with SMTP id a8mr43416785eju.564.1632320066712; Wed, 22 Sep 2021 07:14:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632320066; cv=none; d=google.com; s=arc-20160816; b=AN3EJcQwGxGVIGBIHKNfYzfAQ0tYaC9ic1O2lXRf2KEWq2R7jb2ZPyXikpr4fNBXBw q7i01m+y1vEfzWyjVbSt9crzw2xR1fGNgP3BPltbW/24aRFsacBDrnl3qOdbZQLLbmJU RRcG4OJJqS3fTaExABeULdaFfT6KWDJ5yMKOo0VyRwrfIibpv4BXtG8cnqxy1UQ1fghB 7VIh2f5PR7aU+s9HTfQ06QVZK5AxjO2Gp1OniWDScM4XRi+beFrCblpW3tvf4kuNSm2D XbSduAxY49ppm8XaXDvIkai002V6DZ0VCv+NfiVLVReGH82RQDHigEghzqf7ZKtDnZrH AKXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=B7MYilobLJ9/fVvIcDpd3si1fqKsE8CAaE+Ml5M1LvQ=; b=QVdNvS5wpihTBKVCN9yWwAtyfSsAxEoRRPr/lU5f1FtmuvwraNH4BEAUEHIK7txGNz 9v+gb4hm/Ijl4v4eSAP3bh1fUiNf7iEsOHL2YOxc1Lu4xPogsVt89XHozfqXjz2D2cy0 /67Oh3l6/vS1IOWr6sd1d705ny3R7974gt9/ksZlklH5d9SoUgGvVhCXSaLBWFUmdIIB uVCYTZFMZchrDHXxmE36T6Z3c4uqcLWxuNW9t//bPIGfw9GObwNWNXa/MuiTn01bsBjC eXZFh/Ql6XZBKLjNtlwB0wXUaRtQf9zU99TlauRyzW0SMuka1G8iuEaBGDNHgSUCNbh3 NFPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="c//OHKVO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r10si2923488eja.92.2021.09.22.07.13.56; Wed, 22 Sep 2021 07:14:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="c//OHKVO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232720AbhIVOKJ (ORCPT + 99 others); Wed, 22 Sep 2021 10:10:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232790AbhIVOKI (ORCPT ); Wed, 22 Sep 2021 10:10:08 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8398C061756 for ; Wed, 22 Sep 2021 07:08:38 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id y8so2819627pfa.7 for ; Wed, 22 Sep 2021 07:08:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=B7MYilobLJ9/fVvIcDpd3si1fqKsE8CAaE+Ml5M1LvQ=; b=c//OHKVOQmJ1HZzkXV5GbadAP9AJQFLyjKfvLmQLei6r2Zsfy8YaSoVMIvHGZGn/FV cxzl3Xt2tLJlzRp285x8Ym9ExAGCIDysxAWDm7Qv5xwYV3kmHCcEa8T0Mb8XGx0ffQcu uK2/PSEx32Og/NkxxU+r2dPrrQ2p+GS33sWetxVVRaF/kKjqD2PAZ2Til2mNQ70N7PIQ c+K+ZdbHRnTQXHTSb0EYkb0IaJD1mvFXv7StpC5aqvLsATwR69phAzJYQ8T9hk0kG/JL qpk5UV8Ck4T6Y8gHqNW8Aa06yEBgeBsKa7cfdWZom7nHbd3mdfJs6GHhNqkvjU+EoAki OPdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=B7MYilobLJ9/fVvIcDpd3si1fqKsE8CAaE+Ml5M1LvQ=; b=UwjPvPMIaoPTC13aJXfX8/RhKw2x6vR24PcjYlwzSv5+78dany+MVtvHwUoq68mODu gIvsnMxmT/LOPdUH6jaDC2zLNDyHeerduNVoxumJs93CBcDfxr5K89Z/CUF+mW5eSqtP f9tWXv4+ge+vmDHuvHBkvn2mUYs0qkbQLgud3yeCpD7W/EFgP2cFa8WnQHz7NQ9x62xq iEhs04PdGWgcVElh0K2cl5GF+VvQx3TAUtTkr35Jc/xGqZU+dsc9GTBeiEYrC4uDGV0H ToqBfXpQsyXLedQ71fwwxFbKdckMNiJNVew/hy5JwfwTqW1D85HVd7EoATxOVL9H6fx7 4GxQ== X-Gm-Message-State: AOAM531P8f197LS2nasLuyMynsxtSC9fuYmDQR/Zbs1QttgfbdxDmL0j TgUWYKF1qLJlVCP3gjtWj87mSQ== X-Received: by 2002:a63:e756:: with SMTP id j22mr32627295pgk.362.1632319718013; Wed, 22 Sep 2021 07:08:38 -0700 (PDT) Received: from leoy-ThinkPad-X240s ([213.173.35.225]) by smtp.gmail.com with ESMTPSA id l24sm3221029pgc.93.2021.09.22.07.08.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Sep 2021 07:08:37 -0700 (PDT) Date: Wed, 22 Sep 2021 22:08:32 +0800 From: Leo Yan To: James Clark Cc: acme@kernel.org, leo.yan@linaro.com, linux-perf-users@vger.kernel.org, Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] perf tests: Improve temp file cleanup in test_arm_coresight.sh Message-ID: <20210922140832.GB400258@leoy-ThinkPad-X240s> References: <20210921131009.390810-1-james.clark@arm.com> <20210921131009.390810-3-james.clark@arm.com> <20210922110012.GA400258@leoy-ThinkPad-X240s> <5a1c5eab-d9b7-5623-2d7d-c6b1921b3628@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5a1c5eab-d9b7-5623-2d7d-c6b1921b3628@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi James, On Wed, Sep 22, 2021 at 02:40:54PM +0100, James Clark wrote: [...] > >> cleanup_files() > >> { > >> rm -f ${perfdata} > >> rm -f ${file} > >> + rm -f "${perfdata}.old" > >> + trap - exit term int > >> + kill -2 $$ > > > > Here it always sends signal SIGINT to current PID with $$, another > > choice is to send signal based on the incoming signal type, like below: > > > > [[ "$1" = "int" ]] || kill -SIGINT $$ > > [[ "$1" = "term" ]] || kill -SIGTERM $$ > > Yes I thought that this might be an issue, but I tested it in a few different > scenarios. Especially when running it under the normal ./perf test command and > it didn't seem to cause an issue whether it passed or failed. So I'm not sure > if it's worth changing or not. Maybe it is in case it gets copy pasted into > another shell test? I think it's not very necessary to send signal again with command "kill -2 $$" at here. "kill -2 $$" sends the signal to the shell process itself rather than propagating signal to its parent process. And the up level's script should can detect an error with the returned exit code. So below change should be sufficient? cleanup_files() { rm -f ${perfdata} rm -f ${file} + rm -f "${perfdata}.old" + exit $glb_err } Sorry if I miss anything at here and cause noise. Thanks, Leo