clean up tests dir

I think this dir shouldn't have anything non-necessary in the root.
Esse commit está contido em:
Paul Tarjan
2013-06-02 21:21:06 -07:00
commit de Sara Golemon
commit f5569e4755
63 arquivos alterados com 1442 adições e 644 exclusões
-5
Ver Arquivo
@@ -8,14 +8,9 @@ endforeach(dir ${RECURSIVE_SOURCE_SUBDIRS})
auto_sources(files "*.cpp" "")
list(APPEND CXX_SOURCES ${files})
list(REMOVE_ITEM CXX_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/genCmpTest.cpp")
list(APPEND CXX_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../hhvm/process_init.cpp")
list(APPEND CXX_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../hhvm/global_variables.cpp")
add_definitions(-DHPHPI_PATH="hphpi/hphpi")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dummy_mysql_info.inc ${CMAKE_CURRENT_SOURCE_DIR}/test_mysql_info.inc COPYONLY)
add_executable(test ${CXX_SOURCES})
target_link_libraries(test hphp_analysis hphp_runtime_static ext_hhvm_static
-Wl,-uregister_libevent_server)
-5
Ver Arquivo
@@ -1,5 +0,0 @@
// Fill the following macros with username/password/hostname/dbname
#define TEST_USERNAME ""
#define TEST_PASSWORD ""
#define TEST_HOSTNAME ""
#define TEST_DATABASE ""
+64
Ver Arquivo
@@ -0,0 +1,64 @@
<?php
require_once("hphpd.php");
error_log("");
error_log("In test ".$_SERVER['PHP_SELF']);
$client = get_client("basic", "debugger_tests");
if (!$client) {
echo FAIL;
return;
}
function eval1($c) {
$c->processCmd('@', array('$a=123'));
$o = $c->processCmd('print', array('$a'));
VS($o['values']['body'], '$a');
VS($o['values']['value'], 123);
$c->processCmd('@', array('unset($a)'));
$o = $c->processCmd('print', array('$a'));
VS($o['values']['value'], null);
}
function eval2($c) {
$c->processCmd('=', array('explode(\' \', \' \')'));
$o = $c->processCmd('print', array('$_'));
VS($o['values']['value'], explode(' ', ' '));
}
function startupDoc($c) {
$o = $c->processCmd('print', array('function_exists(\'testStartup\')'));
VS($o['values']['value'], true);
}
try {
eval1($client);
eval2($client);
startupDoc($client);
// test quit and reconnect
$client->processCmd('@', array('$a=123'));
$o = $client->processCmd('quit', null);
VS($o, true);
$client = get_client("basic", "debugger_tests");
if (!$client) {
error_log("No client");
echo FAIL;
return;
}
$o = $client->processCmd('print', array('$a'));
VS($o['values']['value'], null);
eval1($client);
eval2($client);
$o = $client->processCmd('quit', null);
VS($o, true);
echo PASS;
} catch (TestFailure $t) {
error_log($t);
echo FAIL;
} catch (Exception $e) {
error_log($e);
echo FAIL;
}
+204
Ver Arquivo
@@ -0,0 +1,204 @@
<?php
require_once("hphpd.php");
error_log("In test ".$_SERVER['PHP_SELF']);
$client = get_client("break", "debugger_tests");
if (!$client) {
echo FAIL;
return;
}
function testFin($c) {
// clear and continue
$o = $c->processCmd('break', array('clear', 'all'));
VS($o['values'], null);
$c->processCmd('continue', null);
}
function break1($c) {
// file:line break
$o = $c->processCmd('break', array('break_t.php:7'));
VS($o['values'][0]['id'], 1);
VS($o['values'][0]['state'], 'ALWAYS');
VS($o['values'][0]['file'], 'break_t.php');
VS($o['values'][0]['line1'], 7);
$o = $c->processCmd('@', array('foo(\'test_break1\')'));
VS($o['output_type'], 'code_loc');
VS(substr($o['file'],-11), 'break_t.php');
VS($o['line_no'], 7);
$o = $c->processCmd('variable', null);
VS($o['values']['x'], 'test_break1');
VS($o['values']['y'], 'test_break1_suffix');
testFin($c);
}
function break2($c) {
// func() break
$o = $c->processCmd('break', array('foo()'));
VS($o['values'][0]['func'], 'foo');
VS($o['values'][0]['class'], '');
$o = $c->processCmd('@', array('foo(\'test_break2\')'));
VS(substr($o['file'],-11), 'break_t.php');
VS($o['line_no'], 6);
$o = $c->processCmd('variable', null);
VS($o['values']['x'], 'test_break2');
VS($o['values']['y'], null);
testFin($c);
}
function break3($c) {
// object method() break
$o = $c->processCmd('break', array('cls::pubObj()'));
VS($o['values'][0]['func'], 'pubObj');
VS($o['values'][0]['class'], 'cls');
$c->processCmd('@', array('$break3=new cls()'));
$o = $c->processCmd('@', array('$break3->pubObj(\'test_break3\')'));
VS(substr($o['file'],-11), 'break_t.php');
VS($o['line_no'], 12);
$o = $c->processCmd('variable', null);
VS($o['values']['x'], 'test_break3');
testFin($c);
}
function break4($c) {
// static method() break
$o = $c->processCmd('break', array('cls::pubCls()'));
VS($o['values'][0]['func'], 'pubCls');
VS($o['values'][0]['class'], 'cls');
$o = $c->processCmd('@', array('cls::pubCls(\'test_break4\')'));
VS(substr($o['file'],-11), 'break_t.php');
VS($o['line_no'], 15);
$o = $c->processCmd('variable', null);
VS($o['values']['x'], 'test_break4');
testFin($c);
}
function break5($c) {
// hphpd_break()
$c->processCmd('@', array('$break5=new cls()'));
$o = $c->processCmd('@', array('$break5->pubHardBreak(\'test_break5\')'));
VS(substr($o['file'],-11), 'break_t.php');
VS($o['line_no'], 19);
testFin($c);
}
function break6_pre($c) {
$c->processCmd('break', array('break_t2.php:7'));
$c->processCmd('break', array('foo2()'));
$c->processCmd('break', array('cls2::pubObj()'));
$o = $c->processCmd('break', array('cls2::pubCls()'));
VS($o['values'][0]['line1'], 7);
VS($o['values'][1]['func'], 'foo2');
VS($o['values'][2]['func'], 'pubObj');
VS($o['values'][3]['func'], 'pubCls');
}
function break6_post($c) {
$o = $c->processCmd('@', array('foo2(\'test_break6\')'));
VS(substr($o['file'],-12), 'break_t2.php');
VS($o['line_no'], 6);
$o = $c->processCmd('continue', null);
VS(substr($o['file'],-12), 'break_t2.php');
VS($o['line_no'], 7);
$c->processCmd('continue', null);
$c->processCmd('@', array('$break6=new cls2()'));
$o = $c->processCmd('@', array('$break6->pubObj(\'test_break6\')'));
VS(substr($o['file'],-12), 'break_t2.php');
VS($o['line_no'], 12);
$c->processCmd('continue', null);
$o = $c->processCmd('@', array('cls2::pubCls(\'test_break6\')'));
VS(substr($o['file'],-12), 'break_t2.php');
VS($o['line_no'], 15);
testFin($c);
}
function break7($c) {
// func() break
$o = $c->processCmd('break', array('\\TestNs\\foo()'));
VS($o['values'][0]['func'], 'TestNs\\foo');
VS($o['values'][0]['class'], '');
VS($o['values'][0]['namespace'], '');
$o = $c->processCmd('@', array('\\TestNs\\foo(\'test_break7\')'));
VS(substr($o['file'],-12), 'break_t3.php');
VS($o['line_no'], 7);
$o = $c->processCmd('variable', null);
VS($o['values']['x'], 'test_break7');
VS($o['values']['y'], null);
testFin($c);
}
function break8($c) {
// object method() break
$o = $c->processCmd('break', array('TestNs\\cls::pubObj()'));
VS($o['values'][0]['func'], 'pubObj');
VS($o['values'][0]['class'], 'TestNs\\cls');
VS($o['values'][0]['namespace'], '');
$c->processCmd('@', array('$break8=new \\TestNs\\cls()'));
$o = $c->processCmd('@', array('$break8->pubObj(\'test_break8\')'));
VS(substr($o['file'],-12), 'break_t3.php');
VS($o['line_no'], 13);
$o = $c->processCmd('variable', null);
VS($o['values']['x'], 'test_break8');
testFin($c);
}
function break9($c) {
// static method() break
$o = $c->processCmd('break', array('\\TestNs\\cls::pubCls()'));
VS($o['values'][0]['func'], 'pubCls');
VS($o['values'][0]['class'], 'TestNs\\cls');
VS($o['values'][0]['namespace'], '');
$o = $c->processCmd('@', array('\\TestNs\\cls::pubCls(\'test_break9\')'));
VS(substr($o['file'],-12), 'break_t3.php');
VS($o['line_no'], 16);
$o = $c->processCmd('variable', null);
VS($o['values']['x'], 'test_break9');
testFin($c);
}
function break10($c) {
$o = $c->processCmd('break', array(':fb:my:thing::doIt()'));
VS($o['text'], "Breakpoint 4 set upon entering xhp_fb__my__thing::doIt()\n");
VS($o['values'][0]['func'], 'doIt');
VS($o['values'][0]['class'], 'xhp_fb__my__thing');
VS($o['values'][0]['namespace'], '');
$o = $c->processCmd('@', array(':fb:my:thing::doIt()'));
VS($o['line_no'], 8);
$o = $c->processCmd('break', array('clear', 'all'));
testFin($c);
}
try {
// Test breakpoints on functions that are already seen
$client->processCmd('@', array('include(\'break_t.php\')'));
break1($client);
break2($client);
break3($client);
break4($client);
break5($client);
// Test breakpoints on functions that are not seen yet
break6_pre($client);
$client->processCmd('@', array('include(\'break_t2.php\')'));
break6_post($client);
//Test breakpoints on function entry for classes in namespaces
$client->processCmd('@', array('include(\'break_t3.php\')'));
break7($client);
break8($client);
break9($client);
//Test breakpoints on function entry for xhp classes
$client->processCmd('@', array('include(\'break_t4.php\')'));
break10($client);
$o = $client->processCmd('quit', null);
VS($o, true);
echo PASS;
} catch (TestFailure $t) {
error_log($t);
echo FAIL;
} catch (Exception $e) {
error_log($e);
echo FAIL;
}
+24
Ver Arquivo
@@ -0,0 +1,24 @@
<?php
// Warning: line numbers are sensitive, do not change
function foo($x) {
$y = $x.'_suffix';
error_log($y);
}
class cls {
public function pubObj($x) {
error_log("pubObj:".$x);
}
public static function pubCls($x) {
error_log("pubCls:".$x);
}
public function pubHardBreak($x) {
error_log("pubHardBreak:".$x);
hphpd_break();
error_log("pubHardBreak:done");
}
}
error_log('break_t.php loaded');
+19
Ver Arquivo
@@ -0,0 +1,19 @@
<?php
// Warning: line numbers are sensitive, do not change
function foo2($x) {
$y = $x.'_suffix';
error_log($y);
}
class cls2 {
public function pubObj($x) {
error_log("pubObj2:".$x);
}
public static function pubCls($x) {
error_log("pubCls2:".$x);
}
}
error_log('break_t2.php loaded');
+81
Ver Arquivo
@@ -0,0 +1,81 @@
<?php
require_once("hphpd.php");
error_log("In test ".$_SERVER['PHP_SELF']);
$client = get_client("eval", "debugger_tests");
if (!$client) {
echo FAIL;
return;
}
function eval1($c) {
$o = $c->processCmd('print', array('function_exists(\'test1\')'));
VS($o['values']['value'], false);
$c->processCmd('@', array('function test1($x){error_log($x);return $x+1;}'));
$o = $c->processCmd('print', array('function_exists(\'test1\')'));
VS($o['values']['value'], true);
$c->processCmd('@', array('$eval1=test1(4)'));
$o = $c->processcmd('print', array('$eval1'));
VS($o['values']['value'], 5);
}
function eval2($c) {
$o = $c->processCmd('print', array('class_exists(\'test2\')'));
VS($o['values']['value'], false);
$c->processCmd('@', array('class test2 { '.
' public $a; '.
' private $b; '.
' public function ab() { '.
' return $this->a . ":" . $this->b;} '.
' public function callCls() { '.
' $obj = new cls(); '.
' return $obj->meth($this);} '.
' private function seven() { return 7;}'.
'} '));
$o = $c->processCmd('print', array('class_exists(\'test2\')'));
VS($o['values']['value'], true);
$c->processCmd('set', array('bac', 'off'));
$c->processCmd('@', array('$eval2 = new test2()'));
$c->processCmd('@', array('$eval2->a = 3'));
$c->processCmd('@', array('$eval2->b = 4'));
$o = $c->processCmd('print', array('$eval2->ab()'));
VS($o['values']['value'], '3:');
$c->processCmd('set', array('bac', 'on'));
$c->processCmd('@', array('$eval2->b = 4'));
$o = $c->processCmd('print', array('$eval2->ab()'));
VS($o['values']['value'], '3:4');
$c->processCmd('break', array('eval_t.php:12'));
$o = $c->processCmd('print', array('$eval2->callCls()'));
VS($o['output_type'], 'code_loc');
VS($o['line_no'], 12);
$c->processCmd('break', array('clear', 'all'));
$c->processCmd('set', array('bac', 'off'));
$c->processCmd('@', array('$this->pub = 21'));
// should work as it's in the context
$c->processCmd('@', array('$this->pri = 22'));
$c->processCmd('next', null);
// shouldn't work as seven() is not accessible
$c->processCmd('@', array('$this->pub = $x->seven()'));
$c->processCmd('set', array('bac', 'on'));
// now seven() is accessible
$c->processCmd('@', array('$this->pri = $x->seven()'));
$o = $c->processCmd('continue', null);
VS($o['output_type'], 'values');
VS($o['values']['value'], '11:12-21:22-21:7');
}
try {
$client->processCmd('@', array('include(\'eval_t.php\')'));
eval1($client);
eval2($client);
$o = $client->processCmd('quit', null);
VS($o, true);
echo PASS;
} catch (TestFailure $t) {
error_log($t);
echo FAIL;
} catch (Exception $e) {
error_log($e);
echo FAIL;
}
+18
Ver Arquivo
@@ -0,0 +1,18 @@
<?php
class cls {
public $pub;
private $pri;
public function __construct() {
$this->pub = 11;
$this->pri = 12;
}
public function meth($x) {
$a = $this->pub.':'.$this->pri;
$b = $this->pub.':'.$this->pri;
$c = $this->pub.':'.$this->pri;
return $a.'-'.$b.'-'.$c;
}
}
error_log('eval_t.php loaded');
+68
Ver Arquivo
@@ -0,0 +1,68 @@
<?php
require_once("hphpd.php");
error_log("In test ".$_SERVER['PHP_SELF']);
$client = get_client("exception", "debugger_tests");
if (!$client) {
echo FAIL;
return;
}
function testFin($c) {
// clear and continue
$o = $c->processCmd('break', array('clear', 'all'));
VS($o['values'], null);
$c->processCmd('continue', null);
}
function exception1($c) {
// Built-in
$o = $c->processCmd('exception', array('Exception'));
VS($o['values'][0]['is_exception'], true);
VS($o['values'][0]['exception_class'], 'Exception');
$o = $c->processCmd('@', array('throw_exception()'));
VS($o['output_type'], 'code_loc');
VS(substr($o['file'],-15), 'exception_t.php');
VS($o['line_no'], 8);
testFin($c);
}
function exception2($c) {
// User defined
$o = $c->processCmd('exception', array('MyException'));
VS($o['values'][0]['is_exception'], true);
VS($o['values'][0]['exception_class'], 'MyException');
$o = $c->processCmd('@', array('throw_myexception()'));
VS($o['output_type'], 'code_loc');
VS(substr($o['file'],-15), 'exception_t.php');
VS($o['line_no'], 12);
testFin($c);
}
function exception3($c) {
// runtime error
$o = $c->processCmd('exception', array('error'));
VS($o['values'][0]['is_exception'], true);
$o = $c->processCmd('@', array('error_undefined_class()'));
VS($o['output_type'], 'code_loc');
VS(substr($o['file'],-15), 'exception_t.php');
VS($o['line_no'], 16);
testFin($c);
}
try {
$client->processCmd('@', array('include(\'exception_t.php\')'));
exception1($client);
exception2($client);
exception3($client);
$o = $client->processCmd('quit', null);
VS($o, true);
echo PASS;
} catch (TestFailure $t) {
error_log($t);
echo FAIL;
} catch (Exception $e) {
error_log($e);
echo FAIL;
}
+17
Ver Arquivo
@@ -0,0 +1,17 @@
<?php
// Wanring: line numbers are sensitive, do not change
class MyException extends Exception { }
function throw_exception() {
throw new Exception();
}
function throw_myexception() {
throw new MyException();
}
function error_undefined_class() {
$x = new NoSuchClass();
}
+161
Ver Arquivo
@@ -0,0 +1,161 @@
<?php
require_once("hphpd.php");
error_log("In test ".$_SERVER['PHP_SELF']);
$client = get_client("flow", "debugger_tests");
if (!$client) {
echo FAIL;
return;
}
function testFin($c) {
// clear and continue
$o = $c->processCmd('break', array('clear', 'all'));
VS($o['values'], null);
$c->processCmd('continue', null);
}
function flow1($c) {
// break in method entry and next until going out
$c->processCmd('break', array('cls::pub()'));
$o = $c->processCmd('@', array('test(1)'));
VS(substr($o['file'],-10), 'flow_t.php');
VS($o['line_no'], 12);
$o = $c->processCmd('next', null);
VS($o['line_no'], 13);
$o = $c->processCmd('variable', null);
VS($o['values']['x'], 1);
$o = $c->processCmd('next', null);
VS($o['line_no'], 14);
$o = $c->processCmd('next', null);
VS($o['line_no'], 62);
$o = $c->processCmd('next', null);
VS($o['line_no'], 63);
testFin($c);
}
function flow2($c) {
// break in a line in middle of a method and step into and out of a function
$c->processCmd('break', array('flow_t.php:18'));
$o = $c->processCmd('@', array('test(2)'));
VS(substr($o['file'],-10), 'flow_t.php');
VS($o['line_no'], 18);
$o = $c->processCmd('step', null);
VS($o['line_no'], 19);
$o = $c->processCmd('variable', null);
VS($o['values']['z'], 10);
$o = $c->processCmd('step', null);
VS($o['line_no'], 6);
$o = $c->processCmd('variable', null);
VS($o['values']['a'], 5);
VS(isset($o['values']['c']), false);
$o = $c->processCmd('step', null);
VS($o['line_no'], 7);
$o = $c->processCmd('variable', null);
VS($o['values']['c'], 5);
$o = $c->processCmd('next', null);
VS($o['line_no'], 19);
$o = $c->processCmd('step', null);
VS($o['line_no'], 20);
testFin($c);
}
function flow3($c) {
// break in a line in middle of a function and continue to
// hphpd_break() in parent
$c->processCmd('break', array('flow_t.php:6'));
$o = $c->processCmd('@', array('test(3)'));
VS(substr($o['file'],-10), 'flow_t.php');
VS($o['line_no'], 6);
$o = $c->processCmd('continue', null);
VS($o['line_no'], 21);
testFin($c);
}
function flow4($c) {
// break in a line in middle of a function and continue to
// hphpd_break() in parent
$c->processCmd('break', array('flow_t.php:7'));
$o = $c->processCmd('@', array('test(4)'));
VS(substr($o['file'],-10), 'flow_t.php');
VS($o['line_no'], 7);
$c->processCmd('break', array('clear', 'all'));
$o = $c->processCmd('out', null);
VS($o['line_no'], 19);
$o = $c->processCmd('step', null);
VS($o['line_no'], 20);
$o = $c->processCmd('out', null);
VS($o['line_no'], 13);
$o = $c->processCmd('next', null);
VS($o['line_no'], 14);
$o = $c->processCmd('out', null);
VS($o['line_no'], 62);
testFin($c);
}
function flow5($c) {
// break just before an exception is to be thrown, and step to the catch
// block.
$c->processCmd('break', array('flow_t.php:46'));
$o = $c->processCmd('@', array('test(5)'));
VS(substr($o['file'],-10), 'flow_t.php');
VS($o['line_no'], 46);
$c->processCmd('break', array('clear', 'all'));
$o = $c->processCmd('next', null);
VS($o['line_no'], 50);
$o = $c->processCmd('next', null);
VS($o['line_no'], 53);
$o = $c->processCmd('out', null);
VS($o['line_no'], 27);
testFin($c);
}
function flow6($c) {
// break just before an exception is to be thrown, and out to the catch
// block.
$c->processCmd('break', array('flow_t.php:46'));
$o = $c->processCmd('@', array('test(6)'));
VS(substr($o['file'],-10), 'flow_t.php');
VS($o['line_no'], 46);
$c->processCmd('break', array('clear', 'all'));
$o = $c->processCmd('out', null);
VS($o['line_no'], 50);
$o = $c->processCmd('next', null);
VS($o['line_no'], 53);
$o = $c->processCmd('out', null);
VS($o['line_no'], 27);
testFin($c);
}
function flow7($c) {
// comfirm an up-stack breakpoint in a jitted basic block gets hit.
$c->processCmd('break', array('flow_t.php:7'));
$o = $c->processCmd('@', array('test(7)'));
VS(substr($o['file'],-10), 'flow_t.php');
VS($o['line_no'], 7);
$c->processCmd('break', array('clear', 'all'));
$c->processCmd('break', array('flow_t.php:62'));
$o = $c->processCmd('continue', null);
VS($o['line_no'], 62);
testFin($c);
}
try {
$client->processCmd('@', array('include(\'flow_t.php\')'));
flow1($client);
flow2($client);
flow3($client);
flow4($client);
flow5($client);
flow6($client);
flow7($client);
$o = $client->processCmd('quit', null);
VS($o, true);
echo PASS;
} catch (TestFailure $t) {
error_log($t);
echo FAIL;
} catch (Exception $e) {
error_log($e);
echo FAIL;
}
+66
Ver Arquivo
@@ -0,0 +1,66 @@
<?php
// Wanring: line numbers are sensitive, do not change
function foo($a, $b) {
$c = $b - $a;
error_log("foo:".$c);
}
class cls {
public function pub($x) {
error_log("in pub:".$x);
$this->pri($x);
error_log("out pub:".$x);
}
private function pri($x) {
error_log("in pri:".$x);
$y = $x + 3; $z = $x * 5;
foo($y, $z);
if ($x == 3) {
hphpd_break();
}
if ($x == 4) {
bigLoop(100000); // Slow enough that incorrect stepping will time out.
}
if ($x == 5 || $x == 6) {
baz($x);
}
error_log("out pri:".$x);
}
}
function bigLoopAdder($a, $b) {
return $a + $b;
}
function bigLoop($a) {
$b = 0;
while (--$a) {
$b += bigLoopAdder($a, $b);
}
return $b;
}
function thrower($a) {
throw new Exception();
}
function baz($a) {
try {
$a = thrower($a);
} catch (Exception $e) {
$a = 0;
}
return $a;
}
function test($x) {
error_log("test ".$x);
$obj = new cls();
$obj->pub($x);
error_log("test done ".$x);
}
error_log('flow_t.php loaded');
+1
Ver Arquivo
@@ -0,0 +1 @@
<?php echo "Hello, World!";
+80
Ver Arquivo
@@ -0,0 +1,80 @@
<?php
define('FAIL', 'fail');
define('PASS', 'pass');
class TestFailure extends Exception {
private $got, $exp;
public function __construct($got, $exp) {
$this->got = $got;
$this->exp = $exp;
}
public function __toString() {
return "Expect: '".var_export($this->exp, true).
"'\nGot: '".var_export($this->got, true)."'\n".
$this->getTraceAsString();
}
}
function VS($got, $exp) {
if ($got !== $exp) {
throw new TestFailure($got, $exp);
}
}
function get_client($name, $user) {
if (!function_exists("hphpd_get_client")) {
error_log("hphpd_get_client undefined");
return false;
}
$client = hphpd_get_client($name);
if (!$client) {
error_log("client $name is grabbed by another request");
return false;
}
if ($client->getState() == DebuggerClient::STATE_UNINIT) {
$options = array("user" => $user);
$client->init($options);
}
if ($client->getState() != DebuggerClient::STATE_READY_FOR_COMMAND) {
error_log("client not ready, likely failed to initialize");
return false;
}
return $client;
}
// Wait for the debugger client identified by $name to enter the busy state.
// This ensures the client has continued the process and is ready to receive
// interrupts.
function waitForClientToGetBusy($name) {
if (!function_exists("hphpd_client_ctrl")) {
error_log("hphpd_client_ctrl undefined");
return false;
}
while (($result = hphpd_client_ctrl($name, "getstate")) !=
DebuggerClient::STATE_BUSY) {
error_log("Waiting for client $name to get busy. Current state $result");
sleep(1);
}
return true;
}
// Interrupt the debugger client identified by $name.
function interrupt($name) {
// Wait for the client to enter the busy state before sending the interrupt,
// otherwise the interrupt would be wasted.
if (waitForClientToGetBusy($name)) {
error_log("interrupting client $name in state $result");
hphpd_client_ctrl($name, "interrupt");
}
}
function show($x) {
$str = var_export($x, true);
error_log($str);
}
function check($name) {
error_log(hphpd_client_ctrl($name, "getstate"));
}
@@ -0,0 +1,12 @@
<?php
function testStartup($x) {
error_log("testStartup called");
}
if (isset($_ENV['HHVM'])) {
error_log("HHVM");
}
if (isset($_ENV['HHVM_JIT'])) {
error_log("HHVM_JIT");
}
@@ -0,0 +1,15 @@
<?php
function sendToHarness($chr) {
$fname = '/tmp/hphpd_test_fifo.'.posix_getppid();
error_log('sending flag: '.$chr);
$fp = fopen($fname, 'w');
if (!$fp) {
throw new TestFailure("failed to open test fifo");
}
if (!fwrite($fp, $chr, 1)) {
throw new TestFailure("failed to write test fifo");
}
fflush($fp);
fclose($fp);
}
+62
Ver Arquivo
@@ -0,0 +1,62 @@
<?php
require_once("hphpd.php");
error_log("");
error_log("In test ".$_SERVER['PHP_SELF']);
$client = get_client("info", "debugger_tests");
if (!$client) {
error_log("No client!");
echo FAIL;
return;
}
function info1($c) {
// Built-in
$c->processCmd('@', null);
$o = $c->processCmd('info', array('array_key_exists'));
VS(trim($o['text']), '/**
* ( excerpt from http://php.net/manual/en/function.array-key-exists.php )
*
* array_key_exists() returns TRUE if the given key is set in the array.
* key can be any value possible for an array index.
*
* @key mixed Value to check.
* @search mixed An array with keys to check.
*
* @return bool Returns TRUE on success or FALSE on failure.
*/
function array_key_exists($key, $search);');
$o = $c->processCmd('info', array('stdClass'));
VS(strpos($o['text'], "class stdClass {\n}") > 0, true);
}
function info2($c) {
// User-defined
$c->processCmd('@', null);
$o = $c->processCmd('info', array('myfunc'));
VS(strpos($o['text'], 'function myfunc($a, $b);') > 0, true);
$o = $c->processCmd('info', array('MyClass'));
VS(strpos($o['text'], "class MyClass {") > 0, true);
$o = $c->processCmd('info', array('MyClass::pub'));
VS(strpos($o['text'], 'public $pub;') > 0, true);
$o = $c->processCmd('info', array('MyClass::pro'));
VS(strpos($o['text'], 'protected $pro;') > 0, true);
$o = $c->processCmd('info', array('MyClass::pri'));
VS(strpos($o['text'], 'private $pri;') > 0, true);
}
try {
info1($client);
$client->processCmd('@', array('include(\'info_t.php\')'));
info2($client);
$o = $client->processCmd('quit', null);
VS($o, true);
echo PASS;
} catch (TestFailure $t) {
error_log($t);
echo FAIL;
} catch (Exception $e) {
error_log($e);
echo FAIL;
}
+11
Ver Arquivo
@@ -0,0 +1,11 @@
<?php
function myfunc($a, $b) {
error_log($a.$b);
}
class MyClass {
public $pub;
protected $pro;
private $pri;
}
+5
Ver Arquivo
@@ -0,0 +1,5 @@
default.path = .
default.log = /tmp/hphpd_test_sandbox_error.log
default.accesslog = /tmp/hphpd_test_sandbox_access.log
default.ServerVars {
}
+126
Ver Arquivo
@@ -0,0 +1,126 @@
<?php
require_once("hphpd.php");
error_log("In test ".$_SERVER['PHP_SELF']);
$client = get_client("stack", "debugger_tests");
if (!$client) {
echo FAIL;
return;
}
function testFin($c) {
// clear and continue
$o = $c->processCmd('break', array('clear', 'all'));
VS($o['values'], null);
$c->processCmd('continue', null);
}
function stack1($c) {
$c->processCmd('break', array('bar()'));
$o = $c->processCmd('@', array('test(1, 0)'));
VS(substr($o['file'],-11), 'stack_t.php');
VS($o['line_no'], 6);
$c->processCmd('break', array('clear', 'all'));
$c->processCmd('set', array('sa', 'on'));
$o = $c->processCmd('where', null);
VS($o['frame'], 0);
VS(count($o['stacktrace']), 7);
VS(substr($o['stacktrace'][0]['file'],-11), 'stack_t.php');
VS($o['stacktrace'][0]['line'], 6);
VS($o['stacktrace'][1]['function'], 'bar');
VS($o['stacktrace'][1]['line'], 16);
VS($o['stacktrace'][1]['args'][0], 1);
VS($o['stacktrace'][1]['args'][1], 0);
VS($o['stacktrace'][2]['function'], 'foo');
VS($o['stacktrace'][2]['line'], 28);
VS($o['stacktrace'][3]['class'], 'cls');
VS($o['stacktrace'][3]['function'], 'pri');
VS($o['stacktrace'][3]['line'], 22);
VS($o['stacktrace'][4]['class'], 'cls');
VS($o['stacktrace'][4]['function'], 'pub');
VS($o['stacktrace'][4]['line'], 39);
$c->processCmd('out', null);
$o = $c->processCmd('where', null);
VS(count($o['stacktrace']), 6);
VS(substr($o['stacktrace'][0]['file'],-11), 'stack_t.php');
VS($o['stacktrace'][0]['line'], 16);
$c->processCmd('out', null);
$o = $c->processCmd('where', null);
VS(count($o['stacktrace']), 5);
VS(substr($o['stacktrace'][0]['file'],-11), 'stack_t.php');
VS($o['stacktrace'][0]['line'], 28);
$c->processCmd('set', array('sa', 'off'));
$c->processCmd('out', null);
$o = $c->processCmd('where', null);
VS(count($o['stacktrace']), 4);
VS(substr($o['stacktrace'][0]['file'],-11), 'stack_t.php');
VS($o['stacktrace'][0]['line'], 22);
VS(isset($o['stacktrace'][1]['args']), false);
$c->processCmd('set', array('sa', 'on'));
testFin($c);
}
function stack2($c) {
$c->processCmd('break', array('stack_t.php:9'));
$o = $c->processCmd('@', array('test(2, 2)'));
VS(substr($o['file'],-11), 'stack_t.php');
VS($o['line_no'], 9);
$o = $c->processCmd('where', null);
VS(count($o['stacktrace']), 15);
VS(substr($o['stacktrace'][0]['file'],-11), 'stack_t.php');
VS($o['stacktrace'][0]['line'], 9);
VS($o['stacktrace'][2]['function'], 'foo');
VS($o['stacktrace'][2]['args'][0], 2);
VS($o['stacktrace'][2]['args'][1], 0);
VS($o['stacktrace'][6]['function'], 'foo');
VS($o['stacktrace'][6]['args'][0], 2);
VS($o['stacktrace'][6]['args'][1], 1);
VS($o['stacktrace'][10]['function'], 'foo');
VS($o['stacktrace'][10]['args'][0], 2);
VS($o['stacktrace'][10]['args'][1], 2);
$o = $c->processCmd('frame', array('6'));
VS(count($o['stacktrace']), 15);
VS($o['frame'], 6);
$o = $c->processCmd('variable', null);
VS($o['values']['y'], 1);
$o = $c->processCmd('up', null);
VS($o['frame'], 7);
$o = $c->processCmd('down', null);
VS($o['frame'], 6);
$c->processCmd('@', array('$x=3'));
// will hit hphpd_break since $x is 3
$o = $c->processCmd('continue', null);
VS(substr($o['file'],-11), 'stack_t.php');
VS($o['line_no'], 30);
$o = $c->processCmd('where', null);
VS(count($o['stacktrace']), 9);
VS($o['stacktrace'][0]['line'], 30);
VS($o['stacktrace'][0]['function'], 'hphpd_break');
// hphpd break defaults its frame to 1
VS($o['frame'], 1);
$o = $c->processCmd('variable', null);
VS($o['values']['x'], 3);
testFin($c);
}
try {
$client->processCmd('@', array('include(\'stack_t.php\')'));
stack1($client);
stack2($client);
$o = $client->processCmd('quit', null);
VS($o, true);
echo PASS;
} catch (TestFailure $t) {
error_log($t);
echo FAIL;
} catch (Exception $e) {
error_log($e);
echo FAIL;
}
+43
Ver Arquivo
@@ -0,0 +1,43 @@
<?php
// Wanring: line numbers are sensitive, do not change
function bar($x, $y) {
$obj = new cls();
error_log("bar:".$x." ".$y);
if ($y <= 0) {
return $x;
}
$obj->pub($x, $y - 1);
}
function foo($x, $y) {
error_log("foo:".$x." ".$y);
return bar($x, $y);
}
class cls {
public function pub($x, $y) {
error_log("in pub:".$x." ".$y);
$v = $this->pri($x, $y);
error_log("out pub:".$x." ".$y);
return $v;
}
private function pri($x, $y) {
error_log("in pri:".$x." ".$y);
foo($x, $y);
if ($x == 3) {
hphpd_break();
}
error_log("out pri:".$x." ".$y);
}
}
function test($x, $y) {
error_log("test ".$x." ".$y);
$obj = new cls();
$obj->pub($x, $y);
error_log("test done ".$x." ".$y);
}
error_log('stack_t.php loaded');
@@ -0,0 +1,5 @@
<?php
require_once("hphpd.php");
error_log("In ".$_SERVER['PHP_SELF']);
interrupt('web_request');
echo "interrupt done";
@@ -0,0 +1,32 @@
<?php
require_once("hphpd.php");
require_once("hphpd_test_inc.php");
include 'break_t.php';
function test_break() {
$x = 'test_break() in web_request_t.php';
foo($x);
foo($x);
$obj = new cls();
$obj->pubObj($x);
cls::pubCls($x);
$obj->pubHardBreak($x);
}
function test_sleep() {
$a = 1;
// $a will be set to 0 by debugger after interrupt
while ($a == 1) {
sleep(1);
}
return $a;
}
// The test harness has started executing this program, but we need to ensure
// the debugger client the harness has also started is ready for the program to
// proceed to the first interrupt site.
waitForClientToGetBusy("web_request");
test_break();
test_sleep();
echo "request done";
+5 -5
Ver Arquivo
@@ -370,10 +370,10 @@ void TestDebugger::runServer() {
boost::lexical_cast<string>(m_serverPort);
string srcRootConfig = "-vServer.SourceRoot=" +
Process::GetCurrentDirectory() +
"/test/debugger_tests";
"/test/ext/debugger_tests";
string includePathConfig = "-vServer.IncludeSearchPaths.0=" +
Process::GetCurrentDirectory() +
"/test/debugger_tests";
"/test/ext/debugger_tests";
string adminPortConfig = "-vAdminServer.Port=" +
boost::lexical_cast<string>(m_adminPort);
string debugPortConfig = "-vEval.Debugger.Port=" +
@@ -381,13 +381,13 @@ void TestDebugger::runServer() {
string jitConfig = "-vEval.Jit=" +
boost::lexical_cast<string>(RuntimeOption::EvalJit);
// To emulate sandbox setup, let home to be "hphp/test", and user name to be
// To emulate sandbox setup, let home to be "hphp/test/ext", and user name to be
// "debugger_tests", so that it can find the sandbox_conf there
string sandboxHomeConfig = "-vSandbox.Home=" +
Process::GetCurrentDirectory() +
"/test";
"/test/ext";
const char *argv[] = {"hphpd_test", "--mode=server",
"--config=test/config-debugger-server.hdf",
"--config=test/ext/config-debugger-server.hdf",
"-vEval.JitWarmupRequests=0",
portConfig.c_str(),
srcRootConfig.c_str(),
+176 -173
Ver Arquivo
@@ -153,13 +153,13 @@ bool TestExtFile::VerifyFile(CVarRef f, CStrRef contents) {
///////////////////////////////////////////////////////////////////////////////
bool TestExtFile::test_fopen() {
Variant f = f_fopen("test/test_ext_file.txt", "r");
Variant f = f_fopen("test/ext/test_ext_file.txt", "r");
VERIFY(!same(f, false));
return Count(true);
}
bool TestExtFile::test_fpassthru() {
Variant f = f_fopen("test/test_ext_file.txt", "r");
Variant f = f_fopen("test/ext/test_ext_file.txt", "r");
f_ob_start();
VS(f_fpassthru(f), 17);
VS(f_ob_get_clean(), "Testing Ext File\n");
@@ -169,52 +169,52 @@ bool TestExtFile::test_fpassthru() {
bool TestExtFile::test_fputcsv() {
Array fields = CREATE_VECTOR2("apple", "\"banana\"");
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputcsv(f, fields);
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r");
f = f_fopen("test/ext/test_ext_file.tmp", "r");
VF(f, "apple,\"\"\"banana\"\"\"\n");
return Count(true);
}
bool TestExtFile::test_fputs() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputs(f, "testing fputs");
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r");
f = f_fopen("test/ext/test_ext_file.tmp", "r");
VF(f, "testing fputs");
return Count(true);
}
bool TestExtFile::test_fread() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputs(f, "testing fread");
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r");
f = f_fopen("test/ext/test_ext_file.tmp", "r");
VS(f_fread(f, 7), "testing");
VS(f_fread(f, 100), " fread");
return Count(true);
}
bool TestExtFile::test_fscanf() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputs(f, "testing fscanf");
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r");
f = f_fopen("test/ext/test_ext_file.tmp", "r");
VS(f_fscanf(2, f, "%s %s"), CREATE_VECTOR2("testing", "fscanf"));
return Count(true);
}
bool TestExtFile::test_fseek() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputs(f, "testing fseek");
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r");
f = f_fopen("test/ext/test_ext_file.tmp", "r");
f_fseek(f, -5, k_SEEK_END);
VS(f_fread(f, 7), "fseek");
@@ -226,56 +226,56 @@ bool TestExtFile::test_fseek() {
static const StaticString s_size("size");
bool TestExtFile::test_fstat() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputs(f, "testing fstat");
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r");
f = f_fopen("test/ext/test_ext_file.tmp", "r");
VS(f_fstat(f)[s_size], 13);
return Count(true);
}
bool TestExtFile::test_ftell() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputs(f, "testing ftell");
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r");
f = f_fopen("test/ext/test_ext_file.tmp", "r");
f_fseek(f, -5, k_SEEK_END);
VS(f_ftell(f), 8);
return Count(true);
}
bool TestExtFile::test_ftruncate() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputs(f, "testing ftruncate");
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r+");
f = f_fopen("test/ext/test_ext_file.tmp", "r+");
f_ftruncate(f, 7);
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r");
f = f_fopen("test/ext/test_ext_file.tmp", "r");
VS(f_fread(f, 20), "testing");
return Count(true);
}
bool TestExtFile::test_fwrite() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fwrite(f, "testing fwrite", 7);
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r");
f = f_fopen("test/ext/test_ext_file.tmp", "r");
VF(f, "testing");
return Count(true);
}
bool TestExtFile::test_read_write() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fwrite(f, "testing read/write");
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r+");
f = f_fopen("test/ext/test_ext_file.tmp", "r+");
f_fseek(f, 8);
f_fwrite(f, "succeeds");
f_fseek(f, 8);
@@ -284,37 +284,37 @@ bool TestExtFile::test_read_write() {
}
bool TestExtFile::test_fprintf() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fprintf(4, f, "%s %s", CREATE_VECTOR2("testing", "fprintf"));
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r");
f = f_fopen("test/ext/test_ext_file.tmp", "r");
VF(f, "testing fprintf");
return Count(true);
}
bool TestExtFile::test_vfprintf() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_vfprintf(f, "%s %s", CREATE_VECTOR2("testing", "vfprintf"));
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r");
f = f_fopen("test/ext/test_ext_file.tmp", "r");
VF(f, "testing vfprintf");
return Count(true);
}
bool TestExtFile::test_fclose() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fclose(f);
return Count(true);
}
bool TestExtFile::test_feof() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputs(f, "testing feof");
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r");
f = f_fopen("test/ext/test_ext_file.tmp", "r");
VERIFY(!f_feof(f));
VS(f_fread(f, 20), "testing feof");
VERIFY(f_feof(f));
@@ -322,22 +322,22 @@ bool TestExtFile::test_feof() {
}
bool TestExtFile::test_fflush() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputs(f, "testing fflush");
f_fflush(f);
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r");
f = f_fopen("test/ext/test_ext_file.tmp", "r");
VS(f_fread(f, 20), "testing fflush");
return Count(true);
}
bool TestExtFile::test_fgetc() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputs(f, "testing fgetc");
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r");
f = f_fopen("test/ext/test_ext_file.tmp", "r");
VS(f_fgetc(f), "t");
VS(f_fgetc(f), "e");
VS(f_fgetc(f), "s");
@@ -347,22 +347,22 @@ bool TestExtFile::test_fgetc() {
bool TestExtFile::test_fgetcsv() {
Array fields = CREATE_VECTOR2("a", "b");
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputcsv(f, fields);
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r");
f = f_fopen("test/ext/test_ext_file.tmp", "r");
Array read = f_fgetcsv(f);
VS(read, fields);
return Count(true);
}
bool TestExtFile::test_fgets() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputs(f, "testing\nfgets\n\n");
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r");
f = f_fopen("test/ext/test_ext_file.tmp", "r");
VS(f_fgets(f), "testing\n");
VS(f_fgets(f), "fgets\n");
VS(f_fgets(f), "\n");
@@ -370,28 +370,28 @@ bool TestExtFile::test_fgets() {
}
bool TestExtFile::test_fgetss() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputs(f, "<html><head>testing</head><body> fgetss</body></html>\n");
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r");
f = f_fopen("test/ext/test_ext_file.tmp", "r");
VS(f_fgetss(f), "testing fgetss\n");
return Count(true);
}
bool TestExtFile::test_flock() {
Variant f = f_fopen("test/test_ext_file.tmp", "w+");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w+");
VERIFY(f_flock(f, k_LOCK_EX));
f_flock(f, k_LOCK_UN);
return Count(true);
}
bool TestExtFile::test_rewind() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputs(f, "testing rewind");
f_fclose(f);
f = f_fopen("test/test_ext_file.tmp", "r");
f = f_fopen("test/ext/test_ext_file.tmp", "r");
VS(f_fread(f, 7), "testing");
VS(f_fread(f, 100), " rewind");
VS(f_fread(f, 7), "");
@@ -402,65 +402,69 @@ bool TestExtFile::test_rewind() {
}
bool TestExtFile::test_popen() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputs(f, "testing popen");
f_fclose(f);
f = f_popen("cat test/test_ext_file.tmp", "r");
f = f_popen("cat test/ext/test_ext_file.tmp", "r");
VS(f_fread(f, 20), "testing popen");
return Count(true);
}
bool TestExtFile::test_pclose() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputs(f, "testing pclose");
f_fclose(f);
f = f_popen("cat test/test_ext_file.tmp", "r");
f = f_popen("cat test/ext/test_ext_file.tmp", "r");
VS(f_fread(f, 20), "testing pclose");
f_pclose(f);
return Count(true);
}
bool TestExtFile::test_file_exists() {
VERIFY(f_file_exists("test/test_ext_file.txt"));
VERIFY(f_file_exists("test/ext/test_ext_file.txt"));
VERIFY(!f_file_exists(""));
return Count(true);
}
bool TestExtFile::test_file_get_contents() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputs(f, "testing file_get_contents");
f_fclose(f);
VS(f_file_get_contents("test/test_ext_file.tmp"),
VS(f_file_get_contents("test/ext/test_ext_file.tmp"),
"testing file_get_contents");
VS(unserialize_from_string(f_file_get_contents("compress.zlib://test/test_zlib_file")),
CREATE_VECTOR1("rblock:216105"));
VS(
unserialize_from_string(
f_file_get_contents("compress.zlib://test/ext/test_zlib_file")
),
CREATE_VECTOR1("rblock:216105")
);
return Count(true);
}
bool TestExtFile::test_file_put_contents() {
f_file_put_contents("test/test_ext_file.tmp", "testing file_put_contents");
VS(f_file_get_contents("test/test_ext_file.tmp"),
f_file_put_contents("test/ext/test_ext_file.tmp", "testing file_put_contents");
VS(f_file_get_contents("test/ext/test_ext_file.tmp"),
"testing file_put_contents");
return Count(true);
}
bool TestExtFile::test_file() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputs(f, "testing\nfile\n");
f_fclose(f);
Variant items = f_file("test/test_ext_file.tmp");
Variant items = f_file("test/ext/test_ext_file.tmp");
VS(items, CREATE_VECTOR2("testing\n", "file\n"));
return Count(true);
}
bool TestExtFile::test_readfile() {
f_ob_start();
VS(f_readfile("test/test_ext_file.txt"), 17);
VS(f_readfile("test/ext/test_ext_file.txt"), 17);
VS(f_ob_get_clean(), "Testing Ext File\n");
f_ob_end_clean();
return Count(true);
@@ -567,73 +571,73 @@ bool TestExtFile::test_write_hdf_string() {
}
bool TestExtFile::test_md5_file() {
VS(f_md5_file("test/test_ext_file.txt"),
VS(f_md5_file("test/ext/test_ext_file.txt"),
"f53a9b64dc3846f27ee10848d0493320");
return Count(true);
}
bool TestExtFile::test_sha1_file() {
VS(f_sha1_file("test/test_ext_file.txt"),
VS(f_sha1_file("test/ext/test_ext_file.txt"),
"3f0f6cb904835174e35697d8262170aa060be3a5");
return Count(true);
}
bool TestExtFile::test_chmod() {
VERIFY(f_chmod("test/test_ext_file.txt", 0777));
VERIFY(f_chmod("test/ext/test_ext_file.txt", 0777));
return Count(true);
}
bool TestExtFile::test_chown() {
Variant f = f_fopen("test/test_ext_file.tmp", "w");
Variant f = f_fopen("test/ext/test_ext_file.tmp", "w");
f_fputs(f, "testing\nchown\n");
f_fclose(f);
VERIFY(f_chmod("test/test_ext_file.txt", 0777));
//VERIFY(f_chown("test/test_ext_file.tmp", "hzhao"));
f_unlink("test/test_ext_file.tmp");
VERIFY(f_chmod("test/ext/test_ext_file.txt", 0777));
//VERIFY(f_chown("test/ext/test_ext_file.tmp", "hzhao"));
f_unlink("test/ext/test_ext_file.tmp");
return Count(true);
}
bool TestExtFile::test_touch() {
if (f_file_exists("test/test_ext_file.tmp")) {
f_unlink("test/test_ext_file.tmp");
VERIFY(!f_file_exists("test/test_ext_file.tmp"));
if (f_file_exists("test/ext/test_ext_file.tmp")) {
f_unlink("test/ext/test_ext_file.tmp");
VERIFY(!f_file_exists("test/ext/test_ext_file.tmp"));
}
f_touch("test/test_ext_file.tmp");
VERIFY(f_file_exists("test/test_ext_file.tmp"));
f_touch("test/ext/test_ext_file.tmp");
VERIFY(f_file_exists("test/ext/test_ext_file.tmp"));
return Count(true);
}
bool TestExtFile::test_copy() {
if (f_file_exists("test/test_ext_file2.tmp")) {
f_unlink("test/test_ext_file2.tmp");
VERIFY(!f_file_exists("test/test_ext_file2.tmp"));
if (f_file_exists("test/ext/test_ext_file2.tmp")) {
f_unlink("test/ext/test_ext_file2.tmp");
VERIFY(!f_file_exists("test/ext/test_ext_file2.tmp"));
}
if (f_file_exists("test/test_ext_file3.tmp")) {
f_unlink("test/test_ext_file3.tmp");
VERIFY(!f_file_exists("test/test_ext_file3.tmp"));
if (f_file_exists("test/ext/test_ext_file3.tmp")) {
f_unlink("test/ext/test_ext_file3.tmp");
VERIFY(!f_file_exists("test/ext/test_ext_file3.tmp"));
}
f_touch("test/test_ext_file.tmp");
f_copy("test/test_ext_file.tmp", "test/test_ext_file2.tmp");
VERIFY(f_file_exists("test/test_ext_file2.tmp"));
VERIFY(f_file_exists("test/test_ext_file.tmp"));
f_touch("test/ext/test_ext_file.tmp");
f_copy("test/ext/test_ext_file.tmp", "test/ext/test_ext_file2.tmp");
VERIFY(f_file_exists("test/ext/test_ext_file2.tmp"));
VERIFY(f_file_exists("test/ext/test_ext_file.tmp"));
// XXX disabled until we work out flaky network issues. t2183444
#if 0
f_copy("http://facebook.com", "test/test_ext_file3.tmp");
VERIFY(f_file_exists("test/test_ext_file3.tmp"));
f_copy("http://facebook.com", "test/ext/test_ext_file3.tmp");
VERIFY(f_file_exists("test/ext/test_ext_file3.tmp"));
#endif
return Count(true);
}
bool TestExtFile::test_rename() {
if (f_file_exists("test/test_ext_file2.tmp")) {
f_unlink("test/test_ext_file2.tmp");
VERIFY(!f_file_exists("test/test_ext_file2.tmp"));
if (f_file_exists("test/ext/test_ext_file2.tmp")) {
f_unlink("test/ext/test_ext_file2.tmp");
VERIFY(!f_file_exists("test/ext/test_ext_file2.tmp"));
}
f_touch("test/test_ext_file.tmp");
f_rename("test/test_ext_file.tmp", "test/test_ext_file2.tmp");
VERIFY(f_file_exists("test/test_ext_file2.tmp"));
VERIFY(!f_file_exists("test/test_ext_file.tmp"));
f_touch("test/ext/test_ext_file.tmp");
f_rename("test/ext/test_ext_file.tmp", "test/ext/test_ext_file2.tmp");
VERIFY(f_file_exists("test/ext/test_ext_file2.tmp"));
VERIFY(!f_file_exists("test/ext/test_ext_file.tmp"));
return Count(true);
}
@@ -643,70 +647,70 @@ bool TestExtFile::test_umask() {
}
bool TestExtFile::test_unlink() {
f_touch("test/test_ext_file.tmp");
VERIFY(f_file_exists("test/test_ext_file.tmp"));
f_unlink("test/test_ext_file.tmp");
VERIFY(!f_file_exists("test/test_ext_file.tmp"));
f_touch("test/ext/test_ext_file.tmp");
VERIFY(f_file_exists("test/ext/test_ext_file.tmp"));
f_unlink("test/ext/test_ext_file.tmp");
VERIFY(!f_file_exists("test/ext/test_ext_file.tmp"));
return Count(true);
}
bool TestExtFile::test_chgrp() {
f_touch("test/test_ext_file.tmp");
f_chgrp("test/test_ext_file.tmp", "root");
f_unlink("test/test_ext_file.tmp");
f_touch("test/ext/test_ext_file.tmp");
f_chgrp("test/ext/test_ext_file.tmp", "root");
f_unlink("test/ext/test_ext_file.tmp");
return Count(true);
}
bool TestExtFile::test_link() {
if (f_file_exists("test/test_ext_file2.tmp")) {
f_unlink("test/test_ext_file2.tmp");
VERIFY(!f_file_exists("test/test_ext_file2.tmp"));
if (f_file_exists("test/ext/test_ext_file2.tmp")) {
f_unlink("test/ext/test_ext_file2.tmp");
VERIFY(!f_file_exists("test/ext/test_ext_file2.tmp"));
}
f_touch("test/test_ext_file.tmp");
f_link("test/test_ext_file.tmp", "test/test_ext_file2.tmp");
VERIFY(f_file_exists("test/test_ext_file2.tmp"));
VERIFY(f_file_exists("test/test_ext_file.tmp"));
f_touch("test/ext/test_ext_file.tmp");
f_link("test/ext/test_ext_file.tmp", "test/ext/test_ext_file2.tmp");
VERIFY(f_file_exists("test/ext/test_ext_file2.tmp"));
VERIFY(f_file_exists("test/ext/test_ext_file.tmp"));
return Count(true);
}
bool TestExtFile::test_symlink() {
if (f_file_exists("test/test_ext_file2.tmp")) {
f_unlink("test/test_ext_file2.tmp");
VERIFY(!f_file_exists("test/test_ext_file2.tmp"));
if (f_file_exists("test/ext/test_ext_file2.tmp")) {
f_unlink("test/ext/test_ext_file2.tmp");
VERIFY(!f_file_exists("test/ext/test_ext_file2.tmp"));
}
f_touch("test/test_ext_file.tmp");
f_symlink("test/test_ext_file.tmp", "test/test_ext_file2.tmp");
VERIFY(f_file_exists("test/test_ext_file2.tmp"));
VERIFY(f_file_exists("test/test_ext_file.tmp"));
f_touch("test/ext/test_ext_file.tmp");
f_symlink("test/ext/test_ext_file.tmp", "test/ext/test_ext_file2.tmp");
VERIFY(f_file_exists("test/ext/test_ext_file2.tmp"));
VERIFY(f_file_exists("test/ext/test_ext_file.tmp"));
return Count(true);
}
bool TestExtFile::test_lchgrp() {
f_touch("test/test_ext_file.tmp");
f_lchgrp("test/test_ext_file.tmp", "root");
f_touch("test/ext/test_ext_file.tmp");
f_lchgrp("test/ext/test_ext_file.tmp", "root");
return Count(true);
}
bool TestExtFile::test_lchown() {
f_touch("test/test_ext_file.tmp");
f_lchown("test/test_ext_file.tmp", "root");
f_touch("test/ext/test_ext_file.tmp");
f_lchown("test/ext/test_ext_file.tmp", "root");
return Count(true);
}
bool TestExtFile::test_basename() {
VS(f_basename("test/test_ext_file.tmp"), "test_ext_file.tmp");
VS(f_basename("test/test_ext_file.tmp", ".tmp"), "test_ext_file");
VS(f_basename("test/ext/test_ext_file.tmp"), "test_ext_file.tmp");
VS(f_basename("test/ext/test_ext_file.tmp", ".tmp"), "test_ext_file");
return Count(true);
}
bool TestExtFile::test_fnmatch() {
VERIFY(f_fnmatch("test/test_*_file.tmp", "test/test_ext_file.tmp"));
VERIFY(f_fnmatch("test/ext/test_*_file.tmp", "test/ext/test_ext_file.tmp"));
return Count(true);
}
bool TestExtFile::test_glob() {
f_touch("test/test_ext_file.tmp");
VS(f_glob("test/test_*_file.tmp"), CREATE_VECTOR1("test/test_ext_file.tmp"));
f_touch("test/ext/test_ext_file.tmp");
VS(f_glob("test/ext/test_*_file.tmp"), CREATE_VECTOR1("test/ext/test_ext_file.tmp"));
return Count(true);
}
@@ -732,137 +736,137 @@ bool TestExtFile::test_clearstatcache() {
}
bool TestExtFile::test_stat() {
VS(f_stat("test/test_ext_file.txt")[s_size], 17);
VS(f_stat("test/ext/test_ext_file.txt")[s_size], 17);
return Count(true);
}
bool TestExtFile::test_lstat() {
VS(f_lstat("test/test_ext_file.txt")[s_size], 17);
VS(f_lstat("test/ext/test_ext_file.txt")[s_size], 17);
return Count(true);
}
bool TestExtFile::test_is_dir() {
f_mkdir("test/tmp_dir");
VERIFY(!f_is_dir("test/test_ext_file.txt"));
VERIFY(f_is_dir("test/tmp_dir"));
f_mkdir("test/ext/tmp_dir");
VERIFY(!f_is_dir("test/ext/test_ext_file.txt"));
VERIFY(f_is_dir("test/ext/tmp_dir"));
VERIFY(!f_is_dir("tmp_dir"));
f_chdir("test");
VERIFY(!f_is_dir("test/tmp_dir"));
f_chdir("test/ext");
VERIFY(!f_is_dir("test/ext/tmp_dir"));
VERIFY(f_is_dir("tmp_dir"));
f_rmdir("test/tmp_dir");
f_chdir("..");
f_chdir("../..");
f_rmdir("test/ext/tmp_dir");
return Count(true);
}
bool TestExtFile::test_is_executable() {
VERIFY(f_chmod("test/test_ext_file.txt", 0777));
VERIFY(f_is_executable("test/test_ext_file.txt"));
VERIFY(f_chmod("test/ext/test_ext_file.txt", 0777));
VERIFY(f_is_executable("test/ext/test_ext_file.txt"));
return Count(true);
}
bool TestExtFile::test_is_file() {
VERIFY(f_is_file("test/test_ext_file.txt"));
VERIFY(f_is_file("test/ext/test_ext_file.txt"));
return Count(true);
}
bool TestExtFile::test_is_link() {
VERIFY(!f_is_link("test/test_ext_file.txt"));
VERIFY(!f_is_link("test/ext/test_ext_file.txt"));
return Count(true);
}
bool TestExtFile::test_is_readable() {
VERIFY(f_is_readable("test/test_ext_file.txt"));
VERIFY(f_is_readable("test/ext/test_ext_file.txt"));
return Count(true);
}
bool TestExtFile::test_is_uploaded_file() {
VS(f_is_uploaded_file("test/test_ext_file.txt"), false);
VS(f_is_uploaded_file("test/ext/test_ext_file.txt"), false);
return Count(true);
}
bool TestExtFile::test_is_writable() {
VERIFY(f_is_writable("test/test_ext_file.txt"));
VERIFY(f_is_writable("test/ext/test_ext_file.txt"));
return Count(true);
}
bool TestExtFile::test_is_writeable() {
VERIFY(f_is_writeable("test/test_ext_file.txt"));
VERIFY(f_is_writeable("test/ext/test_ext_file.txt"));
return Count(true);
}
bool TestExtFile::test_fileatime() {
VERIFY(more(f_fileatime("test/test_ext_file.txt"), 0));
VERIFY(more(f_fileatime("test/ext/test_ext_file.txt"), 0));
return Count(true);
}
bool TestExtFile::test_filectime() {
VERIFY(more(f_filectime("test/test_ext_file.txt"), 0));
VERIFY(more(f_filectime("test/ext/test_ext_file.txt"), 0));
return Count(true);
}
bool TestExtFile::test_filegroup() {
f_filegroup("test/test_ext_file.txt");
f_filegroup("test/ext/test_ext_file.txt");
return Count(true);
}
bool TestExtFile::test_fileinode() {
VERIFY(more(f_fileinode("test/test_ext_file.txt"), 0));
VERIFY(more(f_fileinode("test/ext/test_ext_file.txt"), 0));
return Count(true);
}
bool TestExtFile::test_filemtime() {
VERIFY(more(f_filemtime("test/test_ext_file.txt"), 0));
VERIFY(more(f_filemtime("test/ext/test_ext_file.txt"), 0));
return Count(true);
}
bool TestExtFile::test_fileowner() {
f_fileowner("test/test_ext_file.txt");
f_fileowner("test/ext/test_ext_file.txt");
return Count(true);
}
bool TestExtFile::test_fileperms() {
VERIFY(more(f_fileperms("test/test_ext_file.txt"), 0));
VERIFY(more(f_fileperms("test/ext/test_ext_file.txt"), 0));
return Count(true);
}
bool TestExtFile::test_filesize() {
VS(f_filesize("test/test_ext_file.txt"), 17);
VS(f_filesize("test/ext/test_ext_file.txt"), 17);
return Count(true);
}
bool TestExtFile::test_filetype() {
VS(f_filetype("test/test_ext_file.txt"), "file");
VS(f_filetype("test/ext/test_ext_file.txt"), "file");
return Count(true);
}
bool TestExtFile::test_readlink() {
if (f_file_exists("test/test_ext_file2.tmp")) {
f_unlink("test/test_ext_file2.tmp");
VERIFY(!f_file_exists("test/test_ext_file2.tmp"));
if (f_file_exists("test/ext/test_ext_file2.tmp")) {
f_unlink("test/ext/test_ext_file2.tmp");
VERIFY(!f_file_exists("test/ext/test_ext_file2.tmp"));
}
f_touch("test/test_ext_file.tmp");
f_symlink("test/test_ext_file.tmp", "test/test_ext_file2.tmp");
String resolved = f_readlink("test/test_ext_file2.tmp");
VS(resolved.substr(resolved.size() - 22), "test/test_ext_file.tmp");
f_touch("test/ext/test_ext_file.tmp");
f_symlink("test/ext/test_ext_file.tmp", "test/ext/test_ext_file2.tmp");
String resolved = f_readlink("test/ext/test_ext_file2.tmp");
VS(resolved.substr(resolved.size() - 26), "test/ext/test_ext_file.tmp");
return Count(true);
}
bool TestExtFile::test_realpath() {
f_touch("test/test_ext_file.tmp");
String resolved = f_realpath("test/test_ext_file.tmp");
f_touch("test/ext/test_ext_file.tmp");
String resolved = f_realpath("test/ext/test_ext_file.tmp");
VERIFY(resolved.size() > 22);
VS(resolved.substr(resolved.size() - 22), "test/test_ext_file.tmp");
VS(resolved.substr(resolved.size() - 26), "test/ext/test_ext_file.tmp");
return Count(true);
}
bool TestExtFile::test_linkinfo() {
if (f_file_exists("test/test_ext_file2.tmp")) {
f_unlink("test/test_ext_file2.tmp");
VERIFY(!f_file_exists("test/test_ext_file2.tmp"));
if (f_file_exists("test/ext/test_ext_file2.tmp")) {
f_unlink("test/ext/test_ext_file2.tmp");
VERIFY(!f_file_exists("test/ext/test_ext_file2.tmp"));
}
f_touch("test/test_ext_file.tmp");
f_symlink("test/test_ext_file.tmp", "test/test_ext_file2.tmp");
VERIFY(more(f_linkinfo("test/test_ext_file2.tmp"), 0));
f_touch("test/ext/test_ext_file.tmp");
f_symlink("test/ext/test_ext_file.tmp", "test/ext/test_ext_file2.tmp");
VERIFY(more(f_linkinfo("test/ext/test_ext_file2.tmp"), 0));
return Count(true);
}
@@ -882,10 +886,10 @@ bool TestExtFile::test_disk_total_space() {
}
bool TestExtFile::test_pathinfo() {
VS(f_print_r(f_pathinfo("test/test_ext_file.txt"), true),
VS(f_print_r(f_pathinfo("test/ext/test_ext_file.txt"), true),
"Array\n"
"(\n"
" [dirname] => test\n"
" [dirname] => test/ext\n"
" [basename] => test_ext_file.txt\n"
" [extension] => txt\n"
" [filename] => test_ext_file\n"
@@ -894,19 +898,19 @@ bool TestExtFile::test_pathinfo() {
}
bool TestExtFile::test_mkdir() {
f_mkdir("test/tmp_dir");
f_rmdir("test/tmp_dir");
f_mkdir("test/ext/tmp_dir");
f_rmdir("test/ext/tmp_dir");
return Count(true);
}
bool TestExtFile::test_rmdir() {
f_mkdir("test/tmp_dir");
f_rmdir("test/tmp_dir");
f_mkdir("test/ext/tmp_dir");
f_rmdir("test/ext/tmp_dir");
return Count(true);
}
bool TestExtFile::test_dirname() {
VS(f_dirname("test/test_ext_file.txt"), "test");
VS(f_dirname("test/ext/test_ext_file.txt"), "test/ext");
return Count(true);
}
@@ -923,10 +927,9 @@ bool TestExtFile::test_chroot() {
bool TestExtFile::test_dir() {
static const StaticString s_handle("handle");
static const StaticString s_test_ext_file_txt("test_ext_file.txt");
static const StaticString s_path("path");
Variant d = f_dir("test");
VS(d.toArray()[s_path], "test");
Variant d = f_dir("test/ext");
VS(d.toArray()[s_path], "test/ext");
Variant entry;
bool seen = false;
while (!same(entry = f_readdir(d.toArray()[s_handle]), false)) {
@@ -945,7 +948,7 @@ bool TestExtFile::test_getcwd() {
}
bool TestExtFile::test_opendir() {
Variant d = f_opendir("test");
Variant d = f_opendir("test/ext");
Variant entry;
bool seen = false;
while (!same(entry = f_readdir(d), false)) {
@@ -959,7 +962,7 @@ bool TestExtFile::test_opendir() {
}
bool TestExtFile::test_readdir() {
Variant d = f_opendir("test");
Variant d = f_opendir("test/ext");
Variant entry;
bool seen = false;
while (!same(entry = f_readdir(d), false)) {
@@ -973,7 +976,7 @@ bool TestExtFile::test_readdir() {
}
bool TestExtFile::test_rewinddir() {
Variant d = f_opendir("test");
Variant d = f_opendir("test/ext");
Variant entry;
bool seen = false;
while (!same(entry = f_readdir(d), false)) {
+2 -2
Ver Arquivo
@@ -143,7 +143,7 @@ bool TestExtHash::test_hash_init() {
}
bool TestExtHash::test_hash_file() {
VS(f_hash_file("md5", "test/test_hash_file.txt"),
VS(f_hash_file("md5", "test/ext/test_hash_file.txt"),
"5c6ffbdd40d9556b73a21e63c3e0e904");
return Count(true);
}
@@ -153,7 +153,7 @@ bool TestExtHash::test_hash_final() {
}
bool TestExtHash::test_hash_hmac_file() {
VS(f_hash_hmac_file("md5", "test/test_hash_file.txt", "secret"),
VS(f_hash_hmac_file("md5", "test/ext/test_hash_file.txt", "secret"),
"7eb2b5c37443418fc77c136dd20e859c");
return Count(true);
}
+34 -29
Ver Arquivo
@@ -57,19 +57,20 @@ bool TestExtImagesprite::test_ImageSprite() {
}
bool TestExtImagesprite::test_addFile() {
sprite->t_addfile("test/images/php.gif");
std::string path = "test/slow/ext_image/images";
sprite->t_addfile(path+"/php.gif");
VS((int) sprite->m_image_data.size(), 1);
VS(sprite->m_image_data["test/images/php.gif"] == nullptr, false);
VS(sprite->m_image_data[path+"/php.gif"] == nullptr, false);
VS(sprite->m_img_errors.size(), 0);
sprite->t_addfile("test/images/php.gif");
sprite->t_addfile(path+"/php.gif");
VS((int) sprite->m_image_data.size(), 1);
VS(sprite->m_image_data["test/images/php.gif"] == nullptr, false);
VS(sprite->m_image_data[path+"/php.gif"] == nullptr, false);
VS(sprite->m_img_errors.size(), 0);
sprite->t_addfile("test/images/246x247.png");
sprite->t_addfile(path+"/246x247.png");
VS((int) sprite->m_image_data.size(), 2);
VS(sprite->m_image_data["test/images/php.gif"] == nullptr, false);
VS(sprite->m_image_data[path+"/php.gif"] == nullptr, false);
VS(sprite->m_img_errors.size(), 0);
sprite->t_loadimages(true);
@@ -157,20 +158,21 @@ bool TestExtImagesprite::test_addUrl() {
return Count(true);
}
bool TestExtImagesprite::test_clear() {
std::string path = "test/slow/ext_image/images";
VS((int) sprite->m_image_data.size(), 0);
sprite->t_addfile("test/images/php.gif");
sprite->t_addfile(path+"/php.gif");
VS((int) sprite->m_image_data.size(), 1);
sprite->t_clear("test/images/php.gif");
sprite->t_clear(path+"/php.gif");
VS((int) sprite->m_image_data.size(), 0);
sprite->t_addfile("test/images/php.gif");
sprite->t_addfile("test/images/246x247.png");
sprite->t_addfile(path+"/php.gif");
sprite->t_addfile(path+"/246x247.png");
VS((int) sprite->m_image_data.size(), 2);
sprite->t_clear("test/images/php.gif");
sprite->t_clear(path+"/php.gif");
VS((int) sprite->m_image_data.size(), 1);
sprite->t_addfile("test/images/php.gif");
sprite->t_addfile(path+"/php.gif");
sprite->t_clear();
VS((int) sprite->m_image_data.size(), 0);
@@ -182,21 +184,22 @@ static const StaticString
s_height("height");
bool TestExtImagesprite::test_loadDims() {
sprite->t_addfile("test/images/php.gif");
std::string path = "test/slow/ext_image/images";
sprite->t_addfile(path+"/php.gif");
sprite->t_loaddims(true);
VS(sprite->m_image_data["test/images/php.gif"]->m_width, 120);
VS(sprite->m_image_data["test/images/php.gif"]->m_height, 67);
VS(sprite->m_image_data["test/images/php.gif"]->m_image == nullptr, false);
VS(sprite->m_image_data[path+"/php.gif"]->m_width, 120);
VS(sprite->m_image_data[path+"/php.gif"]->m_height, 67);
VS(sprite->m_image_data[path+"/php.gif"]->m_image == nullptr, false);
sprite->t_clear();
Array dims = Array::Create();
dims.set(s_width, 1);
dims.set(s_height, 1);
sprite->t_addfile("test/images/php.gif", dims);
sprite->t_addfile(path+"/php.gif", dims);
sprite->t_loaddims(true);
VS(sprite->m_image_data["test/images/php.gif"]->m_width, 1);
VS(sprite->m_image_data["test/images/php.gif"]->m_height, 1);
VS(sprite->m_image_data["test/images/php.gif"]->m_image == nullptr, true);
VS(sprite->m_image_data[path+"/php.gif"]->m_width, 1);
VS(sprite->m_image_data[path+"/php.gif"]->m_height, 1);
VS(sprite->m_image_data[path+"/php.gif"]->m_image == nullptr, true);
sprite->t_clear();
sprite->t_addurl("http://www.facebook.com/images/icons/like.png", -1, dims);
@@ -217,21 +220,22 @@ bool TestExtImagesprite::test_loadDims() {
return Count(true);
}
bool TestExtImagesprite::test_loadImages() {
sprite->t_addfile("test/images/php.gif");
std::string path = "test/slow/ext_image/images";
sprite->t_addfile(path+"/php.gif");
sprite->t_loadimages(true);
VS(sprite->m_image_data["test/images/php.gif"]->m_width, 120);
VS(sprite->m_image_data["test/images/php.gif"]->m_height, 67);
VS(sprite->m_image_data["test/images/php.gif"]->m_image == nullptr, false);
VS(sprite->m_image_data[path+"/php.gif"]->m_width, 120);
VS(sprite->m_image_data[path+"/php.gif"]->m_height, 67);
VS(sprite->m_image_data[path+"/php.gif"]->m_image == nullptr, false);
sprite->t_clear();
Array dims = Array::Create();
dims.set(s_width, 1);
dims.set(s_height, 1);
sprite->t_addfile("test/images/php.gif", dims);
sprite->t_addfile(path+"/php.gif", dims);
sprite->t_loadimages(true);
VS(sprite->m_image_data["test/images/php.gif"]->m_width, 120);
VS(sprite->m_image_data["test/images/php.gif"]->m_height, 67);
VS(sprite->m_image_data["test/images/php.gif"]->m_image == nullptr, false);
VS(sprite->m_image_data[path+"/php.gif"]->m_width, 120);
VS(sprite->m_image_data[path+"/php.gif"]->m_height, 67);
VS(sprite->m_image_data[path+"/php.gif"]->m_image == nullptr, false);
// XXX disabled until we work out flaky network issues. t2183444
#if 0
@@ -255,13 +259,14 @@ bool TestExtImagesprite::test_loadImages() {
return Count(true);
}
bool TestExtImagesprite::test_map() {
std::string path = "test/slow/ext_image/images";
static const StaticString
s_images("images"),
s_width("width"),
s_height("height"),
s_x("x"),
s_y("y"),
testpath("test/images/php.gif");
testpath(path+"/php.gif");
sprite->t_addfile(testpath);
VS(sprite->m_current, false);
+1 -1
Ver Arquivo
@@ -17,7 +17,7 @@
#include "hphp/test/ext/test_ext_memcached.h"
#include "hphp/runtime/ext/ext_memcached.h"
#include "hphp/runtime/ext/ext_options.h"
#include "hphp/test/test_memcached_info.inc"
#include "hphp/test/ext/test_memcached_info.inc"
IMPLEMENT_SEP_EXTENSION_TEST(Memcached);
///////////////////////////////////////////////////////////////////////////////
+9 -9
Ver Arquivo
@@ -322,7 +322,7 @@ bool TestExtOpenssl::test_openssl_pkey_export() {
}
bool TestExtOpenssl::test_openssl_pkey_free() {
Variant fkey = f_file_get_contents("test/test_public.pem");
Variant fkey = f_file_get_contents("test/ext/test_public.pem");
Variant k = f_openssl_pkey_get_public(fkey);
VERIFY(!same(k, false));
VERIFY(!k.isNull());
@@ -333,14 +333,14 @@ bool TestExtOpenssl::test_openssl_pkey_free() {
bool TestExtOpenssl::test_openssl_pkey_get_details() {
static const StaticString s_bits("bits");
{
Variant fkey = f_file_get_contents("test/test_public.pem");
Variant fkey = f_file_get_contents("test/ext/test_public.pem");
Variant k = f_openssl_pkey_get_public(fkey);
VERIFY(!same(k, false));
VERIFY(!k.isNull());
VS(f_openssl_pkey_get_details(k)[s_bits], 1024);
}
{
Variant fkey = f_file_get_contents("test/test_private.pem");
Variant fkey = f_file_get_contents("test/ext/test_private.pem");
Variant k = f_openssl_pkey_get_private(fkey);
VERIFY(!same(k, false));
VERIFY(!k.isNull());
@@ -474,7 +474,7 @@ bool TestExtOpenssl::test_openssl_x509_check_private_key() {
}
bool TestExtOpenssl::test_openssl_x509_checkpurpose() {
Variant fcert = f_file_get_contents("test/test_x509.crt");
Variant fcert = f_file_get_contents("test/ext/test_x509.crt");
Variant cert = f_openssl_x509_read(fcert);
VS(f_openssl_x509_checkpurpose(cert, k_X509_PURPOSE_SSL_CLIENT), 0);
VS(f_openssl_x509_checkpurpose(cert, k_X509_PURPOSE_SSL_SERVER), 0);
@@ -482,7 +482,7 @@ bool TestExtOpenssl::test_openssl_x509_checkpurpose() {
}
bool TestExtOpenssl::test_openssl_x509_export_to_file() {
Variant fcert = f_file_get_contents("test/test_x509.crt");
Variant fcert = f_file_get_contents("test/ext/test_x509.crt");
Variant cert = f_openssl_x509_read(fcert);
const char *tmp = "test/test_x509.tmp";
@@ -500,7 +500,7 @@ bool TestExtOpenssl::test_openssl_x509_export_to_file() {
}
bool TestExtOpenssl::test_openssl_x509_export() {
Variant fcert = f_file_get_contents("test/test_x509.crt");
Variant fcert = f_file_get_contents("test/ext/test_x509.crt");
Variant cert = f_openssl_x509_read(fcert);
Variant out;
VERIFY(f_openssl_x509_export(cert, ref(out)));
@@ -511,7 +511,7 @@ bool TestExtOpenssl::test_openssl_x509_export() {
}
bool TestExtOpenssl::test_openssl_x509_free() {
Variant fcert = f_file_get_contents("test/test_x509.crt");
Variant fcert = f_file_get_contents("test/ext/test_x509.crt");
Variant cert = f_openssl_x509_read(fcert);
VERIFY(!cert.toObject().isNull());
f_openssl_x509_free(cert);
@@ -519,7 +519,7 @@ bool TestExtOpenssl::test_openssl_x509_free() {
}
bool TestExtOpenssl::test_openssl_x509_parse() {
Variant fcert = f_file_get_contents("test/test_x509.crt");
Variant fcert = f_file_get_contents("test/ext/test_x509.crt");
Variant cert = f_openssl_x509_read(fcert);
Variant info = f_openssl_x509_parse(cert);
VS(info[s_subject][s_O], "RSA Data Security, Inc.");
@@ -527,7 +527,7 @@ bool TestExtOpenssl::test_openssl_x509_parse() {
}
bool TestExtOpenssl::test_openssl_x509_read() {
Variant fcert = f_file_get_contents("test/test_x509.crt");
Variant fcert = f_file_get_contents("test/ext/test_x509.crt");
Variant cert = f_openssl_x509_read(fcert);
VERIFY(!cert.toObject().isNull());
return Count(true);
+1 -1
Ver Arquivo
@@ -97,7 +97,7 @@ bool TestExtProcess::test_pcntl_alarm() {
bool TestExtProcess::test_pcntl_exec() {
f_pcntl_exec("/bin/sh",
CREATE_VECTOR1("test/test_pcntl_exec.sh"),
CREATE_VECTOR1("test/ext/test_pcntl_exec.sh"),
CREATE_MAP1("name", "value"));
return Count(true);
}
+2 -2
Ver Arquivo
@@ -28,7 +28,7 @@ bool TestExtServer::RunTests(const std::string &which) {
DECLARE_TEST_FUNCTIONS("");
std::string root = std::string(f_getcwd().toString().c_str()) + "/test/";
std::string root = std::string(f_getcwd().toString().c_str()) + "/test/ext/";
RuntimeOption::SourceRoot = root;
RuntimeOption::PageletServerThreadCount = 10;
@@ -78,7 +78,7 @@ bool TestExtServer::test_pagelet_server_task_status() {
bool TestExtServer::test_pagelet_server_task_result() {
const int TEST_SIZE = 20;
String baseurl("pageletserver?getparam=");
String baseurl("ext/pageletserver?getparam=");
String baseheader("MyHeader: ");
String basepost("postparam=");
+8 -8
Ver Arquivo
@@ -124,7 +124,7 @@ bool TestExtStream::test_stream_context_set_param() {
}
bool TestExtStream::test_stream_copy_to_stream() {
Variant src = f_fopen("test/test_ext_file.txt", "r");
Variant src = f_fopen("test/ext/test_ext_file.txt", "r");
Variant dest = f_fopen("test/test_ext_file.tmp", "w");
f_stream_copy_to_stream(src, dest);
f_fclose(dest);
@@ -217,7 +217,7 @@ bool TestExtStream::test_stream_filter_prepend() {
bool TestExtStream::test_stream_get_contents() {
{
Variant f = f_fopen("test/test_ext_file.txt", "r");
Variant f = f_fopen("test/ext/test_ext_file.txt", "r");
VS(f_stream_get_contents(f), "Testing Ext File\n");
}
@@ -250,7 +250,7 @@ bool TestExtStream::test_stream_get_filters() {
bool TestExtStream::test_stream_get_line() {
{
Variant f = f_fopen("test/test_ext_file.txt", "r");
Variant f = f_fopen("test/ext/test_ext_file.txt", "r");
VS(f_stream_get_line(f), "Testing Ext File\n");
}
@@ -328,28 +328,28 @@ bool TestExtStream::test_stream_resolve_include_path() {
String old_include_path = f_get_include_path();
f_set_include_path(".:test/");
String filename = f_getcwd();
filename += "/test/test_ext_file.txt";
VS(filename, f_stream_resolve_include_path("test_ext_file.txt"));
filename += "/test/ext/test_ext_file.txt";
VS(filename, f_stream_resolve_include_path("ext/test_ext_file.txt"));
VS(uninit_null(), f_stream_resolve_include_path("some-nonexistant-file.ext"));
f_set_include_path(old_include_path);
return Count(true);
}
bool TestExtStream::test_stream_select() {
Variant f = f_fopen("test/test_ext_file.txt", "r");
Variant f = f_fopen("test/ext/test_ext_file.txt", "r");
Variant reads = CREATE_VECTOR1(f);
VERIFY(!same(f_stream_select(ref(reads), uninit_null(), uninit_null(), 0, 0), false));
return Count(true);
}
bool TestExtStream::test_stream_set_blocking() {
Variant f = f_fopen("test/test_ext_file.txt", "r");
Variant f = f_fopen("test/ext/test_ext_file.txt", "r");
VERIFY(f_stream_set_blocking(f, 0));
return Count(true);
}
bool TestExtStream::test_stream_set_timeout() {
Variant f = f_fopen("test/test_ext_file.txt", "r");
Variant f = f_fopen("test/ext/test_ext_file.txt", "r");
f_stream_set_timeout(f, 0);
return Count(true);
}
+1 -1
Ver Arquivo
@@ -144,7 +144,7 @@ void TestServer::RunServer() {
string fd = lexical_cast<string>(inherit_fd);
const char *argv[] = {
"", "--mode=server", "--config=test/config-server.hdf",
"", "--mode=server", "--config=test/ext/config-server.hdf",
portConfig.c_str(), adminConfig.c_str(), rpcConfig.c_str(),
"--port-fd", fd.c_str(),
NULL
-19
Ver Arquivo
@@ -1,19 +0,0 @@
#!/bin/env php
<?php
chdir(__DIR__.'/../../');
include_once __DIR__.'/fbmake_test_lib.php';
$cmd = "FBMAKE_BIN_ROOT=$argv[1] " .
"./hphp/tools/run_test_binary.sh '$argv[2]' '$argv[3]' '$argv[4]' ".
"2>/dev/null";
loop_tests($cmd, function ($line) {
if (preg_match('/^(Test[a-zA-Z]*)\.\.\.\.\.\.$/', $line, $m)) {
start($m[1]);
} else if (preg_match('/^Test[a-zA-Z]* (OK|\#\#\#\#\#\>\>\> FAILED)/',
$line,
$m)) {
finish($m[1] == 'OK' ? 'passed' : 'failed');
}
});
-279
Ver Arquivo
@@ -1,279 +0,0 @@
/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
/*
This file generates a very large .php file.
The php file has a comparison for every possible combination of each of the
~70 different VARS (as either a constant-propagateable or indeterminate value)
and each of the 9 different OPS. This totals O(200k) different tests.
The php file, when run, generates O(1000000) lines of output.
Zend runs this file in a few seconds.
Now that each test is in its own function, hhvm with Jit can run in 8 minutes.
*/
#include <iostream>
#include <string>
using namespace std;
string OPS[] = {
// http://www.php.net/manual/en/language.operators.comparison.php
"==",
"===",
"!=",
"<>",
"!==",
"<",
">",
"<=",
">=",
};
int numOPS = sizeof(OPS) / sizeof(string);
string VARS[] = {
// NULL
"NULL",
// bool
"true",
"false",
// int
"0",
"1",
"123",
"-1",
"-123",
"7000",
"123456789123456",
"123456789123456789123456789", // overflow
"456",
// double
"0.0",
"0.00",
"-0.0",
"1.0",
"-1.00000",
"122.9",
"123.1",
"-122.9",
"-123.1",
"7e3",
"7e+3",
"123456789123456.0",
"123456789123456789123456789.0",
"741.258",
// resource
"curl_init()",
// object
"new O0()",
"new O1(0)",
"new O1(1)",
"new O2(0)",
"new O2(1)",
"new O3(0, 0)",
"new O3(0, 1)",
"new O3(1, 0)",
"new O3(1, 1)",
"new S1('php')",
"new S1('1')",
"new S1('-1garbage')",
// array
"array()",
"array(0 => '0')",
"array(0 => '1')",
"array('0' => '0')",
"array('php' => '0')",
"array(0 => 0, 1 => 1)",
"array(0 => 1, 1 => 0)",
"array(0 => 2, 1 => 2)",
// string
"''",
"'0'",
"'0.0'",
"'0.00'",
"'-0'",
"'-0.0'",
"'false'",
"'true'",
"'1'",
"'1.0'",
"'-1'",
"'123'",
"'123.1'",
"'123q'",
"'123456789123456789'",
"'123456789123456789123456789'",
"'null'",
"'NULL'",
"'7000'",
"'7e3'",
"'7.0E3'",
"'7000.0'",
"'php'",
"'elephant'",
"'electron'",
};
int numVARS = sizeof(VARS) / sizeof(string);
string prolog(
"<?php\n\n"
// helpers
"function id($x) { return $x; }\n\n"
// Pretty printers
"function prettyCC($x, $op, $y, $res) {\n"
" print \"--------------------\\n\";\n"
" print \"$x $op $y\\n\";\n"
" if ($res) { print \"true\\n\"; } else { print \"false\\n\"; }\n"
"}\n\n"
"function prettyCN($x, $op, $y, $res) {\n"
" print \"--------------------\\n\";\n"
" print \"$x $op \\$y\\n\";\n"
" print \"\\$y = \";\n"
" var_dump($y);\n"
" if ($res) { print \"true\\n\"; } else { print \"false\\n\"; }\n"
"}\n\n"
"function prettyNC($x, $op, $y, $res) {\n"
" print \"--------------------\\n\";\n"
" print \"\\$x $op $y\\n\";\n"
" print \"\\$x = \";\n"
" var_dump($x);\n"
" if ($res) { print \"true\\n\"; } else { print \"false\\n\"; }\n"
"}\n\n"
"function prettyNN($x, $op, $y, $res) {\n"
" print \"--------------------\\n\";\n"
" print \"\\$x $op \\$y\\n\";\n"
" print \"\\$x = \";\n"
" var_dump($x);\n"
" print \"\\$y = \";\n"
" var_dump($y);\n"
" if ($res) { print \"true\\n\"; } else { print \"false\\n\"; }\n"
"}\n\n"
// Classes
"class O0 {}\n\n"
"class O1 {\n"
" public $x;\n"
" function __construct($a) {\n"
" $this->x = $a;\n"
" }\n"
"}\n\n"
"class O2 {\n"
" public $y;\n"
" function __construct($a) {\n"
" $this->y = $a;\n"
" }\n"
"}\n\n"
"class O3 {\n"
" public $x;\n"
" private $y;\n"
" function __construct($a, $b) {\n"
" $this->x = $a;\n"
" $this->y = $b;\n"
" }\n"
"}\n\n"
"class S1 {\n"
" private $x;\n"
" function __construct($a) {\n"
" $this->x = $a;\n"
" }\n"
" function __toString() {\n"
" return $this->x;\n"
" }\n"
"}\n\n"
);
int main() {
cout << prolog;
for (int j = 0; j < numOPS; ++j) {
for (int i1 = 0; i1 < numVARS; ++i1) {
for (int i2 = 0; i2 < numVARS; ++i2) {
// each test is in its own function
cout << "function foo_" << j << "_" << i1 << "_" << i2 << "() {\n";
// generate the variables required for that test
cout << " # create variables\n";
cout << " $c" << i1 << " = " << VARS[i1] << ";\n";
cout << " $x" << i1 << " = id($c" << i1 << ");\n";
if (i2 != i1) {
cout << " $c" << i2 << " = " << VARS[i2] << ";\n";
cout << " $x" << i2 << " = id($c" << i2 << ");\n";
}
cout << "\n";
// pretty print the test results
// pass strings into the C's, for proper printing
cout << " # " << VARS[i1] << " " << OPS[j] << " " << VARS[i2]
<< " --- " << i1 << ", " << j << ", " << i2 << "\n";
cout << " prettyCC("
<< "\"" << VARS[i1] << "\", "
<< "\"" << OPS[j] << "\", "
<< "\"" << VARS[i2] << "\", "
<< "$c" << i1 << " " << OPS[j] << " $c" << i2
<< ");\n";
cout << " prettyCN("
<< "\"" << VARS[i1] << "\", "
<< "\"" << OPS[j] << "\", "
<< "$x" << i2 << ", "
<< "$c" << i1 << " " << OPS[j] << " $x" << i2
<< ");\n";
cout << " prettyNC("
<< "$x" << i1 << ", "
<< "\"" << OPS[j] << "\", "
<< "\"" << VARS[i2] << "\", "
<< "$x" << i1 << " " << OPS[j] << " $c" << i2
<< ");\n";
cout << " prettyNN("
<< "$x" << i1 << ", "
<< "\"" << OPS[j] << "\", "
<< "$x" << i2 << ", "
<< "$x" << i1 << " " << OPS[j] << " $x" << i2
<< ");\n";
// close and call the function
cout << "}\n";
cout << "foo_" << j << "_" << i1 << "_" << i2 << "();\n";
}
}
}
return 0;
}
+1 -1
Ver Arquivo
@@ -1,6 +1,6 @@
<?php
$image = imagecreatefromgif(__DIR__.'/../../images/php.gif');
$image = imagecreatefromgif(__DIR__.'/images/php.gif');
$emboss = array(array(2, 0, 0), array(0, -1, 0), array(0, 0, -1));
imageconvolution($image, $emboss, 1, 127);
header('Content-Type: image/png');
+1 -1
Ver Arquivo
@@ -1,7 +1,7 @@
<?php
// Create an image instance
$im = imagecreatefromgif(__DIR__.'/../../images/php.gif');
$im = imagecreatefromgif(__DIR__.'/images/php.gif');
// Enable interlancing
imageinterlace($im, true);
// Save the interfaced image
+12 -12
Ver Arquivo
@@ -1,25 +1,25 @@
<?php
touch(__DIR__.'/../../images/246x247.png', 1234567890);
$exif = exif_read_data(__DIR__.'/../../images/246x247.png');
touch(__DIR__.'/images/246x247.png', 1234567890);
$exif = exif_read_data(__DIR__.'/images/246x247.png');
print_r($exif);
touch(__DIR__.'/../../images/php.gif', 1234567890);
$exif = exif_read_data(__DIR__.'/../../images/php.gif');
touch(__DIR__.'/images/php.gif', 1234567890);
$exif = exif_read_data(__DIR__.'/images/php.gif');
print_r($exif);
touch(__DIR__.'/../../images/simpletext.jpg', 1234567890);
$exif = exif_read_data(__DIR__.'/../../images/simpletext.jpg');
touch(__DIR__.'/images/simpletext.jpg', 1234567890);
$exif = exif_read_data(__DIR__.'/images/simpletext.jpg');
print_r($exif);
touch(__DIR__.'/../../images/smile.happy.png', 1234567890);
$exif = exif_read_data(__DIR__.'/../../images/smile.happy.png');
touch(__DIR__.'/images/smile.happy.png', 1234567890);
$exif = exif_read_data(__DIR__.'/images/smile.happy.png');
print_r($exif);
touch(__DIR__.'/../../images/test1pix.jpg', 1234567890);
$exif = exif_read_data(__DIR__.'/../../images/test1pix.jpg');
touch(__DIR__.'/images/test1pix.jpg', 1234567890);
$exif = exif_read_data(__DIR__.'/images/test1pix.jpg');
print_r($exif);
touch(__DIR__.'/../../images/test2.jpg', 1234567890);
$exif = exif_read_data(__DIR__.'/../../images/test2.jpg');
touch(__DIR__.'/images/test2.jpg', 1234567890);
$exif = exif_read_data(__DIR__.'/images/test2.jpg');
print_r($exif);

Antes

Largura:  |  Altura:  |  Tamanho: 360 B

Depois

Largura:  |  Altura:  |  Tamanho: 360 B

Antes

Largura:  |  Altura:  |  Tamanho: 2.5 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 2.5 KiB

Antes

Largura:  |  Altura:  |  Tamanho: 1.3 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 1.3 KiB

Antes

Largura:  |  Altura:  |  Tamanho: 150 B

Depois

Largura:  |  Altura:  |  Tamanho: 150 B

Antes

Largura:  |  Altura:  |  Tamanho: 523 B

Depois

Largura:  |  Altura:  |  Tamanho: 523 B

Antes

Largura:  |  Altura:  |  Tamanho: 119 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 119 KiB

Arquivo binário não exibido.
-91
Ver Arquivo
@@ -1,91 +0,0 @@
/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
/* Generated by idl_list.php. Do NOT modify. */
#ifndef incl_EXT_LIST_TEST_EXT_H_
#define incl_EXT_LIST_TEST_EXT_H_
#include "hphp/test/test_ext_apache.h"
#include "hphp/test/test_ext_apc.h"
#include "hphp/test/test_ext_apd.h"
#include "hphp/test/test_ext_array.h"
#include "hphp/test/test_ext_asio.h"
#include "hphp/test/test_ext_bcmath.h"
#include "hphp/test/test_ext_bzip2.h"
#include "hphp/test/test_ext_class.h"
#include "hphp/test/test_ext_closure.h"
#include "hphp/test/test_ext_collections.h"
#include "hphp/test/test_ext_continuation.h"
#include "hphp/test/test_ext_ctype.h"
#include "hphp/test/test_ext_curl.h"
#include "hphp/test/test_ext_datetime.h"
#include "hphp/test/test_ext_debugger.h"
#include "hphp/test/test_ext_domdocument.h"
#include "hphp/test/test_ext_error.h"
#include "hphp/test/test_ext_fb.h"
#include "hphp/test/test_ext_file.h"
#include "hphp/test/test_ext_function.h"
#include "hphp/test/test_ext_hash.h"
#include "hphp/test/test_ext_iconv.h"
#include "hphp/test/test_ext_icu.h"
#include "hphp/test/test_ext_icu_ucnv.h"
#include "hphp/test/test_ext_icu_ucsdet.h"
#include "hphp/test/test_ext_icu_uspoof.h"
#include "hphp/test/test_ext_image.h"
#include "hphp/test/test_ext_imagesprite.h"
#include "hphp/test/test_ext_imap.h"
#include "hphp/test/test_ext_intl.h"
#include "hphp/test/test_ext_ipc.h"
#include "hphp/test/test_ext_json.h"
#include "hphp/test/test_ext_ldap.h"
#include "hphp/test/test_ext_magick.h"
#include "hphp/test/test_ext_mailparse.h"
#include "hphp/test/test_ext_math.h"
#include "hphp/test/test_ext_mb.h"
#include "hphp/test/test_ext_mcrypt.h"
#include "hphp/test/test_ext_memcache.h"
#include "hphp/test/test_ext_memcached.h"
#include "hphp/test/test_ext_misc.h"
#include "hphp/test/test_ext_mysql.h"
#include "hphp/test/test_ext_network.h"
#include "hphp/test/test_ext_openssl.h"
#include "hphp/test/test_ext_options.h"
#include "hphp/test/test_ext_output.h"
#include "hphp/test/test_ext_pdo.h"
#include "hphp/test/test_ext_posix.h"
#include "hphp/test/test_ext_preg.h"
#include "hphp/test/test_ext_process.h"
#include "hphp/test/test_ext_reflection.h"
#include "hphp/test/test_ext_server.h"
#include "hphp/test/test_ext_session.h"
#include "hphp/test/test_ext_simplexml.h"
#include "hphp/test/test_ext_soap.h"
#include "hphp/test/test_ext_socket.h"
#include "hphp/test/test_ext_spl.h"
#include "hphp/test/test_ext_sqlite3.h"
#include "hphp/test/test_ext_stream.h"
#include "hphp/test/test_ext_string.h"
#include "hphp/test/test_ext_thread.h"
#include "hphp/test/test_ext_thrift.h"
#include "hphp/test/test_ext_url.h"
#include "hphp/test/test_ext_variable.h"
#include "hphp/test/test_ext_xml.h"
#include "hphp/test/test_ext_xmlreader.h"
#include "hphp/test/test_ext_xmlwriter.h"
#include "hphp/test/test_ext_zlib.h"
#endif // incl_EXT_LIST_TEST_EXT_H_
+75
Ver Arquivo
@@ -0,0 +1,75 @@
#!/bin/env php
<?php
/*
* Small utilities for wrapping tests to put output into fbmake.
*
* See hphp/hhvm/fbmake_test_ext_wrapper.php.
*/
// Output is in the format expected by JsonTestRunner.
function say($val) {
fwrite(STDERR, json_encode($val, JSON_UNESCAPED_SLASHES) . "\n");
}
// Currently running test, and the results of each test.
$results = array();
$current = '';
function finish($status) {
global $results;
global $current;
say(array('op' => 'test_done',
'test' => $current,
'details' => '',
'status' => $status));
array_push($results, array('name' => $current,
'status' => $status));
$current = '';
}
function start($test) {
global $current;
$current = $test;
say(array('op' => 'start',
'test' => $current));
}
function test_is_running() {
return $GLOBALS['current'] != '';
}
function loop_tests($cmd, $line_func) {
global $results;
$ftest = popen($cmd, 'r');
if (!$ftest) {
echo "Couldn't run test script\n";
exit(1);
}
while (!feof($ftest)) {
$line = fgets($ftest);
$line_func($line);
}
say(array('op' => 'all_done',
'results' => $results));
fclose($ftest);
}
chdir(__DIR__.'/../../../');
$cmd = "FBMAKE_BIN_ROOT=$argv[1] " .
"./hphp/tools/run_test_binary.sh '$argv[2]' '$argv[3]' '$argv[4]' ".
"2>/dev/null";
loop_tests($cmd, function ($line) {
if (preg_match('/^(Test[a-zA-Z]*)\.\.\.\.\.\.$/', $line, $m)) {
start($m[1]);
} else if (preg_match('/^Test[a-zA-Z]* (OK|\#\#\#\#\#\>\>\> FAILED)/',
$line,
$m)) {
finish($m[1] == 'OK' ? 'passed' : 'failed');
}
});