]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-program-client, lib-smtp: Move unit test runs to Makefile.test.include
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Sat, 18 Oct 2025 15:33:29 +0000 (18:33 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 10 Nov 2025 12:12:12 +0000 (12:12 +0000)
These add NOCHILDREN_TESTS for some tests.

Makefile.test.include
build-aux/run-test.sh.in
src/lib-program-client/Makefile.am
src/lib-smtp/Makefile.am

index 8d1b71c4233a2c5939cd128eeadacaa8dd563cec..2021a315baa2cb30190e13da023cf4b56a2d6313 100644 (file)
@@ -2,5 +2,5 @@ noinst_PROGRAMS = $(test_programs)
 
 check-local:
        for bin in $(test_programs); do \
-         if ! $(RUN_TEST) ./$$bin; then exit 1; fi; \
+         if ! $(RUN_TEST) NOCHILDREN_TESTS="$(NOCHILDREN_TESTS)" ./$$bin; then exit 1; fi; \
        done
index 325bb4819b1193ce494eac3df9520ef877ed1a38..f2297891dc89f4bb74fdf952f7945283dcc44bb2 100644 (file)
@@ -4,9 +4,21 @@
 
 set -eu
 
+function get_test_name() {
+  basename "$1"
+}
+
 top_srcdir="@abs_top_srcdir@"
 VALGRIND="@VALGRIND@"
 
+if [ $# -gt 0 ] && echo "$1" | grep "NOCHILDREN_TESTS=" >/dev/null; then
+  shift
+  test_name=$(get_test_name "$@")
+  if echo "$1" | grep "NOCHILDREN_TESTS=.*\b$test_name\b" >/dev/null; then
+    NOCHILDREN=yes
+  fi
+fi
+
 if test $# -eq 0 || test "$1" = ""; then
   echo "Missing target binary" >&2
   exit 1
index c7081b7aa89b7188c1df8daf2e02e96ec5642904..5f4c175394c9229d3449561e340f6a82e851c895 100644 (file)
@@ -1,3 +1,6 @@
+NOCHILDREN_TESTS = test-program-client-local
+include $(top_srcdir)/Makefile.test.include
+
 noinst_LTLIBRARIES = libprogram_client.la
 
 AM_CPPFLAGS = \
@@ -28,8 +31,6 @@ test_programs = \
        test-program-client-unix \
        test-program-client-net
 
-noinst_PROGRAMS = $(test_programs)
-
 test_libs = \
        libprogram_client.la \
        ../lib-dns-client/libdns-client.la  \
@@ -52,12 +53,3 @@ test_program_client_unix_LDADD = $(test_libs)
 
 test_program_client_net_SOURCE = test-program-client-net.c
 test_program_client_net_LDADD = $(test_libs)
-
-check-local:
-       for bin in $(test_programs); do \
-         if test "$$bin" = "test-program-client-local"; then \
-           if ! env NOCHILDREN=yes $(RUN_TEST) ./$$bin; then exit 1; fi; \
-          else \
-           if ! $(RUN_TEST) ./$$bin; then exit 1; fi; \
-         fi \
-       done
index 040cc17b968e724507d40cd6f15f923dc799980c..1dbe59af66ccc85ce1d430826d561d8897a2328d 100644 (file)
@@ -1,3 +1,6 @@
+NOCHILDREN_TESTS = test-smtp-submit
+include $(top_srcdir)/Makefile.test.include
+
 noinst_LTLIBRARIES = libsmtp.la
 
 AM_CPPFLAGS = \
@@ -96,7 +99,7 @@ fuzz_programs += \
        fuzz-smtp-server
 endif
 
-noinst_PROGRAMS = $(fuzz_programs) $(test_programs) $(test_nocheck_programs)
+noinst_PROGRAMS += $(fuzz_programs) $(test_nocheck_programs)
 
 EXTRA_DIST = \
        test-bin/sendmail-exit-1.sh \
@@ -204,12 +207,3 @@ fuzz_smtp_server_LDFLAGS = $(FUZZER_LDFLAGS)
 fuzz_smtp_server_SOURCES = fuzz-smtp-server.c
 fuzz_smtp_server_LDADD = $(test_libs)
 fuzz_smtp_server_DEPENDENCIES = $(test_deps)
-
-check-local:
-       for bin in $(test_programs); do \
-         if test "$$bin" = "test-smtp-submit"; then \
-           if ! env NOCHILDREN=yes $(RUN_TEST) ./$$bin; then exit 1; fi; \
-          else \
-           if ! $(RUN_TEST) ./$$bin; then exit 1; fi; \
-         fi \
-       done