1
0
mirror of https://github.com/php/php-src.git synced 2026-04-07 16:13:32 +02:00

Fixed tests which fail from time to time because of race conditions ("echo" command didn't wait for all the data php tried to send and as result php got a SIGPIPE)

This commit is contained in:
Dmitry Stogov
2009-09-22 14:52:47 +00:00
parent 452aca97e3
commit 38cdb16dd2
2 changed files with 14 additions and 10 deletions

View File

@@ -6,7 +6,7 @@ if(substr(PHP_OS, 0, 3) == "WIN")
die("skip Won't run on Windows");
?>
--INI--
sendmail_path="echo --- > /tmp/php_test_mailBasic2.out"
sendmail_path="sed > /tmp/php_test_mailBasic2.out"
--FILE--
<?php
/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
@@ -23,7 +23,7 @@ $to = 'user@company.com';
$subject = 'Test Subject';
$message = 'A Message';
$additional_headers = 'KHeaders';
$additional_parameters = "Extras";
$additional_parameters = "-e '5 a--- Extras'";
$outFile = "/tmp/php_test_mailBasic2.out";
@unlink($outFile);
@@ -31,11 +31,6 @@ echo "-- extra parameters --\n";
// Calling mail() with all possible arguments
var_dump( mail($to, $subject, $message, $additional_headers, $additional_parameters) );
//This test is just using a shell command (see the INI setting). The sleep()
//is used because that can take a while. If you see the test failing sometimes try
//increasing the length of the sleep.
sleep(5);
echo file_get_contents($outFile);
unlink($outFile);
?>
@@ -44,5 +39,10 @@ unlink($outFile);
*** Testing mail() : basic functionality ***
-- extra parameters --
bool(true)
To: user@company.com
Subject: Test Subject
KHeaders
A Message
--- Extras
===DONE===

View File

@@ -1,8 +1,8 @@
--TEST--
Test mail() function : variation force extra parameters
--INI--
sendmail_path="echo --- > /tmp/php_test_mailVariation2.out"
mail.force_extra_parameters="forced params"
sendmail_path="sed > /tmp/php_test_mailVariation2.out"
mail.force_extra_parameters="-e4a---forced-params"
--SKIPIF--
<?php
if(substr(PHP_OS, 0, 3) == "WIN")
@@ -35,5 +35,9 @@ unlink($outFile);
--EXPECT--
*** Testing mail() : basic functionality ***
bool(true)
--- forced params
To: user@company.com
Subject: Test Subject
A Message
---forced-params
===DONE===