add Facebook test suite

We've been sprinkling FB-specific stuff into other tests. I think having a dedicated suite will make it obvious where to put things. I looked at all the failing tests when running the open source build and moved them here. I also had to rejigger the flib include, since that didn't work in repo mode.
Esse commit está contido em:
Paul Tarjan
2013-05-13 01:22:58 -07:00
commit de Sara Golemon
commit 6e391b3c51
10 arquivos alterados com 15 adições e 115 exclusões
+5 -5
Ver Arquivo
@@ -2,13 +2,13 @@
// Copyright 2004-present Facebook. All Rights Reserved.
function foo(array $data) {
$duplicate_click = idx($data, 'duplicate_click');
if ($duplicate_click === 'false') {
$duplicate_click = false;
$ret = current($data);
if ($ret === 'false') {
$ret = false;
} else {
$duplicate_click = (bool)$duplicate_click;
$ret = (bool)$ret;
}
return $duplicate_click;
return $ret;
}
var_dump(foo(array()));
-19
Ver Arquivo
@@ -1,19 +0,0 @@
<?php
echo "_fbcufa_init.php begin\n";
function doThrow() {
throw new Exception("blah");
}
function foo($x, $y) {
var_dump($x, $y);
return 42;
}
class C {
public $blah = 123;
public static function bar($x) {
return $x * 3;
}
public function baz($x) {
return $x + $this->blah;
}
}
echo "_fbcufa_init.php end\n";
-37
Ver Arquivo
@@ -1,37 +0,0 @@
<?php
$doc = __DIR__ . '/fbcufa.inc';
require_once 'fbcufa.inc';
function main() {
global $doc;
echo "--------------------\n";
$hnd = fb_call_user_func_async($doc, 'foo', array(1,2,3), 'blarg');
$rv = fb_end_user_func_async($hnd);
var_dump($rv);
echo "--------------------\n";
$hnd = fb_call_user_func_async($doc, 'C::bar', 42);
$rv = fb_end_user_func_async($hnd);
var_dump($rv);
echo "--------------------\n";
$hnd = fb_call_user_func_async($doc, array('C', 'bar'), 42);
$rv = fb_end_user_func_async($hnd);
var_dump($rv);
echo "--------------------\n";
$obj = new C;
$obj->blah = 789;
$hnd = fb_call_user_func_async($doc, array($obj, 'baz'), 73);
$rv = fb_end_user_func_async($hnd);
var_dump($rv);
echo "--------------------\n";
$hnd = fb_call_user_func_async($doc, 'doThrow');
$rv = null;
$caught = false;
try {
$rv = fb_end_user_func_async($hnd);
} catch (Exception $e) {
$caught = true;
}
if (!$caught) {
echo "Exception was not thrown as expected\n";
}
}
main();
-31
Ver Arquivo
@@ -1,31 +0,0 @@
_fbcufa_init.php begin
_fbcufa_init.php end
--------------------
_fbcufa_init.php begin
_fbcufa_init.php end
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
string(5) "blarg"
int(42)
--------------------
_fbcufa_init.php begin
_fbcufa_init.php end
int(126)
--------------------
_fbcufa_init.php begin
_fbcufa_init.php end
int(126)
--------------------
_fbcufa_init.php begin
_fbcufa_init.php end
int(862)
--------------------
_fbcufa_init.php begin
_fbcufa_init.php end
HipHop Fatal error: Uncaught exception 'Exception' with message 'blah' in %s:4\nStack trace:\n#0 (): doThrow()\n#1 (): xbox_process_call_message()\n#2 {main}
-10
Ver Arquivo
@@ -24,13 +24,3 @@ class B extends X {
$b = new B;
$b->foo();
class C extends phpmcc {
protected $a;
public function __construct() {
$this->a = 1;
}
}
$c = new C;
var_dump($c);
-4
Ver Arquivo
@@ -1,6 +1,2 @@
A::foo 1
A::foo 123
object(C)#2 (1) {
["a":protected]=>
int(1)
}
+1
Ver Arquivo
@@ -136,6 +136,7 @@ function map_convenience_filename($file) {
'slow' => 'hphp/test/slow',
'zend' => 'hphp/test/zend/good',
'zend_bad' => 'hphp/test/zend/bad',
'facebook' => 'hphp/facebook/test',
);
$m = null;
+2 -1
Ver Arquivo
@@ -1,3 +1,4 @@
<?php
var_dump(fb_rename_function('', ''));var_dump(hotprofiler_enable(-1));var_dump(mysql_fetch_array(null, 0));var_dump(mysql_fetch_object(null, 'stdClass'));
var_dump(mysql_fetch_array(null, 0));
var_dump(mysql_fetch_object(null, 'stdClass'));
@@ -1,4 +1,2 @@
bool(false)
NULL
bool(false)
bool(false)
+7 -6
Ver Arquivo
@@ -16,14 +16,15 @@ import os
import sys
suites = {
'Slow' : 'slow',
'Quick' : 'quick',
'Zend' : 'zend/good',
'Slow': 'slow',
'Quick': 'quick',
'Zend': 'zend/good',
'Facebook': '../facebook/test/',
}
modes = {
'JitIR' : 'hhir',
'Jit' : 'jit',
'VM' : 'interp',
'JitIR': 'hhir',
'Jit': 'jit',
'VM': 'interp',
}
home = os.getenv('HPHP_HOME')