mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
tools/rtla: Add unit tests for utils.c
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>
This commit is contained in:
committed by
Tomas Glozar
parent
153e211fc7
commit
3a4080e5e4
17
tools/tracing/rtla/tests/unit/Makefile.unit
Normal file
17
tools/tracing/rtla/tests/unit/Makefile.unit
Normal file
@@ -0,0 +1,17 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
UNIT_TESTS := $(OUTPUT)unit_tests
|
||||
UNIT_TESTS_IN := $(UNIT_TESTS)-in.o
|
||||
|
||||
$(UNIT_TESTS): $(UNIT_TESTS_IN)
|
||||
$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $^ -lcheck
|
||||
|
||||
$(UNIT_TESTS_IN):
|
||||
make $(build)=unit_tests
|
||||
|
||||
unit-tests: FORCE
|
||||
$(Q)if [ "$(feature-libcheck)" = "1" ]; then \
|
||||
$(MAKE) $(UNIT_TESTS) && $(UNIT_TESTS); \
|
||||
else \
|
||||
echo "libcheck is missing, skipping unit tests. Please install check-devel/check"; \
|
||||
fi
|
||||
Reference in New Issue
Block a user