Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1643181ybk; Mon, 11 May 2020 00:25:44 -0700 (PDT) X-Google-Smtp-Source: APiQypIscnGIeXmrAvx1+l72FkK+WEwdZjq3OEkCN5h0drxwGBtvO3T/tUnwH36khJyOZ/fv7B7n X-Received: by 2002:a05:6402:311c:: with SMTP id dc28mr11670167edb.323.1589181944570; Mon, 11 May 2020 00:25:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589181944; cv=none; d=google.com; s=arc-20160816; b=V8e86d51NyjUXTOsPDxroWHiOmCdJZIcoKxuQruZ3lvgN8WvMoPkhMXVJdYMdsThnp +0AIUCgVnQqce0yBhdOgP3kkWDfKOkt+Fhc65ZVrxVEPhZfRPcf3F40DR94NTS2pWnAv ugHW/TOJ/WWoOUUvFblT1caIuVAMS/Hz/byV5gRgYoyplr9Q3ORMGA5z9LqUkYB5awSY TN0p9CO2XQRNLUc7W8pnNa4wmBe/gHYisOe9U88LuMkQoPSot3VzzN79D6YKxQi/e9od j+LOHkydBrZ2yr5bDq0Y9qBBD7mE85LZX7o3HBhd6en0m7BwlzprzPM66YPsp9/uDnYP CfnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :references:subject:cc:to:mime-version:user-agent:from:date :message-id; bh=ugFzriqpgQhtySwuGzrKsIowA1XwhBeItbFNBv6smXY=; b=ZS3kALklUs1DxleHjNm5Xjq5czxsviOZytWmvM/V43T2TFrVR9qfbwbb9KkUQTUjmQ 9MfXVwFKj9WZt8jm8dtZoxLx+Hsxtbk3fdVP428nM7nnz9cdoWlTkd2xlp+twf95SsQ1 yTiGK8eFFkORU1n8AznA5QiQN9rrRqY5TfpE3nBazBkvI0fNTaE06vHOaTqbibuXOnid QHHPNrnQMw38kY9JTd/dPnUHRwbA+3lVG4FJYyzUk8RbY2nEilVugCJCye0lKW3tRBZL BJvLS8lln28Bez1NGnehn52YCjW4ZU7hXv67apFXk/weikO8p479mxSCIBDvIPLDhRuF 6EyQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q7si5368508eds.494.2020.05.11.00.25.21; Mon, 11 May 2020 00:25:44 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728566AbgEKHWc (ORCPT + 99 others); Mon, 11 May 2020 03:22:32 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:57148 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725790AbgEKHWc (ORCPT ); Mon, 11 May 2020 03:22:32 -0400 X-IronPort-AV: E=Sophos;i="5.73,378,1583164800"; d="scan'208";a="91905791" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 11 May 2020 15:22:27 +0800 Received: from G08CNEXMBPEKD06.g08.fujitsu.local (unknown [10.167.33.206]) by cn.fujitsu.com (Postfix) with ESMTP id 11D734BCC89B; Mon, 11 May 2020 15:22:27 +0800 (CST) Received: from [10.167.220.69] (10.167.220.69) by G08CNEXMBPEKD06.g08.fujitsu.local (10.167.33.206) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 11 May 2020 15:22:27 +0800 Message-ID: <5EB8FD31.9020906@cn.fujitsu.com> Date: Mon, 11 May 2020 15:22:25 +0800 From: Xiao Yang User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.2; zh-CN; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 MIME-Version: 1.0 To: Masami Hiramatsu CC: Steven Rostedt , Shuah Khan , , , Tom Zanussi , Li Philip , Liu Yiding Subject: Re: [PATCH 3/3] selftests/ftrace: Use /bin/echo instead of built-in echo References: <158834025077.28357.15141584656220094821.stgit@devnote2> <158834028054.28357.398159034694277189.stgit@devnote2> <5EB3AE7C.5@cn.fujitsu.com> <20200507181505.3e8369ee39f14d9c74ec986b@kernel.org> In-Reply-To: <20200507181505.3e8369ee39f14d9c74ec986b@kernel.org> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.167.220.69] X-ClientProxiedBy: G08CNEXCHPEKD05.g08.fujitsu.local (10.167.33.203) To G08CNEXMBPEKD06.g08.fujitsu.local (10.167.33.206) X-yoursite-MailScanner-ID: 11D734BCC89B.AFEAC X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: yangx.jy@cn.fujitsu.com X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/5/7 17:15, Masami Hiramatsu wrote: > On Thu, 7 May 2020 14:45:16 +0800 > Xiao Yang wrote: > >> On 2020/5/1 21:38, Masami Hiramatsu wrote: >>> Since the built-in echo has different behavior in POSIX shell >>> (dash) and bash, we forcibly use /bin/echo -E (not interpret >>> backslash escapes) by default. >>> >>> This also fixes some test cases which expects built-in >>> echo command. >>> >>> Reported-by: Liu Yiding >>> Signed-off-by: Masami Hiramatsu >>> --- >>> tools/testing/selftests/ftrace/test.d/functions | 3 +++ >>> .../test.d/trigger/trigger-trace-marker-hist.tc | 2 +- >>> .../trigger-trace-marker-synthetic-kernel.tc | 4 ++++ >>> .../trigger/trigger-trace-marker-synthetic.tc | 4 ++-- >>> 4 files changed, 10 insertions(+), 3 deletions(-) >>> >>> diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions >>> index 5d4550591ff9..ea59b6ea2c3e 100644 >>> --- a/tools/testing/selftests/ftrace/test.d/functions >>> +++ b/tools/testing/selftests/ftrace/test.d/functions >>> @@ -1,3 +1,6 @@ >>> +# Since the built-in echo has different behavior in POSIX shell (dash) and >>> +# bash, we forcibly use /bin/echo -E (not interpret backslash escapes). >>> +alias echo="/bin/echo -E" >> Hi Masami, Steven >> >> It seems that only kprobe_syntax_errors.tc is impacted by the issue >> currently. Is it necessary for all tests to use /bin/echo and could we >> just make kprobe_syntax_errors.tc use /bin/echo? > > Yes, I would like to unify the "echo"'s behavior among the testcases > instead of patching each failure in the future. > Or would you have any concern on it? Hi Masami, Very sorry for the late reply. We may not avoid fixing related failures after your change: 1) We have to reuse built-in echo (do alias echo=echo) if we want to test common_pid for histogram. 2) We have to reuse built-in echo if some new tests want to interpret backslash escapes in future. Is it simple to provide two implementations of echo?(built-in echo and echo command?) and then just apply echo command for kprobe_syntax_errors.tc? BTW: My suggestion may not be correct. Best Regards, Xiao Yang > > Thank you, > >> >> Best Regards, >> Xiao Yang >> >>> >>> clear_trace() { # reset trace output >>> echo> trace >>> diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc >>> index ab6bedb25736..b3f70f53ee69 100644 >>> --- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc >>> +++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc >>> @@ -30,7 +30,7 @@ fi >>> >>> echo "Test histogram trace_marker tigger" >>> >>> -echo 'hist:keys=common_pid'> events/ftrace/print/trigger >>> +echo 'hist:keys=ip'> events/ftrace/print/trigger >>> for i in `seq 1 10` ; do echo "hello"> trace_marker; done >>> grep 'hitcount: *10$' events/ftrace/print/hist> /dev/null || \ >>> fail "hist trigger did not trigger correct times on trace_marker" >>> diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic-kernel.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic-kernel.tc >>> index 18b4d1c2807e..c1625d945f4d 100644 >>> --- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic-kernel.tc >>> +++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic-kernel.tc >>> @@ -44,6 +44,10 @@ echo 'latency u64 lat'> synthetic_events >>> echo 'hist:keys=pid:ts0=common_timestamp.usecs'> events/sched/sched_waking/trigger >>> echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).latency($lat)'> events/ftrace/print/trigger >>> echo 'hist:keys=common_pid,lat:sort=lat'> events/synthetic/latency/trigger >>> + >>> +# We have to use the built-in echo here because waking up pid must be same >>> +# as echoing pid. >>> +alias echo=echo >>> sleep 1 >>> echo "hello"> trace_marker >>> >>> diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc >>> index dd262d6d0db6..23e52c8d71de 100644 >>> --- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc >>> +++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc >>> @@ -36,8 +36,8 @@ fi >>> echo "Test histogram trace_marker to trace_marker latency histogram trigger" >>> >>> echo 'latency u64 lat'> synthetic_events >>> -echo 'hist:keys=common_pid:ts0=common_timestamp.usecs if buf == "start"'> events/ftrace/print/trigger >>> -echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(ftrace.print).latency($lat) if buf == "end"'>> events/ftrace/print/trigger >>> +echo 'hist:keys=ip:ts0=common_timestamp.usecs if buf == "start"'> events/ftrace/print/trigger >>> +echo 'hist:keys=ip:lat=common_timestamp.usecs-$ts0:onmatch(ftrace.print).latency($lat) if buf == "end"'>> events/ftrace/print/trigger >>> echo 'hist:keys=common_pid,lat:sort=lat'> events/synthetic/latency/trigger >>> echo -n "start"> trace_marker >>> echo -n "end"> trace_marker >>> >>> >>> >>> . >>> >> >> >> > >