Skip to content

Commit

Permalink
Splitting up tests due to changes in opcodes in PHP 7.2 (and opcache)
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Oct 30, 2017
1 parent fb25369 commit 3bba851
Show file tree
Hide file tree
Showing 12 changed files with 203 additions and 30 deletions.
4 changes: 1 addition & 3 deletions tests/bug00213-php70-opcache.phpt
Expand Up @@ -30,11 +30,9 @@ xdebug.overload_var_dump=0
?>
--EXPECT--
48
array(5) {
array(4) {
[5]=>
int(1)
[6]=>
int(-2)
[8]=>
int(1)
[12]=>
Expand Down
4 changes: 1 addition & 3 deletions tests/bug00334-php70-opcache.phpt
Expand Up @@ -34,11 +34,9 @@ array(2) {
int(1)
}
["%sbug00334.inc"]=>
array(3) {
array(2) {
[5]=>
int(1)
[7]=>
int(-1)
[9]=>
int(1)
}
Expand Down
6 changes: 5 additions & 1 deletion tests/bug00757b-php7.phpt
@@ -1,5 +1,9 @@
--TEST--
Test for bug #757: XDEBUG_CC_UNUSED does not work with code outside a function.
Test for bug #757: XDEBUG_CC_UNUSED does not work with code outside a function. (< PHP 7.2 || !opcache)
--SKIPIF--
<?php
if ( ( version_compare(phpversion(), "7.2", '>=') && extension_loaded('zend opcache'))) { echo "skip < PHP 7.2 || !opcache loaded needed\n"; };
?>
--INI--
xdebug.default_enable=1
xdebug.overload_var_dump=0
Expand Down
62 changes: 62 additions & 0 deletions tests/bug00757b-php72.phpt
@@ -0,0 +1,62 @@
--TEST--
Test for bug #757: XDEBUG_CC_UNUSED does not work with code outside a function (>= PHP 7.2 && opcache)
--SKIPIF--
<?php
if ( ! ( version_compare(phpversion(), "7.2", '>=') && extension_loaded('zend opcache'))) { echo "skip >= PHP 7.2 && opcache loaded needed\n"; };
?>
--INI--
xdebug.default_enable=1
xdebug.overload_var_dump=0
xdebug.auto_trace=0
xdebug.trace_options=0
xdebug.trace_output_dir=/tmp
xdebug.collect_params=1
xdebug.collect_return=0
xdebug.collect_assignments=0
xdebug.auto_profile=0
xdebug.profiler_enable=0
xdebug.dump_globals=0
xdebug.show_mem_delta=0
xdebug.trace_format=0
xdebug.extended_info=1
--FILE--
<?php
xdebug_start_code_coverage(XDEBUG_CC_UNUSED);

function f()
{
$x = 1;
if ($x) {
$y = 2;
} else {
$y = 3;
}
echo $y, "\n";
}

f();

$cc = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
var_dump($cc[__FILE__]);
?>
--EXPECT--
2
array(8) {
[4]=>
int(1)
[6]=>
int(1)
[7]=>
int(1)
[8]=>
int(1)
[12]=>
int(1)
[13]=>
int(1)
[15]=>
int(1)
[17]=>
int(1)
}
55 changes: 55 additions & 0 deletions tests/bug01247-php72-opcache.phpt
@@ -0,0 +1,55 @@
--TEST--
Test for bug #1247: xdebug.show_local_vars dumps variables with *uninitialized* values (>= PHP 7.2 && opcache)
--SKIPIF--
<?php
if ( ! ( version_compare(phpversion(), "7.2", '>=') && extension_loaded('zend opcache'))) { echo "skip >= PHP 7.2 && opcache loaded needed\n"; };
?>
--INI--
xdebug.default_enable=1
xdebug.collect_params=4
html_errors=0
xdebug.dump.GET=
xdebug.dump.POST=
xdebug.show_local_vars=1
--GET--
getFoo=bar
--POST--
postBar=baz
--FILE--
<?php
function test()
{
$a = 42;
strtr();
$b = 4;

return $a + $b;
}

function testDirect()
{
$c = 56;
trigger_error('test');
$d = 11;

return $c + $d;
}

test();
testDirect();
?>
--EXPECTF--
Warning: strtr() expects at least 2 parameters, 0 given in %sbug01247-php72-opcache.php on line 5

Call Stack:
%w%f %w%d 1. {main}() %sbug01247-php72-opcache.php:0
%w%f %w%d 2. test() %sbug01247-php72-opcache.php:20
%w%f %w%d 3. strtr() %sbug01247-php72-opcache.php:5


Notice: test in %sbug01247-php72-opcache.php on line 14

Call Stack:
%w%f %w%d 1. {main}() %sbug01247-php72-opcache.php:0
%w%f %w%d 2. testDirect() %sbug01247-php72-opcache.php:21
%w%f %w%d 3. trigger_error('test') %sbug01247-php72-opcache.php:14
22 changes: 13 additions & 9 deletions tests/bug01247.phpt
@@ -1,5 +1,9 @@
--TEST--
Test for bug #1247: xdebug.show_local_vars dumps variables with *uninitialized* values
Test for bug #1247: xdebug.show_local_vars dumps variables with *uninitialized* values (< PHP 7.2 || no opcache)
--SKIPIF--
<?php
if ( ( version_compare(phpversion(), "7.2", '>=') && extension_loaded('zend opcache'))) { echo "skip >= PHP 7.2 && opcache loaded needed\n"; };
?>
--INI--
xdebug.default_enable=1
xdebug.collect_params=4
Expand All @@ -16,44 +20,44 @@ postBar=baz
function test()
{
$a = 42;

strtr();

$b = 4;

return $a + $b;
}

function testDirect()
{
$c = 56;

trigger_error('test');

$d = 11;

return $c + $d;
}

test();
testDirect();
?>
--EXPECTF--
Warning: strtr() expects at least 2 parameters, 0 given in %sbug01247.php on line 6
Warning: strtr() expects at least 2 parameters, 0 given in %sbug01247.php on line 5

Call Stack:
%w%f %w%d 1. {main}() %sbug01247.php:0
%w%f %w%d 2. test() %sbug01247.php:20
%w%f %w%d 3. strtr() %sbug01247.php:6
%w%f %w%d 3. strtr() %sbug01247.php:5


Variables in local scope (#2):
$a = 42
$b = *uninitialized*


Notice: test in %sbug01247.php on line 15
Notice: test in %sbug01247.php on line 14

Call Stack:
%w%f %w%d 1. {main}() %sbug01247.php:0
%w%f %w%d 2. testDirect() %sbug01247.php:21
%w%f %w%d 3. trigger_error('test') %sbug01247.php:15
%w%f %w%d 3. trigger_error('test') %sbug01247.php:14


Variables in local scope (#2):
Expand Down
5 changes: 3 additions & 2 deletions tests/bug01270-php714-opcache.phpt
@@ -1,7 +1,8 @@
--TEST--
Test for bug #1270: String parsing marked not covered (> PHP 7.1.3)
Test for bug #1270: String parsing marked not covered (> PHP 7.1.3; < PHP 7.2)
--SKIPIF--
<?php if (!version_compare(phpversion(), "7.1.3", '>')) echo "skip > PHP 7.1.3 needed\n"; ?>
<?php if (!version_compare(phpversion(), "7.1.3", '>')) echo "skip > PHP 7.1.3; < PHP 7.2 needed\n"; ?>
<?php if (!version_compare(phpversion(), "7.2", '<=')) echo "skip > PHP 7.1.3; < PHP 7.2 needed\n"; ?>
<?php if (!extension_loaded('zend opcache')) echo "skip opcache required\n"; ?>
--FILE--
<?php
Expand Down
52 changes: 52 additions & 0 deletions tests/bug01270-php72-opcache.phpt
@@ -0,0 +1,52 @@
--TEST--
Test for bug #1270: String parsing marked not covered (>= PHP 7.2)
--SKIPIF--
<?php if (!version_compare(phpversion(), "7.2", '>=')) echo "skip >= PHP 7.2 needed\n"; ?>
<?php if (!extension_loaded('zend opcache')) echo "skip opcache required\n"; ?>
--FILE--
<?php
xdebug_start_code_coverage( XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE );

include dirname( __FILE__ ) . '/bug01270.inc';

try { func1(); } catch (Exception $e) { }
try { func2(); } catch (Exception $e) { }
try { func3(); } catch (Exception $e) { }

$cc = xdebug_get_code_coverage();

ksort( $cc );
var_dump( array_slice( $cc, 1, 1 ) );
?>
--EXPECTF--
array(1) {
["%sbug01270.inc"]=>
array(13) {
[2]=>
int(1)
[4]=>
int(1)
[5]=>
int(1)
[7]=>
int(1)
[11]=>
int(1)
[13]=>
int(1)
[14]=>
int(1)
[16]=>
int(1)
[20]=>
int(1)
[22]=>
int(1)
[23]=>
int(1)
[27]=>
int(1)
[33]=>
int(1)
}
}
8 changes: 2 additions & 6 deletions tests/bug01386-php70-opcache.phpt
Expand Up @@ -40,7 +40,7 @@ xdebug_stop_code_coverage(false);
--EXPECTF--
array(2) {
["%sbug01386-class1.inc"]=>
array(6) {
array(5) {
[3]=>
int(1)
[7]=>
Expand All @@ -49,13 +49,11 @@ array(2) {
int(-1)
[9]=>
int(-1)
[10]=>
int(-2)
[13]=>
int(1)
}
["%sbug01386-class2.inc"]=>
array(6) {
array(5) {
[3]=>
int(1)
[7]=>
Expand All @@ -64,8 +62,6 @@ array(2) {
int(-1)
[9]=>
int(-1)
[10]=>
int(-2)
[13]=>
int(1)
}
Expand Down
5 changes: 3 additions & 2 deletions tests/xdebug_debug_zval-php71-nts-opcache.phpt
@@ -1,9 +1,10 @@
--TEST--
Test for xdebug_debug_zval() (>= PHP 7.1, NTS, opcache)
Test for xdebug_debug_zval() (>= PHP 7.1, < PHP 7.2, NTS, opcache)
--SKIPIF--
<?php
if (PHP_ZTS == 1) echo "skip NTS needed\n";
if (!version_compare(phpversion(), "7.1", '>=')) echo "skip >= PHP 7.1 needed\n";
if (!version_compare(phpversion(), "7.1", '>=')) echo "skip >= PHP 7.1, < PHP 7.2 needed\n";
if (!version_compare(phpversion(), "7.2", '<')) echo "skip >= PHP 7.1, < PHP 7.2 needed\n";
if (!extension_loaded('zend opcache')) echo "skip opcache required\n";
?>
--INI--
Expand Down
5 changes: 3 additions & 2 deletions tests/xdebug_debug_zval_cli_color-php71-nts-opcache.phpt
@@ -1,9 +1,10 @@
--TEST--
Test for xdebug_debug_zval() (CLI colours) (>= PHP 7.1, NTS, opcache)
Test for xdebug_debug_zval() (CLI colours) (>= PHP 7.1, < PHP 7.2, NTS, opcache)
--SKIPIF--
<?php
if (PHP_ZTS == 1) echo "skip NTS needed\n";
if (!version_compare(phpversion(), "7.1", '>=')) echo "skip >= PHP 7.1 needed\n";
if (!version_compare(phpversion(), "7.1", '>=')) echo "skip >= PHP 7.1, < PHP 7.2 needed\n";
if (!version_compare(phpversion(), "7.2", '<')) echo "skip >= PHP 7.1, < PHP 7.2 needed\n";
if (!extension_loaded('zend opcache')) echo "skip opcache required\n";
?>
--INI--
Expand Down
5 changes: 3 additions & 2 deletions tests/xdebug_debug_zval_stdout-php71-nts-opcache.phpt
@@ -1,9 +1,10 @@
--TEST--
Test for xdebug_debug_zval_stdout() (>= PHP 7.1, NTS, opcache)
Test for xdebug_debug_zval_stdout() (>= PHP 7.1, PHP < 7.2, NTS, opcache)
--SKIPIF--
<?php
if (PHP_ZTS == 1) echo "skip NTS needed\n";
if (!version_compare(phpversion(), "7.1", '>=')) echo "skip >= PHP 7.1 needed\n";
if (!version_compare(phpversion(), "7.1", '>=')) echo "skip >= PHP 7.1, < PHP 7.2 needed\n";
if (!version_compare(phpversion(), "7.2", '<')) echo "skip >= PHP 7.1, < PHP 7.2 needed\n";
if (!extension_loaded('zend opcache')) echo "skip opcache required\n";
?>
--INI--
Expand Down

0 comments on commit 3bba851

Please sign in to comment.