From: Marco Bettini Date: Fri, 18 Feb 2022 15:26:29 +0000 (+0100) Subject: lib-smtp: Adjust test timeouts based on valgrind runtime presence X-Git-Tag: 2.4.0~4304 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d12409a41ea0824c76693502fbfe93d72013c8e;p=thirdparty%2Fdovecot%2Fcore.git lib-smtp: Adjust test timeouts based on valgrind runtime presence --- diff --git a/configure.ac b/configure.ac index 93f8640444..7d9e96516c 100644 --- a/configure.ac +++ b/configure.ac @@ -337,6 +337,8 @@ AC_CHECK_FUNCS(fcntl flock lockf inet_aton sigaction getpagesize madvise \ malloc_usable_size glob fallocate posix_fadvise \ getpeereid getpeerucred inotify_init timegm) +AC_CHECK_HEADERS([valgrind/valgrind.h]) + DOVECOT_SOCKPEERCRED DOVECOT_CLOCK_GETTIME diff --git a/src/lib-smtp/test-smtp-payload.c b/src/lib-smtp/test-smtp-payload.c index 7363736cc4..0ad87733fc 100644 --- a/src/lib-smtp/test-smtp-payload.c +++ b/src/lib-smtp/test-smtp-payload.c @@ -31,9 +31,11 @@ #include #include -#define CLIENT_PROGRESS_TIMEOUT 60 -#define SERVER_KILL_TIMEOUT_SECS 20 -#define MAX_PARALLEL_PENDING 200 +#define VALGRIND_TIMEOUT_MULTIPLIER (ON_VALGRIND ? 5 : 1) + +#define CLIENT_PROGRESS_TIMEOUT_MSECS (60 * VALGRIND_TIMEOUT_MULTIPLIER * 1000) +#define SERVER_KILL_TIMEOUT_SECS (20 * VALGRIND_TIMEOUT_MULTIPLIER) +#define MAX_PARALLEL_PENDING 200 static bool debug = FALSE; static bool small_socket_buffers = FALSE; @@ -812,7 +814,7 @@ test_client(enum smtp_protocol protocol, if (!small_socket_buffers) { to_client_progress = timeout_add( - CLIENT_PROGRESS_TIMEOUT*1000, + CLIENT_PROGRESS_TIMEOUT_MSECS, test_client_progress_timeout, NULL); } @@ -963,8 +965,7 @@ test_run_scenarios( smtp_server_set.protocol = protocol; smtp_server_set.capabilities = capabilities; smtp_server_set.hostname = "localhost"; - smtp_server_set.max_client_idle_time_msecs = - CLIENT_PROGRESS_TIMEOUT*1000; + smtp_server_set.max_client_idle_time_msecs = CLIENT_PROGRESS_TIMEOUT_MSECS; smtp_server_set.max_pipelined_commands = 1; smtp_server_set.auth_optional = TRUE; smtp_server_set.ssl = &ssl_server_set; @@ -974,8 +975,8 @@ test_run_scenarios( i_zero(&smtp_client_set); smtp_client_set.my_hostname = "localhost"; smtp_client_set.temp_path_prefix = "/tmp"; - smtp_client_set.command_timeout_msecs = CLIENT_PROGRESS_TIMEOUT*1000; - smtp_client_set.connect_timeout_msecs = CLIENT_PROGRESS_TIMEOUT*1000; + smtp_client_set.command_timeout_msecs = CLIENT_PROGRESS_TIMEOUT_MSECS; + smtp_client_set.connect_timeout_msecs = CLIENT_PROGRESS_TIMEOUT_MSECS; smtp_client_set.ssl = &ssl_client_set; smtp_client_set.debug = debug; diff --git a/src/lib-smtp/test-smtp-server-errors.c b/src/lib-smtp/test-smtp-server-errors.c index a28c037dd7..b944a3968d 100644 --- a/src/lib-smtp/test-smtp-server-errors.c +++ b/src/lib-smtp/test-smtp-server-errors.c @@ -18,8 +18,10 @@ #include -#define SERVER_MAX_TIMEOUT_MSECS 10*1000 -#define CLIENT_KILL_TIMEOUT_SECS 20 +#define VALGRIND_TIMEOUT_MULTIPLIER (ON_VALGRIND ? 5 : 1) + +#define SERVER_MAX_TIMEOUT_MSECS (10 * VALGRIND_TIMEOUT_MULTIPLIER * 1000) +#define CLIENT_KILL_TIMEOUT_SECS (20 * VALGRIND_TIMEOUT_MULTIPLIER) static void main_deinit(void); diff --git a/src/lib-test/test-common.h b/src/lib-test/test-common.h index f845c0d585..305586448a 100644 --- a/src/lib-test/test-common.h +++ b/src/lib-test/test-common.h @@ -1,6 +1,13 @@ #ifndef TEST_COMMON_H #define TEST_COMMON_H +#ifdef HAVE_VALGRIND_VALGRIND_H +# include +# define ON_VALGRIND ((bool) RUNNING_ON_VALGRIND) +#else +# define ON_VALGRIND FALSE +#endif + struct istream *test_istream_create(const char *data); struct istream *test_istream_create_data(const void *data, size_t size); void test_istream_set_size(struct istream *input, uoff_t size);