]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Move cpu-limit test to its own test binary
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 17 Oct 2025 11:27:09 +0000 (14:27 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 10 Nov 2025 12:12:12 +0000 (12:12 +0000)
This allows running it in parallel with the rest of the tests.

src/lib/Makefile.am
src/lib/test-cpu-limit.c
src/lib/test-lib.inc

index 650bfeb0f609705cba7a172f7db59d724aa45d6c..1a66ff4b077f72961d60b2f0269bddab1e9f7c28 100644 (file)
@@ -1,6 +1,7 @@
 include $(top_srcdir)/Makefile.test.include
 
 AM_CPPFLAGS = \
+       -I$(top_srcdir)/src/lib-test \
        $(LIBUNWIND_CFLAGS)
 
 noinst_LTLIBRARIES = liblib.la
@@ -416,7 +417,7 @@ headers = \
        wildcard-match.h \
        write-full.h
 
-test_programs = test-lib
+test_programs = test-lib test-cpu-limit
 
 test_lib_CPPFLAGS = \
        -I$(top_srcdir)/src/lib-test \
@@ -440,7 +441,6 @@ test_lib_SOURCES = \
        test-byteorder.c \
        test-connection.c \
        test-crc32.c \
-       test-cpu-limit.c \
        test-data-stack.c \
        test-env-util.c \
        test-event-category-register.c \
@@ -532,6 +532,11 @@ test_headers = \
 test_lib_LDADD = $(test_libs) -lm
 test_lib_DEPENDENCIES = $(test_libs)
 
+test_cpu_limit_SOURCES = \
+       test-cpu-limit.c
+test_cpu_limit_LDADD = $(test_libs) -lm
+test_cpu_limit_DEPENDENCIES = $(test_libs)
+
 pkginc_libdir=$(pkgincludedir)
 pkginc_lib_HEADERS = $(headers)
 noinst_HEADERS = $(test_headers)
index 1f68b7cef8245836f6aa1058a5c5ba641e7a09c6..0a4959b70dce4ad87d610f8ffe20b550ac881877 100644 (file)
@@ -135,7 +135,7 @@ static void test_cpu_limit_nested(enum cpu_limit_type type, const char *type_str
        test_end();
 }
 
-void test_cpu_limit(void)
+static void test_cpu_limit(void)
 {
        test_cpu_limit_simple(CPU_LIMIT_TYPE_USER, "user");
        /* the system cpu-limit tests take too long with valgrind */
@@ -147,3 +147,13 @@ void test_cpu_limit(void)
                test_cpu_limit_nested(CPU_LIMIT_TYPE_SYSTEM, "system");
        test_cpu_limit_nested(CPU_LIMIT_TYPE_ALL, "all");
 }
+
+int main(void)
+{
+       static void (*const test_functions[])(void) = {
+               test_cpu_limit,
+               NULL
+       };
+       test_dir_init("cpu-limit");
+       return test_run(test_functions);
+}
index d2b279820e518b8334a56a4feec2b6fe9911ca9c..a27df9af9c0c79414dfa533862b6646062825449 100644 (file)
@@ -16,7 +16,6 @@ FATAL(fatal_buffer)
 TEST(test_byteorder)
 TEST(test_connection)
 TEST(test_crc32)
-TEST(test_cpu_limit)
 TEST(test_data_stack)
 FATAL(fatal_data_stack)
 TEST(test_env_util)