From patchwork Fri May 1 13:37:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 11522585 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 27C81913 for ; Fri, 1 May 2020 13:52:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 105412173E for ; Fri, 1 May 2020 13:52:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588341137; bh=wlb9Yzf1cohxo7Y+UM3qahpyFZZr2kDu1/XLeApB72w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=P0icPrBADTW8CUlU+XTqY0WXrm2hOCNXiLpCvnSOqOlzDwCHpkqZoObwRI54npccE 4b1R2lM+534eyolN8Si2aaHpRIz9KVtRKyRlpoNWofo/AyphOZV65elmyqKgOu4lBM fDHmf/MPQbr1v5Uts7qGASpMlIPTJVq7RHmJVkZ4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730683AbgEANwQ (ORCPT ); Fri, 1 May 2020 09:52:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:36994 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728892AbgEANhq (ORCPT ); Fri, 1 May 2020 09:37:46 -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 EB9A324953; Fri, 1 May 2020 13:37:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588340266; bh=wlb9Yzf1cohxo7Y+UM3qahpyFZZr2kDu1/XLeApB72w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qkRNKTPpF3G39VW4lemYhQwxst5+2W+HkhacksfaLY75eEnaX4V38N2D2WcHbnbsG BXtM4qTyWIDc16a4lCyCMoMHkEpIeK9ZKX1Gl7HVwuCykTRhMfNpYlG15PpWEBFskH tAKg4qrXOw9YmBbSD6qR8ChmuPmGn4pUQNQZzcsU= 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 1/3] selftests/ftrace: Make XFAIL green color Date: Fri, 1 May 2020 22:37:41 +0900 Message-Id: <158834026136.28357.14691721094452323293.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 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Since XFAIL (Expected Failure) is expected to fail the test, which means that test case works as we expected. IOW, XFAIL is same as PASS. So make it green. Signed-off-by: Masami Hiramatsu --- tools/testing/selftests/ftrace/ftracetest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest index 063ecb290a5a..72e837d0dfc1 100755 --- a/tools/testing/selftests/ftrace/ftracetest +++ b/tools/testing/selftests/ftrace/ftracetest @@ -273,7 +273,7 @@ eval_result() { # sigval return $UNSUPPORTED_RESULT # depends on use case ;; $XFAIL) - prlog " [${color_red}XFAIL${color_reset}]" + prlog " [${color_green}XFAIL${color_reset}]" XFAILED_CASES="$XFAILED_CASES $CASENO" return 0 ;; From patchwork Fri May 1 13:37:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 11522561 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E4ACE912 for ; Fri, 1 May 2020 13:37:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C1D6C24965 for ; Fri, 1 May 2020 13:37:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588340277; bh=oxOL24FU0cXDlE8Pssg/a1Kx/+IYd0kIxLiLr1oVbFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=NJ3p7oH4JMke8JwArhjCDL0zAMCfeGtopxU8QPgvZl9MqXMtz4SFVFTsrPuDRN7zO aV4WKBcF83yuwuOIcEftb+PE+O6NThXSiL/yAR9Df4E9wHk61KpiL/6RWOW5NU6FJL 6IJdIhbDljC47PlrAYRjczzR7K7y/IxNamOfSM6o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730560AbgEANh4 (ORCPT ); Fri, 1 May 2020 09:37:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:37276 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730994AbgEANhz (ORCPT ); Fri, 1 May 2020 09:37:55 -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 B079424956; Fri, 1 May 2020 13:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588340275; bh=oxOL24FU0cXDlE8Pssg/a1Kx/+IYd0kIxLiLr1oVbFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PgdPXbrnlEcQZ7Zdlxg2fjtyQbhPPYoBN77PCimwAJENYjNala+4rCXtKvv++VlrS G4M52huUXzKwpFzDVCeJpBl1FL1SGFSVSQoR3LhqWGeSPXO2byvbBd3pm8fJVqfyaX 6/HgjpslBtvb5dtiM9wEUo7gEq4wpBJxjrHTGlL0= 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 2/3] selftests/ftrace: Pick only the first kprobe event to test Date: Fri, 1 May 2020 22:37:51 +0900 Message-Id: <158834027133.28357.11196486193798517250.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 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Since the kprobe/kprobe_args_type.tc reads out all event logs from the trace buffer, the test can fail if there is another fork event happens. Use head command to pick only the first kprobe event from the trace buffer to test the argument types. Signed-off-by: Masami Hiramatsu Reviewed-by: Steven Rostedt (VMware) --- .../ftrace/test.d/kprobe/kprobe_args_type.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc index 1bcb67dcae26..81490ecaaa92 100644 --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc @@ -38,7 +38,7 @@ for width in 64 32 16 8; do echo 0 > events/kprobes/testprobe/enable : "Confirm the arguments is recorded in given types correctly" - ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'` + ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'` check_types $ARGS $width : "Clear event for next loop" From patchwork Fri May 1 13:38:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 11522563 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3BF6C912 for ; Fri, 1 May 2020 13:38:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 208E724954 for ; Fri, 1 May 2020 13:38:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588340289; bh=mSuv1OzD0Oe9e54ZjMl1/6UOWX6mLCb7FDBbiNuzfeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=PFAMt1pcsPEkHTdQc1sD33HW3/HA4YDNYksAkfRtOus6F1XCZppRhyTkQp+KHjulS oDGFomoSuXbDfJRPvMfuAvrMq7OwiXDJ9DrwkI5pUiRrObODGmMno0K2YD3xJiDq2z zNh+1Pa1xVt1weUT2FHEWCkoSSmCoYPQuJoppgE8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729847AbgEANiI (ORCPT ); Fri, 1 May 2020 09:38:08 -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 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@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 Reviewed-by: Tom Zanussi --- 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