summaryrefslogtreecommitdiff
path: root/tools/tracing/rtla/tests/unit/utils.c
AgeCommit message (Collapse)Author
2026-09-22rtla/tests: Add unit test for get_max_cpu_from_list()Tomas Glozar
The get_max_cpu_from_list() function is used when parsing osnoise cpus "all" value. Furthermore, the callback used by it is also used in get_possible_cpus(). Add unit test to cover it. Link: https://lore.kernel.org/r/20260814135511.2207190-6-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-09-22rtla/tests: Add unit test for cpu_list_iterate()Tomas Glozar
cpu_list_iterate() was split out of parse_cpu_set() to hold shared code between it and the newly added function get_possible_cpus(). As its semantics are more complex than parse_cpu_set() - it calls a callback on each element of the list, with possible abort on failure, while parse_cpu_set() cares only about the set defined by the list - it deserves its own test. Test the callback being called correctly as well as the return value and early break on different combinations of comma-separated numbers and ranges. Link: https://lore.kernel.org/r/20260814135511.2207190-5-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>