[PATCH 01 of 11] Tests: SIGPIPE handling in mail tests

Maxim Dounin mdounin at mdounin.ru
Mon Apr 17 03:31:25 UTC 2023


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1681702248 -10800
#      Mon Apr 17 06:30:48 2023 +0300
# Node ID a01b7d84f4355073a00f43760fc512e03b4452c3
# Parent  36a4563f7f005184547575f5ac4f22ef53a59c72
Tests: SIGPIPE handling in mail tests.

In contrast to http tests, mail tests generally do not try to handle
SIGPIPE when writing to a socket, and instead rely on $SIG{PIPE} being
set at the start of the test (see 96:ecff5407867c).  Fixed some tests
which don't do this.

diff --git a/mail_capability.t b/mail_capability.t
--- a/mail_capability.t
+++ b/mail_capability.t
@@ -25,6 +25,8 @@ use Test::Nginx::SMTP;
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
+local $SIG{PIPE} = 'IGNORE';
+
 my $t = Test::Nginx->new()->has(qw/mail mail_ssl imap pop3 smtp/)
 	->has_daemon('openssl')->plan(17);
 
diff --git a/mail_error_log.t b/mail_error_log.t
--- a/mail_error_log.t
+++ b/mail_error_log.t
@@ -26,6 +26,8 @@ use Test::Nginx::IMAP;
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
+local $SIG{PIPE} = 'IGNORE';
+
 plan(skip_all => 'win32') if $^O eq 'MSWin32';
 
 my $t = Test::Nginx->new()->has(qw/mail imap http rewrite/);
diff --git a/mail_ssl.t b/mail_ssl.t
--- a/mail_ssl.t
+++ b/mail_ssl.t
@@ -25,6 +25,8 @@ use Test::Nginx::SMTP;
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
+local $SIG{PIPE} = 'IGNORE';
+
 eval {
 	require Net::SSLeay;
 	Net::SSLeay::load_error_strings();
diff --git a/mail_ssl_conf_command.t b/mail_ssl_conf_command.t
--- a/mail_ssl_conf_command.t
+++ b/mail_ssl_conf_command.t
@@ -22,6 +22,8 @@ use Test::Nginx;
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
+local $SIG{PIPE} = 'IGNORE';
+
 eval {
 	require Net::SSLeay;
 	Net::SSLeay::load_error_strings();
diff --git a/mail_ssl_session_reuse.t b/mail_ssl_session_reuse.t
--- a/mail_ssl_session_reuse.t
+++ b/mail_ssl_session_reuse.t
@@ -23,6 +23,8 @@ use Test::Nginx;
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
+local $SIG{PIPE} = 'IGNORE';
+
 eval {
 	require Net::SSLeay;
 	Net::SSLeay::load_error_strings();


More information about the nginx-devel mailing list