From patchwork Thu Jan 16 01:20:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 13941118 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 236B312E7F; Thu, 16 Jan 2025 01:20:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736990437; cv=none; b=plfGJbyEoi7hr8H3iOej8M1GptEySboV9iISvDuXr5hEKa4pnHsFc4QU5wH7inmt7BMddy3SEGk593NVMdC26/ZpWMhEthGtR9sPrmpSfwU30OD18bsG1ub0qw89F2pcDm+I4LCIBguF/6oP0nUWz5qXGsPQmRVT3aaxHN8iqtY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736990437; c=relaxed/simple; bh=2caqcW4xcR3kTGIeEDV/7Bz2Kl4mwC5V5/8olQBw7rA=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=eKEZGij/jzYcY4Mi+0wiWWV7Ovl6n91gozM42+6mVJSVFjHZxac44jpW2p7bOBJyzsb1SxOVIzD8QnL5gzmZl6C9f0jcPEwV/w2uiIMmt7q3iWJJ86mk6PNqWeD1kSZqVwKy8CK4L+iOasv9Ql7aZCWp5317M/IJAy5T7LTqVP4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B525FC4CEE2; Thu, 16 Jan 2025 01:20:36 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1tYEYr-00000000hc1-2K43; Wed, 15 Jan 2025 20:20:41 -0500 Message-ID: <20250116012041.326701057@goodmis.org> User-Agent: quilt/0.68 Date: Wed, 15 Jan 2025 20:20:10 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton Subject: [PATCH 1/3] selftests/tracing: Test only toplevel README file not the instances References: <20250116012009.840870709@goodmis.org> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Steven Rostedt For the tests that have both a README attribute as well as the instance flag to run the tests as an instance, the instance version will always exit with UNSUPPORTED. That's because the instance directory does not contain a README file. Currently, the tests check for a README file in the directory that the test runs in and if there's a requirement for something to be present in the README file, it will not find it, as the instance directory doesn't have it. Have the tests check if the current directory is an instance directory, and if it is, check two directories above the current directory for the README file: /sys/kernel/tracing/README /sys/kernel/tracing/instances/foo/../../README Signed-off-by: Steven Rostedt (Google) --- tools/testing/selftests/ftrace/test.d/functions | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions index 779f3e62ec90..9f2a67fbaf4d 100644 --- a/tools/testing/selftests/ftrace/test.d/functions +++ b/tools/testing/selftests/ftrace/test.d/functions @@ -156,7 +156,13 @@ check_requires() { # Check required files and tracers exit_unsupported fi elif [ "$r" != "$i" ]; then - if ! grep -Fq "$r" README ; then + # If this is an instance, check the top directory + if echo $TRACING_DIR | grep -q "/instances/"; then + test="$TRACING_DIR/../.." + else + test=$TRACING_DIR + fi + if ! grep -Fq "$r" $test/README ; then echo "Required feature pattern \"$r\" is not in README." exit_unsupported fi From patchwork Thu Jan 16 01:20:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 13941119 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 641092AF19; Thu, 16 Jan 2025 01:20:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736990437; cv=none; b=iJmOMH+NWNkxvGKFBFVUCKIqfY6mjJqYnv87H9HG88Wm0RpjOBVjEJPcf2jVXHm94wxNCyBvOPi9g/Zm7Qbj9d5srZjSBFhLyTSsv6yW0CnL2KBoY0mWOdJapP093CsY/CrAvh+zXdKPqd/osqi7K0C5UgFig3lCkUiQ20uy+9w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736990437; c=relaxed/simple; bh=Lk/x+e6zUsybaanOMHLPBY6zlQw2IGkAsnVwH7B7WsU=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=RTgiJsu+y8JrahRuXTlRLTCX3LkiCindnTF5DsAMmsE/2vSMkl5LX+ex938bKVZ6vfdP/OzVfnR1/2lgQ2QttsaEL2otRjUQk7pIFL0gUhmQVUJb5EIQZw2/qLYICAKIE+BCWb7I/8zioJI3GWSgb5n69982OVqSYejPzub8XWI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05EA6C4CEE3; Thu, 16 Jan 2025 01:20:37 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1tYEYr-00000000hcW-3YuQ; Wed, 15 Jan 2025 20:20:41 -0500 Message-ID: <20250116012041.619083877@goodmis.org> User-Agent: quilt/0.68 Date: Wed, 15 Jan 2025 20:20:11 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton Subject: [PATCH 2/3] selftests/ftrace: Clean up triggers after setting them References: <20250116012009.840870709@goodmis.org> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Steven Rostedt The triggers set in trigger-onchange-action-hist.tc and trigger-snapshot-action-hist.tc are not cleaned up at the end. These tests can also be done in instances and without cleaning up the triggers, the instances can not be removed as they are still "busy". Signed-off-by: Steven Rostedt (Google) --- .../test.d/trigger/inter-event/trigger-onchange-action-hist.tc | 2 ++ .../test.d/trigger/inter-event/trigger-snapshot-action-hist.tc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onchange-action-hist.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onchange-action-hist.tc index 91339c130832..2430f541cd5d 100644 --- a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onchange-action-hist.tc +++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onchange-action-hist.tc @@ -19,4 +19,6 @@ if ! grep -q "changed:" events/sched/sched_waking/hist; then fail "Failed to create onchange action inter-event histogram" fi +echo '!hist:keys=comm:newprio=prio:onchange($newprio).save(comm,prio) if comm=="ping"' >> events/sched/sched_waking/trigger + exit 0 diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-snapshot-action-hist.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-snapshot-action-hist.tc index 147967e86584..334595daa9f4 100644 --- a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-snapshot-action-hist.tc +++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-snapshot-action-hist.tc @@ -27,4 +27,6 @@ if ! grep -q "comm=ping" snapshot; then fail "Failed to create snapshot action inter-event histogram" fi +echo '!hist:keys=comm:newprio=prio:onchange($newprio).save(comm,prio):onchange($newprio).snapshot() if comm=="ping"' >> events/sched/sched_waking/trigger + exit 0 From patchwork Thu Jan 16 01:20:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 13941120 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C46636AF5; Thu, 16 Jan 2025 01:20:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736990437; cv=none; b=Tl76tCnWPTCzgr5N1Hp2Mg/g7ID+q2E3qHYJaOBcJpyuFHi4JMzyFmwFDxsqLBVXUTJsdmhMyUz/TjIqwCo52LTetq8Q/CPB/cPpnstX+H3olCOvR1f5qvMcx+TaeH5QarLfrx02G4VDZuwJNf7GEdVHo2FbMfs6PAWlbQI111I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736990437; c=relaxed/simple; bh=VGdJe2e5SEdc/dNfwvsbLaZnhN9BFDQd65/K0mjd/K4=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=Jrv6uPT73cClYxIrnYQxIlOngbW20bKEHhEMMSHDDOZ4Hk/3oOsvAqAkvVq3IHu/atjp3pVdsL2rvaQQEeZ3ZOfKDvNVczzz/xG0vB72q7C6XThW08TwyiO7pbgvRYPdzUqBS65IgfnSqDg7sEWMDAT3kR4BGELMN4Nxs8dNghU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BEBAC4CED1; Thu, 16 Jan 2025 01:20:37 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1tYEYs-00000000hd0-0dcF; Wed, 15 Jan 2025 20:20:42 -0500 Message-ID: <20250116012041.920751669@goodmis.org> User-Agent: quilt/0.68 Date: Wed, 15 Jan 2025 20:20:12 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton Subject: [PATCH 3/3] selftests/tracing: Allow some more tests to run in instances References: <20250116012009.840870709@goodmis.org> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Steven Rostedt The tests: trigger-action-hist-xfail.tc trigger-onchange-action-hist.tc trigger-snapshot-action-hist.tc trigger-hist-expressions.tc can all run in an instance. Test them in an instance as well. Signed-off-by: Steven Rostedt (Google) --- .../test.d/trigger/inter-event/trigger-action-hist-xfail.tc | 1 + .../test.d/trigger/inter-event/trigger-onchange-action-hist.tc | 1 + .../test.d/trigger/inter-event/trigger-snapshot-action-hist.tc | 1 + .../selftests/ftrace/test.d/trigger/trigger-hist-expressions.tc | 1 + 4 files changed, 4 insertions(+) diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-action-hist-xfail.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-action-hist-xfail.tc index 1590d6bfb857..20a35fea13f8 100644 --- a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-action-hist-xfail.tc +++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-action-hist-xfail.tc @@ -2,6 +2,7 @@ # SPDX-License-Identifier: GPL-2.0 # description: event trigger - test inter-event histogram trigger expected fail actions # requires: set_event snapshot "snapshot()":README +# flags: instance fail() { #msg echo $1 diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onchange-action-hist.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onchange-action-hist.tc index 2430f541cd5d..55ab0270e5f7 100644 --- a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onchange-action-hist.tc +++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onchange-action-hist.tc @@ -2,6 +2,7 @@ # SPDX-License-Identifier: GPL-2.0 # description: event trigger - test inter-event histogram trigger onchange action # requires: set_event "onchange(var)":README ping:program +# flags: instance fail() { #msg echo $1 diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-snapshot-action-hist.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-snapshot-action-hist.tc index 334595daa9f4..9eb37c2fa417 100644 --- a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-snapshot-action-hist.tc +++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-snapshot-action-hist.tc @@ -2,6 +2,7 @@ # SPDX-License-Identifier: GPL-2.0 # description: event trigger - test inter-event histogram trigger snapshot action # requires: set_event snapshot events/sched/sched_process_fork/hist "onchange(var)":README "snapshot()":README ping:program +# flags: instance fail() { #msg echo $1 diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-expressions.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-expressions.tc index 05ffba299dbf..0ebda2068a00 100644 --- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-expressions.tc +++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-expressions.tc @@ -2,6 +2,7 @@ # SPDX-License-Identifier: GPL-2.0 # description: event trigger - test histogram expression parsing # requires: set_event events/sched/sched_process_fork/trigger events/sched/sched_process_fork/hist error_log "=":README +# flags: instance fail() { #msg