From b264783d637ee3512da1d92107297741671dbb3b Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Wed, 4 Jun 2014 02:18:39 +0200 Subject: [PATCH] Merge sapi/phpdbg into PHP-5.6 --- phpdbg.c | 6 +++--- tests/commands/0002_set.test | 2 -- tests/commands/0103_register.test | 10 +++++----- tests/commands/0106_compile.test | 1 - tests/run-tests.php | 28 ++++++++++++++++++++-------- 5 files changed, 28 insertions(+), 19 deletions(-) diff --git a/phpdbg.c b/phpdbg.c index 0239e692b4..93fdbd7424 100644 --- a/phpdbg.c +++ b/phpdbg.c @@ -159,8 +159,6 @@ static PHP_RINIT_FUNCTION(phpdbg) /* {{{ */ zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], 8, NULL, php_phpdbg_destroy_bp_condition, 0); zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_MAP], 8, NULL, NULL, 0); - phpdbg_setup_watchpoints(TSRMLS_C); - zend_hash_init(&PHPDBG_G(seek), 8, NULL, NULL, 0); zend_hash_init(&PHPDBG_G(registered), 8, NULL, php_phpdbg_destroy_registered, 0); @@ -1256,10 +1254,12 @@ phpdbg_main: mm_heap->use_zend_alloc = 0; } + zend_activate(TSRMLS_C); + PHPDBG_G(original_free_function) = mm_heap->_free; mm_heap->_free = phpdbg_watch_efree; - zend_activate(TSRMLS_C); + phpdbg_setup_watchpoints(TSRMLS_C); #if defined(ZEND_SIGNALS) && !defined(_WIN32) zend_try { diff --git a/tests/commands/0002_set.test b/tests/commands/0002_set.test index 7720f94fff..468ac6d9ea 100644 --- a/tests/commands/0002_set.test +++ b/tests/commands/0002_set.test @@ -9,7 +9,6 @@ # setting notice color # Failed to find breakpoint #0 # oplog disabled -# not enabled # opened oplog test.log # nothing ################################################# @@ -19,5 +18,4 @@ set color notice none set prompt promot> set break 0 set oplog -set oplog 0 set oplog test.log diff --git a/tests/commands/0103_register.test b/tests/commands/0103_register.test index 38841591ca..703a12f771 100644 --- a/tests/commands/0103_register.test +++ b/tests/commands/0103_register.test @@ -7,15 +7,15 @@ #[Registered test_function] #array(5) { # [0]=> -# string(1) "1" +# int(1) # [1]=> -# string(1) "2" +# int(2) # [2]=> -# string(1) "3" +# int(3) # [3]=> -# string(1) "4" +# int(4) # [4]=> -# string(1) "5" +# int(5) #} ################################################# <: diff --git a/tests/commands/0106_compile.test b/tests/commands/0106_compile.test index d79211ddf7..7193600ea3 100644 --- a/tests/commands/0106_compile.test +++ b/tests/commands/0106_compile.test @@ -14,6 +14,5 @@ define('OUT', file_put_contents(OUT, ""); phpdbg_exec(OUT); :> -compile run quit diff --git a/tests/run-tests.php b/tests/run-tests.php index 1fb6fa1224..47a998ccae 100644 --- a/tests/run-tests.php +++ b/tests/run-tests.php @@ -284,6 +284,8 @@ namespace phpdbg\testing { $test->purpose, $result ? "PASS" : "FAIL", PHP_EOL); + + return $result; } protected $config; @@ -426,7 +428,7 @@ namespace phpdbg\testing { */ public function getResult() { $options = sprintf( - '-i%s -qb', $this->file); + '-i%s -nqb', $this->file); if ($this->options) { $options = sprintf( @@ -492,13 +494,18 @@ namespace phpdbg\testing { * */ protected function writeDiff() { - $diff = sprintf( - '%s/%s.diff', - dirname($this->file), basename($this->file)); - if (count($this->diff['wants'])) { - if (!in_array('nodiff', $this->config['flags'])) { - if (($diff = fopen($diff, 'w+'))) { + if (!$this->config->hasFlag('nodiff')) { + if ($this->config->hasFlag('diff2stdout')) { + $difffile = "php://stdout"; + file_put_contents($difffile, "====DIFF====\n"); + } else { + $difffile = sprintf( + '%s/%s.diff', + dirname($this->file), basename($this->file)); + } + + if (($diff = fopen($difffile, 'w+'))) { foreach ($this->diff['wants'] as $line => $want) { $got = $this->diff['gets'][$line]; @@ -552,6 +559,9 @@ namespace { $cwd = dirname(__FILE__); $cmd = $_SERVER['argv']; + + $retval = 0; + { $config = new TestsConfiguration(array( 'exec' => realpath(array_shift($cmd)), @@ -571,7 +581,7 @@ namespace { $tests->logPath($path); foreach ($tests->findTests($path) as $test) { - $tests->logTest($path, $test); + $retval |= !$tests->logTest($path, $test); } $tests->logPathStats($path); @@ -579,5 +589,7 @@ namespace { $tests->logStats(); } + + die($retval); } ?> -- 2.40.0