diff options
author | Stanislav Malyshev <stas@php.net> | 2013-06-17 01:03:20 -0700 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2013-06-17 01:06:01 -0700 |
commit | 6b896fa57f01e7ad165e48846bad6e2d3bdca953 (patch) | |
tree | af109d6037d305f848ff59ed7d44d8c348b77df2 | |
parent | 5ac0ee30cec04b7527eb81abb84ed37f0c74da7a (diff) | |
download | php-git-6b896fa57f01e7ad165e48846bad6e2d3bdca953.tar.gz |
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
-rw-r--r-- | ext/bz2/tests/bug51997.phpt | 2 | ||||
-rw-r--r-- | ext/bz2/tests/with_files.phpt | 2 | ||||
-rw-r--r-- | ext/spl/tests/SplFileInfo_getInode_basic.phpt | 8 | ||||
-rw-r--r-- | ext/spl/tests/SplFileInfo_getPerms_basic.phpt | 8 | ||||
-rw-r--r-- | ext/standard/tests/file/fpassthru_variation.phpt | 2 | ||||
-rw-r--r-- | ext/standard/tests/file/lchown_basic.phpt | 8 | ||||
-rw-r--r-- | ext/standard/tests/file/mkdir-001.phpt | 24 | ||||
-rw-r--r-- | ext/standard/tests/file/mkdir-002.phpt | 30 | ||||
-rw-r--r-- | ext/standard/tests/file/mkdir-003.phpt | 18 | ||||
-rw-r--r-- | ext/standard/tests/file/tempnam_variation5.phpt | 14 | ||||
-rw-r--r-- | ext/standard/tests/file/touch_basic.phpt | 2 | ||||
-rw-r--r-- | ext/standard/tests/file/touch_variation2.phpt | 2 | ||||
-rw-r--r-- | ext/xmlreader/tests/003.phpt | 2 | ||||
-rw-r--r-- | ext/xmlreader/tests/004.phpt | 2 | ||||
-rw-r--r-- | ext/xmlreader/tests/007.phpt | 2 | ||||
-rw-r--r-- | ext/xmlreader/tests/008.phpt | 2 | ||||
-rw-r--r-- | ext/xmlreader/tests/012.phpt | 4 | ||||
-rw-r--r-- | 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 <?php
//file -touch ('test_file_ptfi'); -$fileInfo = new SplFileInfo('test_file_ptfi'); -$result = shell_exec('ls -i test_file_ptfi'); +touch ('SplFileInfo_getInode_basic.txt'); +$fileInfo = new SplFileInfo('SplFileInfo_getInode_basic.txt'); +$result = shell_exec('ls -i SplFileInfo_getInode_basic.txt'); var_dump($fileInfo->getInode() == $result); ?> --CLEAN-- <?php -unlink('test_file_ptfi'); +unlink('SplFileInfo_getInode_basic.txt'); ?>
--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 <?php
//file -touch ('test_file_ptfi'); -chmod('test_file_ptfi', 0557); -$fileInfo = new SplFileInfo('test_file_ptfi'); +touch ('SplFileInfo_getPerms_basic.txt'); +chmod('SplFileInfo_getPerms_basic.txt', 0557); +$fileInfo = new SplFileInfo('SplFileInfo_getPerms_basic.txt'); var_dump($fileInfo->getPerms() == 0100557); ?> --CLEAN-- <?php -unlink('test_file_ptfi'); +unlink('SplFileInfo_getPerms_basic.txt'); ?>
--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-- <?php -$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'; unlink($filename); unlink($symlink); diff --git a/ext/standard/tests/file/mkdir-001.phpt b/ext/standard/tests/file/mkdir-001.phpt index be653da29a..d1a7cebfa7 100644 --- a/ext/standard/tests/file/mkdir-001.phpt +++ b/ext/standard/tests/file/mkdir-001.phpt @@ -3,20 +3,20 @@ mkdir() tests --FILE-- <?php -var_dump(mkdir("testdir")); -var_dump(mkdir("testdir/subdir")); -var_dump(rmdir("testdir/subdir")); -var_dump(rmdir("testdir")); +var_dump(mkdir("mkdir-001")); +var_dump(mkdir("mkdir-001/subdir")); +var_dump(rmdir("mkdir-001/subdir")); +var_dump(rmdir("mkdir-001")); -var_dump(mkdir("./testdir")); -var_dump(mkdir("./testdir/subdir")); -var_dump(rmdir("./testdir/subdir")); -var_dump(rmdir("./testdir")); +var_dump(mkdir("./mkdir-001")); +var_dump(mkdir("./mkdir-001/subdir")); +var_dump(rmdir("./mkdir-001/subdir")); +var_dump(rmdir("./mkdir-001")); -var_dump(mkdir(dirname(__FILE__)."/testdir")); -var_dump(mkdir(dirname(__FILE__)."/testdir/subdir")); -var_dump(rmdir(dirname(__FILE__)."/testdir/subdir")); -var_dump(rmdir(dirname(__FILE__)."/testdir")); +var_dump(mkdir(dirname(__FILE__)."/mkdir-001")); +var_dump(mkdir(dirname(__FILE__)."/mkdir-001/subdir")); +var_dump(rmdir(dirname(__FILE__)."/mkdir-001/subdir")); +var_dump(rmdir(dirname(__FILE__)."/mkdir-001")); echo "Done\n"; ?> 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-- <?php -var_dump(mkdir("testdir", 0777)); -var_dump(mkdir("testdir/subdir", 0777)); -var_dump(`ls -l testdir`); -var_dump(rmdir("testdir/subdir")); -var_dump(rmdir("testdir")); +var_dump(mkdir("mkdir-002", 0777)); +var_dump(mkdir("mkdir-002/subdir", 0777)); +var_dump(`ls -l mkdir-002`); +var_dump(rmdir("mkdir-002/subdir")); +var_dump(rmdir("mkdir-002")); -var_dump(mkdir("./testdir", 0777)); -var_dump(mkdir("./testdir/subdir", 0777)); -var_dump(`ls -l ./testdir`); -var_dump(rmdir("./testdir/subdir")); -var_dump(rmdir("./testdir")); +var_dump(mkdir("./mkdir-002", 0777)); +var_dump(mkdir("./mkdir-002/subdir", 0777)); +var_dump(`ls -l ./mkdir-002`); +var_dump(rmdir("./mkdir-002/subdir")); +var_dump(rmdir("./mkdir-002")); -var_dump(mkdir(dirname(__FILE__)."/testdir", 0777)); -var_dump(mkdir(dirname(__FILE__)."/testdir/subdir", 0777)); -$dirname = dirname(__FILE__)."/testdir"; +var_dump(mkdir(dirname(__FILE__)."/mkdir-002", 0777)); +var_dump(mkdir(dirname(__FILE__)."/mkdir-002/subdir", 0777)); +$dirname = dirname(__FILE__)."/mkdir-002"; var_dump(`ls -l $dirname`); -var_dump(rmdir(dirname(__FILE__)."/testdir/subdir")); -var_dump(rmdir(dirname(__FILE__)."/testdir")); +var_dump(rmdir(dirname(__FILE__)."/mkdir-002/subdir")); +var_dump(rmdir(dirname(__FILE__)."/mkdir-002")); echo "Done\n"; ?> 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-- <?php -var_dump(mkdir("testdir/subdir", 0777, true)); -var_dump(rmdir("testdir/subdir")); -var_dump(rmdir("testdir")); +var_dump(mkdir("mkdir-003/subdir", 0777, true)); +var_dump(rmdir("mkdir-003/subdir")); +var_dump(rmdir("mkdir-003")); -var_dump(mkdir("./testdir/subdir", 0777, true)); -var_dump(rmdir("./testdir/subdir")); -var_dump(rmdir("./testdir")); +var_dump(mkdir("./mkdir-003/subdir", 0777, true)); +var_dump(rmdir("./mkdir-003/subdir")); +var_dump(rmdir("./mkdir-003")); -var_dump(mkdir(dirname(__FILE__)."/testdir/subdir", 0777, true)); -var_dump(rmdir(dirname(__FILE__)."/testdir/subdir")); -var_dump(rmdir(dirname(__FILE__)."/testdir")); +var_dump(mkdir(dirname(__FILE__)."/mkdir-003/subdir", 0777, true)); +var_dump(rmdir(dirname(__FILE__)."/mkdir-003/subdir")); +var_dump(rmdir(dirname(__FILE__)."/mkdir-003")); echo "Done\n"; ?> 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 <d_kelsey@uk.ibm.com> <?php -$filename = dirname(__FILE__)."/touch.dat"; +$filename = dirname(__FILE__)."/touch_variation2.dat"; $fp=fopen($filename,"w"); fwrite ($fp,"mydata"); fclose($fp); diff --git a/ext/xmlreader/tests/003.phpt b/ext/xmlreader/tests/003.phpt index 48aa4be0ba..85353a8242 100644 --- a/ext/xmlreader/tests/003.phpt +++ b/ext/xmlreader/tests/003.phpt @@ -5,7 +5,7 @@ XMLReader: libxml2 XML Reader, attributes test --FILE-- <?php /* $Id$ */ -$filename = dirname(__FILE__) . '/_002.xml'; +$filename = dirname(__FILE__) . '/_003.xml'; $xmlstring = '<?xml version="1.0" encoding="UTF-8"?> <books><book num="1" idx="2">book1</book></books>'; 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-- <?php /* $Id$ */ -$filename = dirname(__FILE__) . '/_002.xml'; +$filename = dirname(__FILE__) . '/_004.xml'; $xmlstring = '<?xml version="1.0" encoding="UTF-8"?> <books><book num="1" idx="2">book1</book></books>'; 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 = '<TEI.2>hello</TEI.2>'; $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 = '<?xml version="1.0" encoding="UTF-8" standalone="no"?> </LIST>'; $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')) { <?php gzopen('someFile', 'c'); +--CLEAN-- +<?php + unlink('someFile'); +?> --EXPECTF-- Warning: gzopen(): gzopen failed in %s on line %d |