changeset 1087:534d209f6ae4

Tests: fixed ssl_password_file test hang with missing FIFO reader.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 06 Dec 2016 14:06:44 +0300
parents b3b1403641d3
children 83b7b3f8b6c5
files ssl_password_file.t stream_ssl.t
diffstat 2 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ssl_password_file.t
+++ b/ssl_password_file.t
@@ -117,7 +117,8 @@ foreach my $name ('localhost', 'inherits
 $t->write_file('password_many', "wrong$CRLF" . "localhost$CRLF");
 $t->write_file('password_http', 'inherits');
 
-fork() || exec("echo localhost > $d/password_fifo");
+my $p = fork();
+exec("echo localhost > $d/password_fifo") if $p == 0;
 
 # do not mangle with try_run()
 # we need to distinguish ssl_password_file support vs its brokenness
@@ -127,6 +128,7 @@ eval {
 	$t->run();
 	open STDERR, ">&", \*OLDERR;
 };
+kill 'INT', $p if $@;
 
 ###############################################################################
 
--- a/stream_ssl.t
+++ b/stream_ssl.t
@@ -118,10 +118,17 @@ my $ctx = Net::SSLeay::CTX_new() or die(
 $t->write_file('password_many', "wrong$CRLF" . "localhost$CRLF");
 $t->write_file('password_http', 'inherits');
 
-fork() || exec("echo localhost > $d/password_fifo");
+my $p = fork();
+exec("echo localhost > $d/password_fifo") if $p == 0;
 
 $t->run_daemon(\&http_daemon);
-$t->run();
+
+eval {
+	open OLDERR, ">&", \*STDERR; close STDERR;
+	$t->run();
+	open STDERR, ">&", \*OLDERR;
+};
+kill 'INT', $p if $@;
 
 $t->waitforsocket('127.0.0.1:' . port(8081));