]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tools/build: Add feature test for libcheck
authorCosta Shulyupin <costa.shul@redhat.com>
Mon, 19 Jan 2026 10:58:56 +0000 (12:58 +0200)
committerTomas Glozar <tglozar@redhat.com>
Wed, 4 Mar 2026 14:51:56 +0000 (15:51 +0100)
Enable support for unit tests in rtla.

Note that the pkg-config file for libcheck is named check.pc.

Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
Link: https://lore.kernel.org/r/20260119105857.797498-2-costa.shul@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
tools/build/Makefile.feature
tools/build/feature/Makefile
tools/build/feature/test-libcheck.c [new file with mode: 0644]

index 0b7a7c38cb88a7d0589b764f67e255af7020b177..2f192d3bf61b976e4753a660f4e31ab3054da692 100644 (file)
@@ -115,6 +115,7 @@ FEATURE_TESTS_EXTRA :=                  \
          hello                          \
          libbabeltrace                  \
          libcapstone                    \
+         libcheck                       \
          libbfd-liberty                 \
          libbfd-liberty-z               \
          libopencsd                     \
@@ -176,6 +177,8 @@ ifneq ($(PKG_CONFIG),)
   $(foreach package,$(FEATURE_PKG_CONFIG),$(call feature_pkg_config,$(package)))
 endif
 
+FEATURE_CHECK_LDFLAGS-libcheck = -lcheck
+
 # Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features.
 # If in the future we need per-feature checks/flags for features not
 # mentioned in this list we need to refactor this ;-).
index 1fbcb3ce74d2173072748a417fc63bd9a5b13888..99bdc8a6d26e2f27dadb3c16964b00928ad2ebb4 100644 (file)
@@ -50,6 +50,7 @@ FILES=                                          \
          test-timerfd.bin                       \
          test-libbabeltrace.bin                 \
          test-libcapstone.bin                  \
+         test-libcheck.bin                     \
          test-compile-32.bin                    \
          test-compile-x32.bin                   \
          test-zlib.bin                          \
@@ -307,6 +308,9 @@ $(OUTPUT)test-libbabeltrace.bin:
 $(OUTPUT)test-libcapstone.bin:
        $(BUILD) # -lcapstone provided by $(FEATURE_CHECK_LDFLAGS-libcapstone)
 
+$(OUTPUT)test-libcheck.bin:
+       $(BUILD) # -lcheck is provided by $(FEATURE_CHECK_LDFLAGS-libcheck)
+
 $(OUTPUT)test-compile-32.bin:
        $(CC) -m32 -Wall -Werror -o $@ test-compile.c
 
diff --git a/tools/build/feature/test-libcheck.c b/tools/build/feature/test-libcheck.c
new file mode 100644 (file)
index 0000000..cfb8d45
--- /dev/null
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <check.h>
+
+int main(void)
+{
+       Suite *s = suite_create("test");
+       return s == 0;
+}