linux/tools/tracing/rtla/tests/scripts/check-osnoise-option.sh
Tomas Glozar ab43bd72f9 rtla/tests: Test all tracer options in runtime tests
Currently, runtime tests only test the osnoise period option
(-p/--period of rtla-osnoise tools, backed by
/sys/kernel/tracing/osnoise/period_us), using the
check_with_osnoise_options function together with a hack relying on long
period (pre-set) timing out if RTLA fails to reset it to the default
value.

Extend tracer option testing to all options used by RTLA; test both RTLA
setting the default option by pre-setting the tracer to a different
value and user-requested value.

The tests are done using a script that reads the tracer values inside an
--on-threshold action, like existing tests for runtime behavior already
do. check_with_osnoise_option is modified to support grep filters, so
that it can be used together with the script pattern.

Assisted-by: Claude:claude-opus-4-6
Link: https://lore.kernel.org/r/20260709091755.58265-1-tglozar@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-08-05 10:14:40 +02:00

17 lines
513 B
Bash
Executable File

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Check if osnoise options are enabled or disabled.
# Usage: check-osnoise-option.sh <OPTION1> [<OPTION2> ...]
# Output: one line per option in the format "OPTION=enabled" or "OPTION=disabled"
options=$(tr ' ' '\n' < /sys/kernel/tracing/osnoise/options)
for name in "$@"; do
if echo "$options" | grep -q "^NO_${name}$"; then
echo "$name=disabled"
elif echo "$options" | grep -q "^${name}$"; then
echo "$name=enabled"
else
echo "$name=unsupported"
fi
done