linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: Tomas Glozar <tglozar@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	linux-trace-kernel@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	Luis Goncalves <lgoncalv@redhat.com>
Subject: Re: [PATCH 6/6] rtla/tests: Test setting default options
Date: Thu, 20 Mar 2025 16:42:44 -0400 (EDT)	[thread overview]
Message-ID: <72c05486-1b49-242e-478d-e83c367e16fa@redhat.com> (raw)
In-Reply-To: <20250320092500.101385-7-tglozar@redhat.com>



On Thu, 20 Mar 2025, Tomas Glozar wrote:

> Add function to test engine to test with pre-set osnoise options, and
> use it to test whether osnoise period (as an example) is set correctly.
> 
> The test works by pre-setting a high period of 10 minutes and stop on
> threshold. Thus, it is easy to check whether rtla is properly resetting
> the period to default: if it is, the test will complete on time, since
> the first sample will overflow the threshold. If not, it will time out.
> 
> Signed-off-by: Tomas Glozar <tglozar@redhat.com>
> ---
>  tools/tracing/rtla/tests/engine.sh | 26 ++++++++++++++++++++++++++
>  tools/tracing/rtla/tests/osnoise.t |  6 ++++++
>  2 files changed, 32 insertions(+)
> 
> diff --git a/tools/tracing/rtla/tests/engine.sh b/tools/tracing/rtla/tests/engine.sh
> index 5db8aa4bc031..b1697b3e3f52 100644
> --- a/tools/tracing/rtla/tests/engine.sh
> +++ b/tools/tracing/rtla/tests/engine.sh
> @@ -61,6 +61,32 @@ check() {
>  	fi
>  }
>  
> +check_with_osnoise_options() {
> +	# Do the same as "check", but with pre-set osnoise options.
> +	# Note: rtla should reset the osnoise options, this is used to test
> +	# if it indeed does so.
> +	# Save original arguments
> +	arg1=$1
> +	arg2=$2
> +
> +	# Apply osnoise options (if not dry run)
> +	if [ -n "$TEST_COUNT" ]
> +	then
> +		[ "$NO_RESET_OSNOISE" == 1 ] || reset_osnoise
> +		shift
> +		while shift
> +		do
> +			[ "$1" == "" ] && continue
> +			option=$(echo $1 | cut -d '=' -f 1)
> +			value=$(echo $1 | cut -d '=' -f 2)
> +			echo "option: $option, value: $value"
> +			echo "$value" > "/sys/kernel/tracing/osnoise/$option" || return 1
> +		done
> +	fi
> +
> +	NO_RESET_OSNOISE=1 check "$arg1" "$arg2"
> +}
> +
>  set_timeout() {
>  	TIMEOUT="timeout -v -k 15s $1"
>  }
> diff --git a/tools/tracing/rtla/tests/osnoise.t b/tools/tracing/rtla/tests/osnoise.t
> index 86596e547893..e5995c03c790 100644
> --- a/tools/tracing/rtla/tests/osnoise.t
> +++ b/tools/tracing/rtla/tests/osnoise.t
> @@ -16,4 +16,10 @@ check "verify the  --trace param" \
>  check "verify the --entries/-E param" \
>  	"osnoise hist -P F:1 -c 0 -r 900000 -d 1M -b 10 -E 25"
>  
> +# Test setting default period by putting an absurdly high period
> +# and stopping on threshold.
> +# If default period is not set, this will time out.
> +check_with_osnoise_options "apply default period" \
> +	"osnoise hist -s 1" period_us=600000000
> +
>  test_end
> -- 
> 2.48.1
> 
> 
> 
looks correct
change "stop" to "stopping" in description
Reviewed-by: John Kacur <jkacur@redhat.com>


      reply	other threads:[~2025-03-20 20:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-20  9:24 [PATCH 0/6] rtla: Always set all tracer options Tomas Glozar
2025-03-20  9:24 ` [PATCH 1/6] rtla/osnoise: Unify params struct Tomas Glozar
2025-03-20 19:00   ` John Kacur
2025-03-24 16:06     ` Steven Rostedt
2025-03-20  9:24 ` [PATCH 2/6] rtla: Unify apply_config between top and hist Tomas Glozar
2025-03-20 19:27   ` John Kacur
2025-03-20  9:24 ` [PATCH 3/6] rtla/osnoise: Set OSNOISE_WORKLOAD to true Tomas Glozar
2025-03-20 19:40   ` John Kacur
2025-03-20  9:24 ` [PATCH 4/6] rtla: Always set all tracer options Tomas Glozar
2025-03-20 20:31   ` John Kacur
2025-03-20  9:24 ` [PATCH 5/6] rtla/tests: Reset osnoise options before check Tomas Glozar
2025-03-20 20:36   ` John Kacur
2025-03-20  9:25 ` [PATCH 6/6] rtla/tests: Test setting default options Tomas Glozar
2025-03-20 20:42   ` John Kacur [this message]

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=72c05486-1b49-242e-478d-e83c367e16fa@redhat.com \
    --to=jkacur@redhat.com \
    --cc=lgoncalv@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglozar@redhat.com \
    /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).