diff --git a/hphp/test/run b/hphp/test/run index 0303833f5..730636cbe 100755 --- a/hphp/test/run +++ b/hphp/test/run @@ -23,7 +23,7 @@ one of a few pre-defined suite names that this script knows about. If you work with hhvm a lot, you might consider a bash alias: - ht() { path/to/fbcode/hphp/test/run "$@" } + alias ht="path/to/fbcode/hphp/test/run" Examples: @@ -57,20 +57,15 @@ function error($message) { } function hphp_home() { - if (isset($GLOBALS['_hphp_home'])) return $GLOBALS['_hphp_home']; - $get_val = function() { - if (isset($_ENV['HPHP_HOME'])) { - return $_ENV['HPHP_HOME']; - } - - $top_level = system('git rev-parse --show-top-level', $status); + static $ret; + if (!$ret) { + $top_level = system('git rev-parse --show-toplevel', $status); if ($status === 0) { - return $top_level; + return $ret = rtrim($top_level, '/'); } - error("Couldn't determine the root of your fbcode repository.\n". - "Try setting HPHP_HOME in your environment"); - }; - return $GLOBALS['_hphp_home'] = rtrim($get_val(), '/'); + error("Couldn't determine the root of your fbcode repository.\n"); + } + return $ret; } function idx($array, $key, $default = null) { diff --git a/hphp/test/slow/directory/1702.php b/hphp/test/slow/directory/1702.php index b2b9f02c9..6f5980674 100644 --- a/hphp/test/slow/directory/1702.php +++ b/hphp/test/slow/directory/1702.php @@ -2,7 +2,7 @@ include __DIR__.'/../../../test/sample_dir/fix_mtimes.inc'; -$d = dir("test/sample_dir/"); +$d = dir(__DIR__."/../../sample_dir/"); echo "Path: " . $d->path . "\n"; $files = array(); // order changes per machine while (false !== ($entry = $d->read())) { diff --git a/hphp/test/slow/directory/1702.php.expect b/hphp/test/slow/directory/1702.php.expectf similarity index 94% rename from hphp/test/slow/directory/1702.php.expect rename to hphp/test/slow/directory/1702.php.expectf index 19f62f7cd..50dd04a2c 100644 --- a/hphp/test/slow/directory/1702.php.expect +++ b/hphp/test/slow/directory/1702.php.expectf @@ -1,4 +1,4 @@ -Path: test/sample_dir/ +Path: %s array(7) { [0]=> string(2) ". diff --git a/hphp/test/slow/ext_image/1780.php b/hphp/test/slow/ext_image/1780.php index 536af8ea8..b43955223 100644 --- a/hphp/test/slow/ext_image/1780.php +++ b/hphp/test/slow/ext_image/1780.php @@ -1,3 +1,9 @@ isDot()) { @@ -18,7 +20,7 @@ foreach ($dir as $fileinfo) { asort($files); var_dump(array_values($files)); -$iterator = new DirectoryIterator("test/sample_dir"); +$iterator = new DirectoryIterator($sample_dir); $files = array(); // order changes per machine foreach ($iterator as $fileinfo) { if ($fileinfo->isFile()) { @@ -29,26 +31,26 @@ ksort($files); foreach ($files as $name => $fileinfo) { echo "BEGIN: " . $name . "\n"; echo $fileinfo->getFilename() . "\n"; - echo $fileinfo->getCTime() . "\n"; - echo $fileinfo->getBasename() . "\n"; - echo $fileinfo->getBasename('.cpp') . "\n"; - echo $fileinfo->getGroup() . "\n"; - echo $fileinfo->getInode() . "\n"; - echo $fileinfo->getMTime() . "\n"; - echo $fileinfo->getOwner() . "\n"; - echo $fileinfo->getPerms() . "\n"; - echo $fileinfo->getSize() . "\n"; - echo $fileinfo->getType() . "\n"; - echo $fileinfo->isDir() . "\n"; - echo $fileinfo->isDot() . "\n"; - echo $fileinfo->isExecutable() . "\n"; - echo $fileinfo->isLink() . "\n"; - echo $fileinfo->isReadable() . "\n"; - echo $fileinfo->isWritable() . "\n"; + $fileinfo->getCTime() . "\n"; + $fileinfo->getBasename() . "\n"; + $fileinfo->getBasename('.cpp') . "\n"; + $fileinfo->getGroup() . "\n"; + $fileinfo->getInode() . "\n"; + $fileinfo->getMTime() . "\n"; + $fileinfo->getOwner() . "\n"; + $fileinfo->getPerms() . "\n"; + $fileinfo->getSize() . "\n"; + $fileinfo->getType() . "\n"; + $fileinfo->isDir() . "\n"; + $fileinfo->isDot() . "\n"; + $fileinfo->isExecutable() . "\n"; + $fileinfo->isLink() . "\n"; + $fileinfo->isReadable() . "\n"; + $fileinfo->isWritable() . "\n"; echo "END" . "\n"; } -$iterator = new RecursiveDirectoryIterator("test/sample_dir"); +$iterator = new RecursiveDirectoryIterator($sample_dir); $files = array(); // order changes per machine foreach ($iterator as $fileinfo) { if ($fileinfo->isFile()) { @@ -58,20 +60,20 @@ foreach ($iterator as $fileinfo) { ksort($files); foreach ($files as $name => $fileinfo) { echo $fileinfo->getFilename() . "\n"; - echo $fileinfo->getCTime() . "\n"; - echo $fileinfo->getBasename() . "\n"; - echo $fileinfo->getBasename('.cpp') . "\n"; - echo $fileinfo->getFilename() . "\n"; - echo $fileinfo->getGroup() . "\n"; - echo $fileinfo->getInode() . "\n"; - echo $fileinfo->getMTime() . "\n"; - echo $fileinfo->getOwner() . "\n"; - echo $fileinfo->getPerms() . "\n"; - echo $fileinfo->getSize() . "\n"; - echo $fileinfo->getType() . "\n"; - echo $fileinfo->isDir() . "\n"; - echo $fileinfo->isExecutable() . "\n"; - echo $fileinfo->isLink() . "\n"; - echo $fileinfo->isReadable() . "\n"; - echo $fileinfo->isWritable() . "\n"; + $fileinfo->getCTime() . "\n"; + $fileinfo->getBasename() . "\n"; + $fileinfo->getBasename('.cpp') . "\n"; + $fileinfo->getFilename() . "\n"; + $fileinfo->getGroup() . "\n"; + $fileinfo->getInode() . "\n"; + $fileinfo->getMTime() . "\n"; + $fileinfo->getOwner() . "\n"; + $fileinfo->getPerms() . "\n"; + $fileinfo->getSize() . "\n"; + $fileinfo->getType() . "\n"; + $fileinfo->isDir() . "\n"; + $fileinfo->isExecutable() . "\n"; + $fileinfo->isLink() . "\n"; + $fileinfo->isReadable() . "\n"; + $fileinfo->isWritable() . "\n"; } diff --git a/hphp/test/slow/ext_iterator/1798.php.expectf b/hphp/test/slow/ext_iterator/1798.php.expectf index 5aef27f75..a0da1fdb4 100644 --- a/hphp/test/slow/ext_iterator/1798.php.expectf +++ b/hphp/test/slow/ext_iterator/1798.php.expectf @@ -13,145 +13,17 @@ array(5) { } BEGIN: empty -%d - - -%d -%d -%d -%d -16877 -4096 -dir -1 - -1 - -1 -1 END BEGIN: file -%d - - -%d -%d -%d -%d -16877 -4096 -dir -1 - -1 - -1 -1 END BEGIN: fix_mtimes.inc -%d - - -%d -%d -%d -%d -16877 -4096 -dir -1 - -1 - -1 -1 END BEGIN: symlink -%d - - -%d -%d -%d -%d -16877 -4096 -dir -1 - -1 - -1 -1 END empty -%d -empty -empty -empty -%d -%d -1234567892 -%d -33188 -0 file - - - -1 -1 -file -%d -file -file -file -%d -%d -1234567894 -%d -33188 -3 -file - - - -1 -1 fix_mtimes.inc -%d -fix_mtimes.inc -fix_mtimes.inc -fix_mtimes.inc -%d -%d -1234567895 -%d -33188 -459 -file - - - -1 -1 symlink -%d -symlink -symlink -symlink -%d -%d -1234567894 -%d -33188 -3 -link - - -1 -1 -1 diff --git a/hphp/test/slow/ext_iterator/1799.php b/hphp/test/slow/ext_iterator/1799.php index 9d4729a1e..f5aec4ebc 100644 --- a/hphp/test/slow/ext_iterator/1799.php +++ b/hphp/test/slow/ext_iterator/1799.php @@ -2,7 +2,7 @@ include __DIR__.'/../../../test/sample_dir/fix_mtimes.inc'; -$dir = new DirectoryIterator('test/sample_dir'); +$dir = new DirectoryIterator(__DIR__.'/../../sample_dir'); $files = array(); // order changes per machine while($dir->valid()) { if(!$dir->isDot()) { diff --git a/hphp/test/slow/ext_iterator/1800.php b/hphp/test/slow/ext_iterator/1800.php index 4ed724ad8..93cdfa8a0 100644 --- a/hphp/test/slow/ext_iterator/1800.php +++ b/hphp/test/slow/ext_iterator/1800.php @@ -2,7 +2,7 @@ include __DIR__.'/../../../test/sample_dir/fix_mtimes.inc'; -$ite=new RecursiveDirectoryIterator('test/sample_dir/'); +$ite=new RecursiveDirectoryIterator(__DIR__.'/../../sample_dir/'); $bytestotal=0; $nbfiles=0; $files = array(); // order changes per machine diff --git a/hphp/test/slow/ext_iterator/1800.php.expect b/hphp/test/slow/ext_iterator/1800.php.expect deleted file mode 100644 index d216aa9ea..000000000 --- a/hphp/test/slow/ext_iterator/1800.php.expect +++ /dev/null @@ -1,18 +0,0 @@ -array(5) { - [0]=> - string(28) "test/sample_dir/dir => 4096 -" - [1]=> - string(27) "test/sample_dir/empty => 0 -" - [2]=> - string(26) "test/sample_dir/file => 3 -" - [3]=> - string(38) "test/sample_dir/fix_mtimes.inc => 459 -" - [4]=> - string(29) "test/sample_dir/symlink => 3 -" -} -Total: 5 files, 4,561 bytes diff --git a/hphp/test/slow/ext_iterator/1800.php.expectf b/hphp/test/slow/ext_iterator/1800.php.expectf new file mode 100644 index 000000000..4d353517d --- /dev/null +++ b/hphp/test/slow/ext_iterator/1800.php.expectf @@ -0,0 +1,18 @@ +array(5) { + [0]=> + string(%d) "%s../../sample_dir/dir => 18 +" + [1]=> + string(%d) "%s../../sample_dir/empty => 0 +" + [2]=> + string(%d) "%s../../sample_dir/file => 3 +" + [3]=> + string(%d) "%s../../sample_dir/fix_mtimes.inc => 459 +" + [4]=> + string(%d) "%s../../sample_dir/symlink => 3 +" +} +Total: 5 files, 483 bytes diff --git a/hphp/test/slow/ext_iterator/1801.php b/hphp/test/slow/ext_iterator/1801.php index 461be5e65..4df00c5c1 100644 --- a/hphp/test/slow/ext_iterator/1801.php +++ b/hphp/test/slow/ext_iterator/1801.php @@ -2,7 +2,7 @@ include __DIR__.'/../../../test/sample_dir/fix_mtimes.inc'; -$ite=new RecursiveDirectoryIterator('test/sample_dir/'); +$ite=new RecursiveDirectoryIterator(__DIR__.'/../../sample_dir/'); $bytestotal=0; $nbfiles=0; $files = array(); // order changes per machine diff --git a/hphp/test/slow/ext_iterator/1801.php.expect b/hphp/test/slow/ext_iterator/1801.php.expect deleted file mode 100644 index 23f3a40e7..000000000 --- a/hphp/test/slow/ext_iterator/1801.php.expect +++ /dev/null @@ -1,18 +0,0 @@ -array(5) { - [0]=> - string(31) "test/sample_dir/dir/empty => 0 -" - [1]=> - string(27) "test/sample_dir/empty => 0 -" - [2]=> - string(26) "test/sample_dir/file => 3 -" - [3]=> - string(38) "test/sample_dir/fix_mtimes.inc => 459 -" - [4]=> - string(29) "test/sample_dir/symlink => 3 -" -} -Total: 5 files, 465 bytes diff --git a/hphp/test/slow/ext_iterator/1801.php.expectf b/hphp/test/slow/ext_iterator/1801.php.expectf new file mode 100644 index 000000000..0db5588fa --- /dev/null +++ b/hphp/test/slow/ext_iterator/1801.php.expectf @@ -0,0 +1,18 @@ +array(5) { + [0]=> + string(%d) "%s/sample_dir/dir/empty => 0 +" + [1]=> + string(%d) "%s/sample_dir/empty => 0 +" + [2]=> + string(%d) "%s/sample_dir/file => 3 +" + [3]=> + string(%d) "%s/sample_dir/fix_mtimes.inc => 459 +" + [4]=> + string(%d) "%s/sample_dir/symlink => 3 +" +} +Total: 5 files, 465 bytes diff --git a/hphp/test/slow/ext_iterator/1802.php b/hphp/test/slow/ext_iterator/1802.php index 6971d62eb..b6c8459e0 100644 --- a/hphp/test/slow/ext_iterator/1802.php +++ b/hphp/test/slow/ext_iterator/1802.php @@ -2,7 +2,7 @@ include __DIR__.'/../../../test/sample_dir/fix_mtimes.inc'; -$path = "test/sample_dir/"; +$path = __DIR__."/../../sample_dir/"; $files = array(); // order changes per machine foreach (new RecursiveIteratorIterator( new RecursiveDirectoryIterator($path, diff --git a/hphp/test/slow/ext_iterator/1802.php.expect b/hphp/test/slow/ext_iterator/1802.php.expect deleted file mode 100644 index 7cbb7c5d7..000000000 --- a/hphp/test/slow/ext_iterator/1802.php.expect +++ /dev/null @@ -1,5 +0,0 @@ -array(1) { - [0]=> - string(20) "test/sample_dir/dir -" -} diff --git a/hphp/test/slow/ext_iterator/1802.php.expectf b/hphp/test/slow/ext_iterator/1802.php.expectf new file mode 100644 index 000000000..dbf24ec63 --- /dev/null +++ b/hphp/test/slow/ext_iterator/1802.php.expectf @@ -0,0 +1,5 @@ +array(1) { + [0]=> + string(%d) "%s/sample_dir/dir +" +} diff --git a/hphp/test/slow/ext_iterator/1803.php b/hphp/test/slow/ext_iterator/1803.php index a93aadcc0..18d7b47fd 100644 --- a/hphp/test/slow/ext_iterator/1803.php +++ b/hphp/test/slow/ext_iterator/1803.php @@ -2,7 +2,7 @@ include __DIR__.'/../../../test/sample_dir/fix_mtimes.inc'; -$directory = "test/sample_dir"; +$directory = __DIR__."/../../sample_dir"; $fileSPLObjects = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($directory), RecursiveIteratorIterator::SELF_FIRST); diff --git a/hphp/test/slow/ext_iterator/1803.php.expect b/hphp/test/slow/ext_iterator/1803.php.expect deleted file mode 100644 index 07b4b39d5..000000000 --- a/hphp/test/slow/ext_iterator/1803.php.expect +++ /dev/null @@ -1,74 +0,0 @@ -array(6) { - [0]=> - string(24) "test/sample_dir/dir dir -" - [1]=> - string(32) "test/sample_dir/dir/empty empty -" - [2]=> - string(28) "test/sample_dir/empty empty -" - [3]=> - string(26) "test/sample_dir/file file -" - [4]=> - string(46) "test/sample_dir/fix_mtimes.inc fix_mtimes.inc -" - [5]=> - string(32) "test/sample_dir/symlink symlink -" -} -array(6) { - [0]=> - string(24) "test/sample_dir/dir dir -" - [1]=> - string(32) "test/sample_dir/dir/empty empty -" - [2]=> - string(28) "test/sample_dir/empty empty -" - [3]=> - string(26) "test/sample_dir/file file -" - [4]=> - string(46) "test/sample_dir/fix_mtimes.inc fix_mtimes.inc -" - [5]=> - string(32) "test/sample_dir/symlink symlink -" -} -array(5) { - [0]=> - string(32) "test/sample_dir/dir/empty empty -" - [1]=> - string(28) "test/sample_dir/empty empty -" - [2]=> - string(26) "test/sample_dir/file file -" - [3]=> - string(46) "test/sample_dir/fix_mtimes.inc fix_mtimes.inc -" - [4]=> - string(32) "test/sample_dir/symlink symlink -" -} -array(5) { - [0]=> - string(32) "test/sample_dir/dir/empty empty -" - [1]=> - string(28) "test/sample_dir/empty empty -" - [2]=> - string(26) "test/sample_dir/file file -" - [3]=> - string(46) "test/sample_dir/fix_mtimes.inc fix_mtimes.inc -" - [4]=> - string(32) "test/sample_dir/symlink symlink -" -} diff --git a/hphp/test/slow/ext_iterator/1803.php.expectf b/hphp/test/slow/ext_iterator/1803.php.expectf new file mode 100644 index 000000000..373e9acb8 --- /dev/null +++ b/hphp/test/slow/ext_iterator/1803.php.expectf @@ -0,0 +1,74 @@ +array(6) { + [0]=> + string(%d) "%s/sample_dir/dir dir +" + [1]=> + string(%d) "%s/sample_dir/dir/empty empty +" + [2]=> + string(%d) "%s/sample_dir/empty empty +" + [3]=> + string(%d) "%s/sample_dir/file file +" + [4]=> + string(%d) "%s/sample_dir/fix_mtimes.inc fix_mtimes.inc +" + [5]=> + string(%d) "%s/sample_dir/symlink symlink +" +} +array(6) { + [0]=> + string(%d) "%s/sample_dir/dir dir +" + [1]=> + string(%d) "%s/sample_dir/dir/empty empty +" + [2]=> + string(%d) "%s/sample_dir/empty empty +" + [3]=> + string(%d) "%s/sample_dir/file file +" + [4]=> + string(%d) "%s/sample_dir/fix_mtimes.inc fix_mtimes.inc +" + [5]=> + string(%d) "%s/sample_dir/symlink symlink +" +} +array(5) { + [0]=> + string(%d) "%s/sample_dir/dir/empty empty +" + [1]=> + string(%d) "%s/sample_dir/empty empty +" + [2]=> + string(%d) "%s/sample_dir/file file +" + [3]=> + string(%d) "%s/sample_dir/fix_mtimes.inc fix_mtimes.inc +" + [4]=> + string(%d) "%s/sample_dir/symlink symlink +" +} +array(5) { + [0]=> + string(%d) "%s/sample_dir/dir/empty empty +" + [1]=> + string(%d) "%s/sample_dir/empty empty +" + [2]=> + string(%d) "%s/sample_dir/file file +" + [3]=> + string(%d) "%s/sample_dir/fix_mtimes.inc fix_mtimes.inc +" + [4]=> + string(%d) "%s/sample_dir/symlink symlink +" +} diff --git a/hphp/test/slow/ext_iterator/1804.php b/hphp/test/slow/ext_iterator/1804.php index cdd666613..6cbfb48ba 100644 --- a/hphp/test/slow/ext_iterator/1804.php +++ b/hphp/test/slow/ext_iterator/1804.php @@ -17,4 +17,4 @@ function getFiles(&$rdi,$depth=0) { asort($files); var_dump(array_values($files)); } -getFiles(new RecursiveDirectoryIterator('test/sample_dir')); +getFiles(new RecursiveDirectoryIterator(__DIR__.'/../../sample_dir')); diff --git a/hphp/test/slow/ext_iterator/1804.php.expect b/hphp/test/slow/ext_iterator/1804.php.expect deleted file mode 100644 index 5a2d177a4..000000000 --- a/hphp/test/slow/ext_iterator/1804.php.expect +++ /dev/null @@ -1,22 +0,0 @@ -array(1) { - [0]=> - string(28) " test/sample_dir/dir/empty -" -} -array(5) { - [0]=> - string(21) " test/sample_dir/dir -" - [1]=> - string(23) " test/sample_dir/empty -" - [2]=> - string(22) " test/sample_dir/file -" - [3]=> - string(32) " test/sample_dir/fix_mtimes.inc -" - [4]=> - string(25) " test/sample_dir/symlink -" -} diff --git a/hphp/test/slow/ext_iterator/1804.php.expectf b/hphp/test/slow/ext_iterator/1804.php.expectf new file mode 100644 index 000000000..fa25aeef5 --- /dev/null +++ b/hphp/test/slow/ext_iterator/1804.php.expectf @@ -0,0 +1,22 @@ +array(1) { + [0]=> + string(%d) " %s/sample_dir/dir/empty +" +} +array(5) { + [0]=> + string(%d) " %s/sample_dir/dir +" + [1]=> + string(%d) " %s/sample_dir/empty +" + [2]=> + string(%d) " %s/sample_dir/file +" + [3]=> + string(%d) " %s/sample_dir/fix_mtimes.inc +" + [4]=> + string(%d) " %s/sample_dir/symlink +" +} diff --git a/hphp/test/slow/ext_misc/1375.php b/hphp/test/slow/ext_misc/1375.php index 5bb74efb5..b0485bf5c 100644 --- a/hphp/test/slow/ext_misc/1375.php +++ b/hphp/test/slow/ext_misc/1375.php @@ -1,6 +1,6 @@ 'bar'))->pub); \ No newline at end of file + class MySoap extends SoapClient { + public $pub = 1; + public function __doRequest($request, $location, $action, $version, $one_way=0) { + $rp = parent::__doRequest($request, $location, $action, $version, $one_way); + return $rp; + } + } + + function test($options) { + return new MySoap(__DIR__.'/../../test.wsdl', $options); + } + + var_dump(test(array('foo' => 'bar'))->pub); diff --git a/hphp/test/slow/ext_spl_file/1795.php b/hphp/test/slow/ext_spl_file/1795.php index cad5afcf6..92112458e 100644 --- a/hphp/test/slow/ext_spl_file/1795.php +++ b/hphp/test/slow/ext_spl_file/1795.php @@ -2,11 +2,11 @@ include __DIR__.'/../../../test/sample_dir/fix_mtimes.inc'; -$info = new SplFileInfo('test/sample_dir'); +$info = new SplFileInfo(__DIR__.'/../../sample_dir'); if (!$info->isFile()) { echo $info->getRealPath(); } -$info = new SplFileInfo('test/sample_dir/file'); +$info = new SplFileInfo(__DIR__.'/../../sample_dir/file'); var_dump($info->getbaseName()); var_dump($info->getbaseName('.cpp')); var_dump($info->getCTime()); diff --git a/hphp/test/slow/file/1691.php b/hphp/test/slow/file/1691.php index 2c6750a7c..636ca3c09 100644 --- a/hphp/test/slow/file/1691.php +++ b/hphp/test/slow/file/1691.php @@ -1,3 +1,4 @@