From: Timo Sirainen Date: Sat, 18 Oct 2025 15:33:29 +0000 (+0300) Subject: lib-program-client, lib-smtp: Move unit test runs to Makefile.test.include X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5fd02c606fcad7d55216d62a9b87c55c1e81ef47;p=thirdparty%2Fdovecot%2Fcore.git lib-program-client, lib-smtp: Move unit test runs to Makefile.test.include These add NOCHILDREN_TESTS for some tests. --- diff --git a/Makefile.test.include b/Makefile.test.include index 8d1b71c423..2021a315ba 100644 --- a/Makefile.test.include +++ b/Makefile.test.include @@ -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 diff --git a/build-aux/run-test.sh.in b/build-aux/run-test.sh.in index 325bb4819b..f2297891dc 100644 --- a/build-aux/run-test.sh.in +++ b/build-aux/run-test.sh.in @@ -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 diff --git a/src/lib-program-client/Makefile.am b/src/lib-program-client/Makefile.am index c7081b7aa8..5f4c175394 100644 --- a/src/lib-program-client/Makefile.am +++ b/src/lib-program-client/Makefile.am @@ -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 diff --git a/src/lib-smtp/Makefile.am b/src/lib-smtp/Makefile.am index 040cc17b96..1dbe59af66 100644 --- a/src/lib-smtp/Makefile.am +++ b/src/lib-smtp/Makefile.am @@ -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