From 6b896fa57f01e7ad165e48846bad6e2d3bdca953 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Mon, 17 Jun 2013 01:03:20 -0700 Subject: [PATCH] Merge branch 'pull-request/320' * pull-request/320: this is test 5 not 6 fix race condition more shared names that create race conditions change to a unique filename more shared filenames yet another shared filename don't share a filename to stop race conditions fix race condition for 2-4 and normalize names for others fix race condition when running tests in parallel clean up after test Fix #64572: Clean up after the test Fix #64572: Clean up after the test --- ext/bz2/tests/bug51997.phpt | 2 +- ext/bz2/tests/with_files.phpt | 2 +- ext/spl/tests/SplFileInfo_getInode_basic.phpt | 8 ++--- ext/spl/tests/SplFileInfo_getPerms_basic.phpt | 8 ++--- .../tests/file/fpassthru_variation.phpt | 2 +- ext/standard/tests/file/lchown_basic.phpt | 8 ++--- ext/standard/tests/file/mkdir-001.phpt | 24 +++++++-------- ext/standard/tests/file/mkdir-002.phpt | 30 +++++++++---------- ext/standard/tests/file/mkdir-003.phpt | 18 +++++------ .../tests/file/tempnam_variation5.phpt | 14 ++++----- ext/standard/tests/file/touch_basic.phpt | 2 +- ext/standard/tests/file/touch_variation2.phpt | 2 +- ext/xmlreader/tests/003.phpt | 2 +- ext/xmlreader/tests/004.phpt | 2 +- ext/xmlreader/tests/007.phpt | 2 +- ext/xmlreader/tests/008.phpt | 2 +- ext/xmlreader/tests/012.phpt | 4 +-- ext/zlib/tests/bug61139.phpt | 4 +++ 18 files changed, 70 insertions(+), 66 deletions(-) diff --git a/ext/bz2/tests/bug51997.phpt b/ext/bz2/tests/bug51997.phpt index fea5398947..c53deacc5f 100644 --- a/ext/bz2/tests/bug51997.phpt +++ b/ext/bz2/tests/bug51997.phpt @@ -7,7 +7,7 @@ Bug #51997 (SEEK_CUR with 0 value, returns a warning) error_reporting(E_ALL); -$filename = "testfile.bz2"; +$filename = "bug51997.bz2"; $str = "This is a test string.\n"; $bz = bzopen($filename, "w"); bzwrite($bz, $str); diff --git a/ext/bz2/tests/with_files.phpt b/ext/bz2/tests/with_files.phpt index 5691445939..3763398a14 100644 --- a/ext/bz2/tests/with_files.phpt +++ b/ext/bz2/tests/with_files.phpt @@ -7,7 +7,7 @@ BZ2 with files error_reporting(E_ALL); -$filename = "testfile.bz2"; +$filename = "with_files.bz2"; $str = "This is a test string.\n"; $bz = bzopen($filename, "w"); bzwrite($bz, $str); diff --git a/ext/spl/tests/SplFileInfo_getInode_basic.phpt b/ext/spl/tests/SplFileInfo_getInode_basic.phpt index 902cbb31c6..380b865cd2 100644 --- a/ext/spl/tests/SplFileInfo_getInode_basic.phpt +++ b/ext/spl/tests/SplFileInfo_getInode_basic.phpt @@ -16,15 +16,15 @@ if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms getInode() == $result); ?> --CLEAN-- --EXPECTF-- bool(true) diff --git a/ext/spl/tests/SplFileInfo_getPerms_basic.phpt b/ext/spl/tests/SplFileInfo_getPerms_basic.phpt index e9b7beaa97..53591f3417 100644 --- a/ext/spl/tests/SplFileInfo_getPerms_basic.phpt +++ b/ext/spl/tests/SplFileInfo_getPerms_basic.phpt @@ -16,15 +16,15 @@ if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms getPerms() == 0100557); ?> --CLEAN-- --EXPECTF-- bool(true) diff --git a/ext/standard/tests/file/fpassthru_variation.phpt b/ext/standard/tests/file/fpassthru_variation.phpt index 56a039e628..749eefb4c8 100644 --- a/ext/standard/tests/file/fpassthru_variation.phpt +++ b/ext/standard/tests/file/fpassthru_variation.phpt @@ -12,7 +12,7 @@ echo "*** Testing fpassthru() function with files ***\n\n"; echo "--- Testing with different offsets ---\n"; -$file_name = dirname(__FILE__)."/passthru.tmp"; +$file_name = dirname(__FILE__)."/passthru_variation.tmp"; $file_write = fopen($file_name, "w"); fwrite($file_write, "1234567890abcdefghijklmnopqrstuvwxyz"); fclose($file_write); diff --git a/ext/standard/tests/file/lchown_basic.phpt b/ext/standard/tests/file/lchown_basic.phpt index 9675d3acae..f2aff597c5 100644 --- a/ext/standard/tests/file/lchown_basic.phpt +++ b/ext/standard/tests/file/lchown_basic.phpt @@ -14,8 +14,8 @@ if (!function_exists("posix_getuid")) die("skip no posix_getuid()"); */ echo "*** Testing lchown() : basic functionality ***\n"; -$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lchown.txt'; -$symlink = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'symlink.txt'; +$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lchown_basic.txt'; +$symlink = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lchown_basic_symlink.txt'; $uid = posix_getuid(); @@ -29,8 +29,8 @@ var_dump( fileowner( $symlink ) === $uid ); --CLEAN-- diff --git a/ext/standard/tests/file/mkdir-002.phpt b/ext/standard/tests/file/mkdir-002.phpt index ccfd6c3d74..d149098df0 100644 --- a/ext/standard/tests/file/mkdir-002.phpt +++ b/ext/standard/tests/file/mkdir-002.phpt @@ -9,24 +9,24 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { --FILE-- diff --git a/ext/standard/tests/file/mkdir-003.phpt b/ext/standard/tests/file/mkdir-003.phpt index 50ad5e6c4e..fdd49f340f 100644 --- a/ext/standard/tests/file/mkdir-003.phpt +++ b/ext/standard/tests/file/mkdir-003.phpt @@ -3,17 +3,17 @@ recursive mkdir() tests --FILE-- diff --git a/ext/standard/tests/file/tempnam_variation5.phpt b/ext/standard/tests/file/tempnam_variation5.phpt index 26c3f91f1f..cf2eff8bec 100644 --- a/ext/standard/tests/file/tempnam_variation5.phpt +++ b/ext/standard/tests/file/tempnam_variation5.phpt @@ -16,13 +16,13 @@ if(substr(PHP_OS, 0, 3) == "WIN") $file_path = dirname(__FILE__); echo "*** Test tempnam() function: by passing an existing filename as prefix ***\n"; -$dir_name = $file_path."/tempnam_variation6"; +$dir_name = $file_path."/tempnam_variation5"; mkdir($dir_name); -$h = fopen($dir_name."/tempnam_variation6.tmp", "w"); +$h = fopen($dir_name."/tempnam_variation5.tmp", "w"); for($i=1; $i<=3; $i++) { echo "-- Iteration $i --\n"; - $created_file = tempnam("$dir_name", "tempnam_variation6.tmp"); + $created_file = tempnam("$dir_name", "tempnam_variation5.tmp"); if( file_exists($created_file) ) { echo "File name is => "; @@ -35,7 +35,7 @@ for($i=1; $i<=3; $i++) { unlink($created_file); } fclose($h); -unlink($dir_name."/tempnam_variation6.tmp"); +unlink($dir_name."/tempnam_variation5.tmp"); rmdir($dir_name); echo "\n*** Done ***\n"; @@ -43,10 +43,10 @@ echo "\n*** Done ***\n"; --EXPECTF-- *** Test tempnam() function: by passing an existing filename as prefix *** -- Iteration 1 -- -File name is => %stempnam_variation6%etempnam_variation6.tmp%s +File name is => %stempnam_variation5%etempnam_variation5.tmp%s -- Iteration 2 -- -File name is => %stempnam_variation6%etempnam_variation6.tmp%s +File name is => %stempnam_variation5%etempnam_variation5.tmp%s -- Iteration 3 -- -File name is => %stempnam_variation6%etempnam_variation6.tmp%s +File name is => %stempnam_variation5%etempnam_variation5.tmp%s *** Done *** diff --git a/ext/standard/tests/file/touch_basic.phpt b/ext/standard/tests/file/touch_basic.phpt index c41fdf1d7b..b39c84b7e0 100644 --- a/ext/standard/tests/file/touch_basic.phpt +++ b/ext/standard/tests/file/touch_basic.phpt @@ -19,7 +19,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { echo "*** Testing touch() : basic functionality ***\n"; -$filename = dirname(__FILE__)."/touch.dat"; +$filename = dirname(__FILE__)."/touch_basic.dat"; echo "\n--- testing touch creates a file ---\n"; @unlink($filename); diff --git a/ext/standard/tests/file/touch_variation2.phpt b/ext/standard/tests/file/touch_variation2.phpt index 9ccb90c751..9477a3494e 100644 --- a/ext/standard/tests/file/touch_variation2.phpt +++ b/ext/standard/tests/file/touch_variation2.phpt @@ -6,7 +6,7 @@ Dave Kelsey book1'; diff --git a/ext/xmlreader/tests/004.phpt b/ext/xmlreader/tests/004.phpt index d4f044e97f..b2d7254fe4 100644 --- a/ext/xmlreader/tests/004.phpt +++ b/ext/xmlreader/tests/004.phpt @@ -5,7 +5,7 @@ XMLReader: libxml2 XML Reader, attributes test --FILE-- book1'; diff --git a/ext/xmlreader/tests/007.phpt b/ext/xmlreader/tests/007.phpt index 842f25e5f6..aacd059b6e 100644 --- a/ext/xmlreader/tests/007.phpt +++ b/ext/xmlreader/tests/007.phpt @@ -8,7 +8,7 @@ XMLReader: libxml2 XML Reader, setRelaxNGSchema $xmlstring = 'hello'; $relaxngfile = dirname(__FILE__) . '/relaxNG.rng'; -$file = dirname(__FILE__) . '/__007.xml'; +$file = dirname(__FILE__) . '/_007.xml'; file_put_contents($file, $xmlstring); $reader = new XMLReader(); diff --git a/ext/xmlreader/tests/008.phpt b/ext/xmlreader/tests/008.phpt index e3af00e4f7..2dbb5e7c87 100644 --- a/ext/xmlreader/tests/008.phpt +++ b/ext/xmlreader/tests/008.phpt @@ -23,7 +23,7 @@ $xmlstring = ' '; $dtdfile = rawurlencode(dirname(__FILE__)) . '/dtdexample.dtd'; -$file = dirname(__FILE__) . '/__008.xml'; +$file = dirname(__FILE__) . '/_008.xml'; file_put_contents($file, $xmlstring); diff --git a/ext/xmlreader/tests/012.phpt b/ext/xmlreader/tests/012.phpt index e0edeef2dd..94fb34038c 100644 --- a/ext/xmlreader/tests/012.phpt +++ b/ext/xmlreader/tests/012.phpt @@ -38,7 +38,7 @@ $reader->close(); echo "\nUsing URI:\n"; $reader = new XMLReader(); -$file = dirname(__FILE__) . '/012.xml'; +$file = dirname(__FILE__) . '/_012.xml'; if (DIRECTORY_SEPARATOR == '\\') { $file = str_replace('\\',"/", $file); } @@ -52,7 +52,7 @@ var_dump($reader->getAttribute('baz')); $reader->close(); $reader = new XMLReader(); -$reader->open(dirname(__FILE__) . '/012.xml'); +$reader->open(dirname(__FILE__) . '/_012.xml'); $reader->setParserProperty(XMLReader::DEFAULTATTRS, true); while($reader->read() && $reader->nodeType != XMLReader::ELEMENT); var_dump($reader->getAttribute('bar')); diff --git a/ext/zlib/tests/bug61139.phpt b/ext/zlib/tests/bug61139.phpt index eaca00369b..71961a64dc 100644 --- a/ext/zlib/tests/bug61139.phpt +++ b/ext/zlib/tests/bug61139.phpt @@ -10,5 +10,9 @@ if (!extension_loaded('zlib')) { --EXPECTF-- Warning: gzopen(): gzopen failed in %s on line %d -- 2.40.0