linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomas Glozar <tglozar@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
	John Kacur <jkacur@redhat.com>,
	Luis Goncalves <lgoncalv@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Chang Yin <cyin@redhat.com>,
	Costa Shulyupin <costa.shul@redhat.com>,
	Tomas Glozar <tglozar@redhat.com>
Subject: [PATCH 7/8] rtla/tests: Add tests for actions
Date: Wed, 11 Jun 2025 15:56:43 +0200	[thread overview]
Message-ID: <20250611135644.219127-8-tglozar@redhat.com> (raw)
In-Reply-To: <20250611135644.219127-1-tglozar@redhat.com>

Add a bunch of tests covering most of both action on threshold
(-A/--on-threshold) and action on end (-N/--on-end). Parts sensitive to
implementation of hist/top are tested for both.

Signed-off-by: Tomas Glozar <tglozar@redhat.com>
---
 tools/tracing/rtla/tests/timerlat.t | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/tools/tracing/rtla/tests/timerlat.t b/tools/tracing/rtla/tests/timerlat.t
index 579c12a85e8f..b810b36a04a3 100644
--- a/tools/tracing/rtla/tests/timerlat.t
+++ b/tools/tracing/rtla/tests/timerlat.t
@@ -18,6 +18,8 @@ fi
 for option in $no_bpf_options
 do
 export RTLA_NO_BPF=$option
+
+# Basic tests
 check "verify help page" \
 	"timerlat --help"
 check "verify -s/--stack" \
@@ -36,6 +38,32 @@ check "verify -c/--cpus" \
 	"timerlat hist -c 0 -d 30s"
 check "hist test in nanoseconds" \
 	"timerlat hist -i 2 -c 0 -n -d 30s" 2
+
+# Actions tests
+check "trace output through -t" \
+	"timerlat hist -T 2 -t" 2 "^  Saving trace to timerlat_trace.txt$"
+check "trace output through -t with custom filename" \
+	"timerlat hist -T 2 -t custom_filename.txt" 2 "^  Saving trace to custom_filename.txt$"
+check "trace output through -A trace" \
+	"timerlat hist -T 2 -A trace" 2 "^  Saving trace to timerlat_trace.txt$"
+check "trace output through -A trace with custom filename" \
+	"timerlat hist -T 2 -A trace,file=custom_filename.txt" 2 "^  Saving trace to custom_filename.txt$"
+check "exec command" \
+	"timerlat hist -T 2 -A shell,command='echo TestOutput'" 2 "^TestOutput$"
+check "multiple actions" \
+	"timerlat hist -T 2 -A shell,command='echo -n 1' -A shell,command='echo 2'" 2 "^12$"
+check "hist stop at failed action" \
+	"timerlat hist -T 2 -A shell,command='echo -n 1; false' -A shell,command='echo -n 2'" 2 "^1# RTLA timerlat histogram$"
+check "top stop at failed action" \
+	"timerlat top -T 2 -A shell,command='echo -n 1; false' -A shell,command='echo -n 2'" 2 "^1ALL"
+check "hist with continue" \
+	"timerlat hist -T 2 -d 1s -A shell,command='echo TestOutput' -A continue" 0 "^TestOutput$"
+check "top with continue" \
+	"timerlat top -q -T 2 -d 1s -A shell,command='echo TestOutput' -A continue" 0 "^TestOutput$"
+check "hist with trace output at end" \
+	"timerlat hist -d 1s -N trace" 0 "^  Saving trace to timerlat_trace.txt$"
+check "top with trace output at end" \
+	"timerlat top -d 1s -N trace" 0 "^  Saving trace to timerlat_trace.txt$"
 done
 
 test_end
-- 
2.49.0


  parent reply	other threads:[~2025-06-11 13:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-11 13:56 [PATCH 0/8] rtla/timerlat: Support actions on threshold and on end Tomas Glozar
2025-06-11 13:56 ` [PATCH 1/8] rtla/timerlat: Introduce enum timerlat_tracing_mode Tomas Glozar
2025-06-11 13:56 ` [PATCH 2/8] rtla/timerlat: Add action on threshold feature Tomas Glozar
2025-08-03 11:08   ` Costa Shulyupin
2025-08-04 11:04     ` Tomas Glozar
2025-06-11 13:56 ` [PATCH 3/8] rtla/timerlat_bpf: Allow resuming tracing Tomas Glozar
2025-06-11 13:56 ` [PATCH 4/8] rtla/timerlat: Add continue action Tomas Glozar
2025-06-11 13:56 ` [PATCH 5/8] rtla/timerlat: Add action on end feature Tomas Glozar
2025-06-11 13:56 ` [PATCH 6/8] rtla/tests: Check rtla output with grep Tomas Glozar
2025-06-11 13:56 ` Tomas Glozar [this message]
2025-06-11 13:56 ` [PATCH 8/8] rtla/tests: Limit duration to maximum of 10s Tomas Glozar
2025-06-11 14:46 ` [PATCH 0/8] rtla/timerlat: Support actions on threshold and on end Arnaldo Carvalho de Melo
2025-06-23 14:15   ` Tomas Glozar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250611135644.219127-8-tglozar@redhat.com \
    --to=tglozar@redhat.com \
    --cc=acme@kernel.org \
    --cc=costa.shul@redhat.com \
    --cc=cyin@redhat.com \
    --cc=jkacur@redhat.com \
    --cc=lgoncalv@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).