]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rtla/tests: Add unit tests for actions module
authorTomas Glozar <tglozar@redhat.com>
Fri, 24 Apr 2026 14:02:44 +0000 (16:02 +0200)
committerTomas Glozar <tglozar@redhat.com>
Mon, 18 May 2026 09:00:52 +0000 (11:00 +0200)
commite5d8f22758c5904ed006a525ef34dec1c381f2b6
treecd0074aa03095285ef331996576c55756f0da3a0
parent117a366c5b000c4b4292d94dd1397e62d9a44d79
rtla/tests: Add unit tests for actions module

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>
tools/tracing/rtla/.gitignore
tools/tracing/rtla/src/rtla.c
tools/tracing/rtla/tests/unit/Build
tools/tracing/rtla/tests/unit/Makefile.unit
tools/tracing/rtla/tests/unit/actions.c [new file with mode: 0644]
tools/tracing/rtla/tests/unit/unit_tests.c
tools/tracing/rtla/tests/unit/utils.c [new file with mode: 0644]