From: Timo Sirainen Date: Fri, 17 Oct 2025 11:27:09 +0000 (+0300) Subject: lib: Move cpu-limit test to its own test binary X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce1c8cf0c97578329ad8b3335bd13444540059b5;p=thirdparty%2Fdovecot%2Fcore.git lib: Move cpu-limit test to its own test binary This allows running it in parallel with the rest of the tests. --- diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 650bfeb0f6..1a66ff4b07 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -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) diff --git a/src/lib/test-cpu-limit.c b/src/lib/test-cpu-limit.c index 1f68b7cef8..0a4959b70d 100644 --- a/src/lib/test-cpu-limit.c +++ b/src/lib/test-cpu-limit.c @@ -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); +} diff --git a/src/lib/test-lib.inc b/src/lib/test-lib.inc index d2b279820e..a27df9af9c 100644 --- a/src/lib/test-lib.inc +++ b/src/lib/test-lib.inc @@ -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)