summaryrefslogtreecommitdiff
path: root/tools/tracing/rtla/tests
AgeCommit message (Collapse)Author
2026-05-28rtla/tests: Add unit tests for -A/--aligned optionTomas Glozar
Add both parse_args() and opt_* tests for the newly added -A/--aligned option. Assisted-by: Claude:claude-4.5-opus-high-thinking Link: https://lore.kernel.org/r/20260527144928.2944472-2-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-05-28rtla/tests: Add unit tests for CLI option callbacksTomas Glozar
In addition to testing all tool_parse_args() functions, test also all callbacks used for parsing custom option formats. The callbacks represent a middle layer between the parsing functions and utility functions dedicated to checking specific argument formats, for example, scheduling class and duration. Callback tests are run before parsing functions to make sure any issue in the former is reported before it is encountered through the latter. Tests verify both successful parsing and proper rejection of invalid inputs (via exit tests). To enable testing static callbacks, a pragma once guard is added to timerlat.h for safe inclusion by cli_p.h. Add dependency of UNIT_TESTS_IN on LIBSUBCMD_INCLUDES, as the new test file tests/unit/cli_opt_callback.c includes cli_p.h which includes subcmd/parse-options.h. Link: https://lore.kernel.org/r/20260528103254.2990068-7-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-05-28rtla/tests: Add unit tests for _parse_args() functionsTomas Glozar
Add a test suite for the _parse_args() function of each tool that checks the params structures (struct common_params, struct osnoise_params, struct timerlat_params) returned by them for correctness. One test case is added per option, as well as a few special cases for tricky combinations of options. Test cases are ordered the same as the option arrays and help message to allow easy checking of whether all options are covered. This should help clarify what the proper command line behavior of RTLA is in case there are holes in the documentation and verify that the intended behavior is implemented correctly. A few necessary changes to the unit tests were done as part of this commit: - Unit tests now also link to libsubcmd and its dependencies. - A new global variable in_unit_test is added to RTLA's CLI interface, causing it to skip check for root if running in unit tests. This allows the CLI unit tests to run as non-root, like existing unit tests. There is quite a lot of duplication, some of it is mitigated with macros, but partially it is intentional so that future changes in behavior are tracked across tools. Link: https://lore.kernel.org/r/20260528103254.2990068-6-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-05-28rtla: Parse cmdline using libsubcmdTomas Glozar
Instead of using getopt_long() directly to parse the command line arguments given to an RTLA tool, use libsubcmd's parse_options(). Utilizing libsubcmd for parsing command line arguments has several benefits: - A help message is automatically generated by libsubcmd from the specification, removing the need of writing it by hand. - Options are sorted into groups based on which part of tracing (CPU, thread, auto-analysis, tuning, histogram) they relate to. - Common parsing patterns for numerical and boolean values now share code, with the target variable being stored in the option array. To avoid duplication of the option parsing logic, RTLA-specific macros defining struct option values are created: - RTLA_OPT_* for options common to all tools - OSNOISE_OPT_* and TIMERLAT_OPT_* for options specific to osnoise/timerlat tools - HIST_OPT_* macros for options specific to histogram-based tools. Individual *_parse_args() functions then construct an array out of these macros that is then passed to libsubcmd's parse_options(). All code specific to command line options parsing is moved out of the individual tool files into a new file, cli.c, which also contains the contents of the rtla.c file. A private header, cli_p.h, is added alongside the public header cli.h, so that unit tests are able to test statically declared option callbacks. Minor changes: - The return value of tool-level help option changes to 129, as this is the value set by libsubcmd; this is reflected in affected test cases. The implementation of help for command-level and tracer-level help is set to 129 as well for consistency, and the change is reflected in exit value documentation. - Related to the above, {rtla,osnoise,timerlat}_usage() are marked __noreturn and exit() is removed from after they are called for cleaner code. - The error messages for invalid argument for options --dma-latency and -E/--entries were corrected, fixing off-by-one in the limits. Note that unsetting options (using --no-<opt> syntax) is currently not implemented for options that use custom callbacks. For --irq and --thread, it will never be implemented, as they conflict with already existing --no-irq and --no-thread with a different meaning. Assisted-by: Composer:composer-1.5 Link: https://lore.kernel.org/r/20260528103254.2990068-5-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-05-28rtla/tests: Add runtime tests for restoring continue flagTomas Glozar
In case an action preceding the continue action fails, not only the continue flag should not be set, it should be unset if it was set from a previous run of actions_perform(). Add a runtime test to both osnoise and timerlat tools that checks that this works properly by creating a temporary file. Link: https://lore.kernel.org/r/20260526102523.2662391-4-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-05-28rtla/tests: Run runtime tests in temporary directoryTomas Glozar
Create a temporary directory before each test case to serve as working directory during the duration of the test. This prevents littering of the original working directory as well as allows tests to use it to avoid path conflicts. In order not to break already existing tests, also add a new "testdir" variable containing the directory where the test file is located. This is then used to locate artifacts used during testing like BPF programs and scripts for checking the tracer threads. Link: https://lore.kernel.org/r/20260526102523.2662391-3-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-05-28rtla/tests: Add unit test for restoring continue flagTomas Glozar
In case an action preceding the continue action fails, not only the continue flag should not be set, it should be unset if it was set from a previous run of actions_perform(). Add a unit test to check if this is implemented correctly. Link: https://lore.kernel.org/r/20260526102523.2662391-2-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-05-18rtla/tests: Add unit tests for actions moduleTomas Glozar
Add unit tests covering all functions in the actions module, including both valid and invalid inputs and all action types, except for actions_perform(), where only shell and continue actions are tested. To support testing multiple modules, the unit test build was modified so that it links the entire rtla-in.o file. For this to work, the main() function in rtla.c was declared weak, so that the unit test main is able to override it. Other included minor changes to unit tests are: - Make unit test output verbose to show which tests are being run, now that we have more than 3 tests. - Add unit_tests file to .gitignore. - Split unit test sources to one file per test suite, and keep only main() function in unit_tests.c. - Fix Makefile dependencies so that "make unit-tests" will rebuild the binary with the changes in the commit. Also with the linking the entire rtla-in.o file, it now has rtla's nr_cpus symbol, so the declaration in utils unit tests is made extern. Assisted-by: Composer:composer-2-fast Link: https://lore.kernel.org/r/20260424140244.958495-1-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-05-18rtla/tests: Add runtime tests for -C/--cgroupTomas Glozar
Add a new script check-cgroup-match.sh that retrieves the cgroup of the main rtla process and compares it to the cgroup of the rtla workload threads. Add a new test based on this script, for both osnoise and timerlat tools, testing the variant of -C without argument (which sets the cgroup of the workload to the cgroup of the rtla main process). Note that this has to be tested in kernel mode to be significant for timerlat tool, as user workloads inherit the parent rtla process cgroup even without the option. Reviewed-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260423130558.882022-10-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-05-18rtla/tests: Add runtime test for -k and -u optionsTomas Glozar
Add runtime test for rtla-timerlat's -k/--kernel-threads and -u/--user-threads options using get_workload_pids.sh to check whether the appropriate threads are being created. The tests are implemented for both top and hist. Additionally, all tests related to timerlat threads are moved to a separate section in the test files. The latter is also done for rtla-osnoise tests. Reviewed-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260423130558.882022-9-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-05-18rtla/tests: Add runtime test for -H/--house-keepingTomas Glozar
Add a runtime test for -H/--house-keeping option for both osnoise and timerlat tools, with affinity checking similar to what is done for -c/--cpus. Reviewed-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260423130558.882022-8-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-05-18rtla/tests: Cover all hist options in runtime testsTomas Glozar
Cover all options regarding histogram formatting for both rtla-osnoise-hist and rtla-timerlat-hist tools. All options also have output checking using positive or negative match, except for -b/--bucket-size and -E/--entries, which cannot be tested in isolated due to the output depending on the actual data collected. Old -E/--entries test for rtla-osnoise was replaced with a new one equivalent to the timerlat one. Reviewed-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260423130558.882022-7-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-05-18rtla/tests: Extend timerlat top --aa-only coverageTomas Glozar
rtla-timerlat-top's --aa-only option is currently only tested for return value. Extend the tests to also check that only auto-analysis is being done via a negative match for the "Timer Latency" text in the top header, and further split the test case into two: - one test case for --aa-only stopping on threshold - one test case for --aa-only exiting without threshold being hit For both cases, the expected output ("analyzing it" or "Max latency was" respectively) is checked against in addition to the negative match. Reviewed-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260423130558.882022-6-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-05-18rtla/tests: Use negative match when testing --aa-onlyTomas Glozar
For testing the -a/--auto option in timerlat tool, the string "analyzing it" is matched against to make sure auto-analysis was triggered. Use the same string as a negative match for --aa-only option test. Reviewed-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260423130558.882022-5-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-05-18rtla/tests: Check -c/--cpus thread affinityTomas Glozar
RTLA runtime tests verify the -c/--cpus options, but do not check whether the correct affinity is actually applied. Add a script named check-cpus.sh that retrieves the affinity of all workload threads and use it to check the -c/--cpus option for both osnoise and timerlat tools. Also add missing -c/--cpus test for osnoise. Reviewed-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260423130558.882022-4-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-05-18rtla/tests: Add get_workload_pids() helperTomas Glozar
RTLA runtime tests that check workload processes (currently the test case "verify -P/--priority" of timerlat.t and "verify the --priority/-P param" of osnoise.t) use "pgrep timerlatu/" or "pgrep osnoise/" respectively to identify the workload. Make them more robust by adding a get_workload_pids() helper that finds the main rtla process and returns the PIDs of all siblings other than the test script itself, plus all child processes of kthreadd that have the osnoise/timerlat kthread pattern comm. This filters out any spurious processes not related to the running test that happen to have "timerlatu/" or "osnoise/" in their command, for example, a user grepping the same names at the time of the running of the test. Reviewed-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260423130558.882022-3-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-05-18rtla/tests: Cover both top and hist tools where possibleTomas Glozar
RTLA runtime tests currently do not cover both tool variants for osnoise and timerlat properly. Many tests applicable to both tools are only tested for one tool, selected randomly. Introduce two new shell functions, check_top_hist() and check_top_q_hist(). The functions use the same syntax as check() and run check() on the arguments twice: once replacing the "TOOL" string in the command with "top" (or "top -q"), once replacing it with "hist". The top -q variant is used for tests relying on messages printed after aborting the RTLA main loop with a starting new line, which only happens for top tools in quiet mode; without -q, the top output is printed on the same line and the matches would fail. Tests that are applicable to both top and hist tools were modified to the run for both; additionally, tests that were already done for both tools were migrated to the new shell functions, unless the test command or matches differ between the tools. Additional tests were added to test tool-specific help messages. Reviewed-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260423130558.882022-2-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-03-09tools/rtla: Consolidate nr_cpus usage across all toolsCosta Shulyupin
sysconf(_SC_NPROCESSORS_CONF) (via get_nprocs_conf) reflects cpu_possible_mask, which is fixed at boot time, so querying it repeatedly is unnecessary. Replace multiple calls to sysconf(_SC_NPROCESSORS_CONF) with a single global nr_cpus variable initialized once at startup. `#pragma once` in timerlat_u.h is needed for pre-C23 compilers to avoid redefinition errors. Signed-off-by: Costa Shulyupin <costa.shul@redhat.com> Link: https://lore.kernel.org/r/20260306194953.2511960-2-costa.shul@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-03-04tools/rtla: Add unit tests for utils.cCosta Shulyupin
Add unit tests for utility functions in src/utils.c using the Check testing framework. The tests verify parse_cpu_set(), strtoi(), and parse_prio() functions. Unit tests are built conditionally when libcheck is available. Run tests with 'make unit-test'. The test framework uses the Check library which provides process isolation for each test, preventing failures in one test from affecting others. Signed-off-by: Costa Shulyupin <costa.shul@redhat.com> Link: https://lore.kernel.org/r/20260119105857.797498-3-costa.shul@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-01-07rtla/tests: Run Test::Harness in verbose modeTomas Glozar
Add -v flag to prove command to also print the names of tests that succeeded, not only those that failed, to allow easier debugging of the test suite. Also, drop printing the option and value to stdout in check_with_osnoise_options, which was a debugging print that was accidentally left in the final commit, and which would be otherwise now visible in make check output, as stdout is no longer suppressed. Suggested-by: Crystal Wood <crwood@redhat.com> Reviewed-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20251126144205.331954-6-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-01-07rtla/tests: Test BPF action programTomas Glozar
Add a test that implements a BPF program writing to a test map, which is attached to RTLA via --bpf-action to be executed on theshold overflow. A combination of --on-threshold shell with bpftool (which is always present if BPF support is enabled) is used to check whether the BPF program has executed successfully. Suggested-by: Crystal Wood <crwood@redhat.com> Link: https://lore.kernel.org/r/20251126144205.331954-5-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2025-11-21rtla/tests: Don't rely on matching ^1ALLCrystal Wood
The timerlat "top stop at failed action" test was relying on "ALL" being printed immediately after the "1" from the threshold action. Besides being fragile, this depends on stdbuf behavior, which is easy to miss when recreating the test outside of the framework for debugging purposes. Instead, use the expected/unexpected text mechanism from the corresponding osnoise test. Signed-off-by: Crystal Wood <crwood@redhat.com> Link: https://lore.kernel.org/r/20251112152529.956778-2-crwood@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2025-11-21rtla/tests: Fix osnoise test calling timerlatTomas Glozar
osnoise test "top stop at failed action" is calling timerlat instead of osnoise by mistake. Fix it so that it calls the correct RTLA subcommand. Fixes: 05b7e10687c6 ("tools/rtla: Add remaining support for osnoise actions") Reviewed-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20251007095341.186923-3-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2025-11-21rtla/tests: Extend action tests to 5sTomas Glozar
In non-BPF mode, it takes up to 1 second for RTLA to notice that tracing has been stopped. That means that action tests cannot have a 1 second duration, as the SIGALRM will be racing with the threshold overflow. Previously, non-BPF mode actions were buggy and always executed the action, even when stopping on duration or SIGINT, preventing this issue from manifesting. Now that this has been fixed, the tests have become flaky, and this has to be adjusted. Fixes: 4e26f84abfbb ("rtla/tests: Add tests for actions") Fixes: 05b7e10687c6 ("tools/rtla: Add remaining support for osnoise actions") Reviewed-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20251007095341.186923-2-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2025-09-27tools/rtla: Add remaining support for osnoise actionsCrystal Wood
The basic functionality came with the consolidation; now hook up the command line options, and add documentation and tests. Cc: John Kacur <jkacur@redhat.com> Cc: Costa Shulyupin <costa.shul@redhat.com> Link: https://lore.kernel.org/20250907022325.243930-8-crwood@redhat.com Reviewed-by: Tomas Glozar <tglozar@redhat.com> Signed-off-by: Crystal Wood <crwood@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2025-09-27tools/rtla: Add test engine support for unexpected outputCrystal Wood
Add a check() parameter to indicate which text must not appear in the output. Simplify the code so that we can print failures as they happen rather than trying to figure out what went wrong after printing "not ok". This also means that "not ok" gets printed after the info rather than before, which seems more intuitive anyway. Cc: John Kacur <jkacur@redhat.com> Cc: Costa Shulyupin <costa.shul@redhat.com> Link: https://lore.kernel.org/20250907022325.243930-7-crwood@redhat.com Reviewed-by: Tomas Glozar <tglozar@redhat.com> Signed-off-by: Crystal Wood <crwood@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2025-09-27tools/rtla: Fix -A option name in test commentCrystal Wood
This was changed to --on-threshold when the patches were applied. Cc: John Kacur <jkacur@redhat.com> Cc: Costa Shulyupin <costa.shul@redhat.com> Link: https://lore.kernel.org/20250907022325.243930-6-crwood@redhat.com Reviewed-by: Tomas Glozar <tglozar@redhat.com> Signed-off-by: Crystal Wood <crwood@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2025-07-28rtla/tests: Test timerlat -P option using actionsTomas Glozar
The -P option is used to set priority of osnoise and timerlat threads. Extend the test for -P with --on-threshold calling a script that looks for running timerlat threads and checks if their priority is set correctly. As --on-threshold is only supported by timerlat at the moment, this is only implemented there so far. Cc: John Kacur <jkacur@redhat.com> Cc: Luis Goncalves <lgoncalv@redhat.com> Cc: Chang Yin <cyin@redhat.com> Cc: Costa Shulyupin <costa.shul@redhat.com> Link: https://lore.kernel.org/20250725133817.59237-3-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2025-07-28rtla/tests: Add grep checks for base test casesTomas Glozar
Checking for patterns in rtla output with grep was added to test rtla actions. Add grep checks also for base tests where applicable. Also fix trace event histogram trigger check to use the correct syntax for the command-line option so that the test passes with the grep check. Cc: John Kacur <jkacur@redhat.com> Cc: Luis Goncalves <lgoncalv@redhat.com> Cc: Chang Yin <cyin@redhat.com> Cc: Costa Shulyupin <costa.shul@redhat.com> Link: https://lore.kernel.org/20250725133817.59237-2-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2025-07-25rtla/tests: Limit duration to maximum of 10sTomas Glozar
Many of the original rtla tests included durations of 1 minute and 30 seconds. Experience has shown this is unnecessary, since 10 seconds as waiting time for samples to appear. Change duration of all rtla tests to at most 10 seconds. This speeds up testing significantly. Before: $ make check All tests successful. Files=3, Tests=54, 536 wallclock secs ( 0.03 usr 0.00 sys + 20.31 cusr 22.02 csys = 42.36 CPU) Result: PASS After: $ make check ... All tests successful. Files=3, Tests=54, 196 wallclock secs ( 0.03 usr 0.01 sys + 20.28 cusr 20.68 csys = 41.00 CPU) Result: PASS Cc: John Kacur <jkacur@redhat.com> Cc: Luis Goncalves <lgoncalv@redhat.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Chang Yin <cyin@redhat.com> Cc: Costa Shulyupin <costa.shul@redhat.com> Cc: Crystal Wood <crwood@redhat.com> Cc: Gabriele Monaco <gmonaco@redhat.com> Link: https://lore.kernel.org/20250626123405.1496931-9-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2025-07-25rtla/tests: Add tests for actionsTomas Glozar
Add a bunch of tests covering most of both --on-threshold and --on-end. Parts sensitive to implementation of hist/top are tested for both. Cc: John Kacur <jkacur@redhat.com> Cc: Luis Goncalves <lgoncalv@redhat.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Chang Yin <cyin@redhat.com> Cc: Costa Shulyupin <costa.shul@redhat.com> Cc: Crystal Wood <crwood@redhat.com> Cc: Gabriele Monaco <gmonaco@redhat.com> Link: https://lore.kernel.org/20250626123405.1496931-8-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2025-07-25rtla/tests: Check rtla output with grepTomas Glozar
Add argument to the check command in the test suite that takes a regular expression that the output of rtla command is checked against. This allows testing for specific information in rtla output in addition to checking the return value. Two minor improvements are included: running rtla with "eval" so that arguments with spaces can be passed to it via shell quotations, and the stdout of pushd and popd is suppressed to clean up the test output. Cc: John Kacur <jkacur@redhat.com> Cc: Luis Goncalves <lgoncalv@redhat.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Chang Yin <cyin@redhat.com> Cc: Costa Shulyupin <costa.shul@redhat.com> Cc: Crystal Wood <crwood@redhat.com> Cc: Gabriele Monaco <gmonaco@redhat.com> Link: https://lore.kernel.org/20250626123405.1496931-7-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2025-05-07rtla: Set distinctive exit value for failed testsCosta Shulyupin
A test is considered failed when a sample trace exceeds the threshold. Failed tests return the same exit code as passed tests, requiring test frameworks to determine the result by searching for "hit stop tracing" in the output. Assign a distinct exit code for failed tests to enable the use of shell expressions and seamless integration with testing frameworks without the need to parse output. Add enum type for return value. Update `make check`. Cc: Daniel Bristot de Oliveira <bristot@kernel.org> Cc: John Kacur <jkacur@redhat.com> Cc: "Luis Claudio R. Goncalves" <lgoncalv@redhat.com> Cc: Eder Zulian <ezulian@redhat.com> Cc: Dan Carpenter <dan.carpenter@linaro.org> Cc: Jan Stancek <jstancek@redhat.com> Link: https://lore.kernel.org/20250417185757.2194541-1-costa.shul@redhat.com Signed-off-by: Costa Shulyupin <costa.shul@redhat.com> Reviewed-by: Tomas Glozar <tglozar@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2025-03-26rtla/tests: Test setting default optionsTomas Glozar
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. Cc: Luis Goncalves <lgoncalv@redhat.com> Link: https://lore.kernel.org/20250320092500.101385-7-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com> Reviewed-by: John Kacur <jkacur@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2025-03-26rtla/tests: Reset osnoise options before checkTomas Glozar
Remove any dangling tracing instances from previous improperly exited runs of rtla, and reset osnoise options to default before running a test case. This ensures that the test results are deterministic. Specific test cases checked that rtla behaves correctly even when the tracer state is not clean will be added later. Cc: John Kacur <jkacur@redhat.com> Cc: Luis Goncalves <lgoncalv@redhat.com> Link: https://lore.kernel.org/20250320092500.101385-6-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2025-03-04rtla/timerlat: Test BPF modeTomas Glozar
Using the RTLA_NO_BPF environmental variable, execute rtla-timerlat tests both with and without BPF support to cover both paths. If rtla is built without BPF or the osnoise:timerlat_sample trace event is not available, test only the non-BPF path. Cc: John Kacur <jkacur@redhat.com> Cc: Luis Goncalves <lgoncalv@redhat.com> Cc: Gabriele Monaco <gmonaco@redhat.com> Cc: Clark Williams <williams@redhat.com> Link: https://lore.kernel.org/20250218145859.27762-9-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2025-01-23tools/rtla: Add basic test suiteTomas Glozar
Implement a simple TAP-based test engine in bash and a few basic tests using it, to be used to check for bugs and regressions. A new "check" target is added to the rtla Makefile that runs the test suite using the "prove" command implemented by Test::Harness. The only test format currently supported is running rtla with defined command arguments per test, checking its exit code. In case the exit code is non-zero, the output of rtla is displayed, together with the exit code. The test cases are adopted from rtla tests in the Continuous Kernel Integration (CKI) project [1] with the authors' approval. [1] https://gitlab.com/redhat/centos-stream/tests/kernel/kernel-tests/-/blob/main/rt-tests/us/rtla/ Cc: John Kacur <jkacur@redhat.com> Cc: Luis Goncalves <lgoncalv@redhat.com> Cc: Chang Yin <cyin@redhat.com> Cc: Qiao Zhao <qzhao@redhat.com> Link: https://lore.kernel.org/20250120135630.802111-1-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>