Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp679174ybz; Fri, 1 May 2020 06:41:16 -0700 (PDT) X-Google-Smtp-Source: APiQypJhSEEsgO6HtkpOIiRQiQB+/YAlKhr918jLoCnTm0LY7ISONUxOfBENnJs8etrO5k7cbZCV X-Received: by 2002:a17:906:1490:: with SMTP id x16mr3022780ejc.323.1588340476718; Fri, 01 May 2020 06:41:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588340476; cv=none; d=google.com; s=arc-20160816; b=AgSkADZnVZwqZLUt+HVUd4YUmvcGkld31JeJ6i6oamCfNqb39t/mluklFJ3zpe2Wi6 vGycjsOtZKEZWjyuQ45nzth+29XLkny1rvk3SrOzWFCSfQ1P2ekUPqUE99hpBFN2Qwgx UiVkoZXTZA93eAHPTlAxPMxOTctB7uecWMa+xy9RYcaHru80jq2fCiA+6pTv520yaPmL q7Zj5yRF6sSucI2nKLvgX0zvRz3K8XDhngU51m/gziOBSWE1gSqngtcd3MI6PGZquBZD dUD8hXyYSoP9B9vTHrvQW5Xt1VeleTfzSCGo5aiUDLcWM/Q5p4gqIPfG1NmcxBJR7xaG ZSBw== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vmnsgQHSylHI3cInZLzPico9uUSO5Y2CLU5zzk5ZuvE=; b=GR2w6EobWi63/rQSoB1/teG8lMXlkK41B1gQATl5WG5SsY7nR1Z5RsyGpwkBVqnWHv HOnqBT8WSK3df5q+nyOdHeP/jMjIlETCpVGkQuQPLCPlz44FdMMEt9d+M6trjdQIpoxo GOTX1wRzdrDP1dGwmQwkKEUL6gEbLfT1ypeZ7IMsFJ9Nz5rVrj9z1Pi+emTx+4qr/ZmL Qm4TQTq0zN4CFmBLJ4JZUdfGXQKW5qYly6EOlAsdWBFhoEKeaNvanEU3ZVsnNTj9/4yY NyfluKZLEFGMBDKhtFaFMa0y9lW2rj9BFyw+rBcclw97BdmcTqWGl4qLr8OWZJtDfFDr ynXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=y9nxNpaM; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw10si1799095ejb.369.2020.05.01.06.40.53; Fri, 01 May 2020 06:41:16 -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=@kernel.org header.s=default header.b=y9nxNpaM; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730373AbgEANiJ (ORCPT + 99 others); Fri, 1 May 2020 09:38:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:37500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730622AbgEANiF (ORCPT ); Fri, 1 May 2020 09:38:05 -0400 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1BC53208DB; Fri, 1 May 2020 13:38:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588340285; bh=mSuv1OzD0Oe9e54ZjMl1/6UOWX6mLCb7FDBbiNuzfeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y9nxNpaMiW0L82qz7mEFZsPUVbm2IKzMRBVDNAK+e3q7V16WwDvhUXifrmXS6EMiF 4xJsGYFlM/VteBtQjXZk/KsuYbWHjvicegCwEl4XPFhohmS3kH/7fILE4tTdVNp4q3 DD6foufB71e0n+LI2Y75M3w/VC9gR6OL/9xVnG9E= From: Masami Hiramatsu To: Shuah Khan , Steven Rostedt Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Tom Zanussi , Masami Hiramatsu , Li Philip , Liu Yiding Subject: [PATCH 3/3] selftests/ftrace: Use /bin/echo instead of built-in echo Date: Fri, 1 May 2020 22:38:00 +0900 Message-Id: <158834028054.28357.398159034694277189.stgit@devnote2> X-Mailer: git-send-email 2.20.1 In-Reply-To: <158834025077.28357.15141584656220094821.stgit@devnote2> References: <158834025077.28357.15141584656220094821.stgit@devnote2> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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" 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