-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(tests): Convert forked PR branch to main repo branch.
So the ci/cd will run...
- Loading branch information
Showing
50 changed files
with
6,516 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
/* | ||
* Copyright 2022 New Relic Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/* JIT only supported with OAPI with PHP 8+ */ | ||
if (version_compare(PHP_VERSION, "8.0", "<")) { | ||
die("skip: PHP < 8.0.0 not supported\n"); | ||
} | ||
|
||
/* Test cannot run without opache */ | ||
/* This should be changed to a 'warn' result when supported */ | ||
if (!extension_loaded('Zend OPcache')) { | ||
die("warn: Zend OPcache extension required\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
/* | ||
* Copyright 2020 New Relic Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/*DESCRIPTION | ||
Transaction event created and no errors despite creating spans | ||
for a HUGE number of calls. | ||
*/ | ||
|
||
/*SKIPIF | ||
<?php | ||
require('skipif.inc'); | ||
*/ | ||
|
||
/*INI | ||
newrelic.distributed_tracing_enabled=1 | ||
newrelic.transaction_tracer.threshold = 0 | ||
error_reporting = E_ALL | ||
opcache.enable=1 | ||
opcache.enable_cli=1 | ||
opcache.file_update_protection=0 | ||
opcache.jit_buffer_size=32M | ||
opcache.jit=function | ||
*/ | ||
|
||
/*PHPMODULES | ||
zend_extension=opcache.so | ||
*/ | ||
|
||
/*EXPECT_ANALYTICS_EVENTS | ||
[ | ||
"?? agent run id", | ||
{ | ||
"reservoir_size": 50, | ||
"events_seen": 1 | ||
}, | ||
[ | ||
[ | ||
{ | ||
"traceId": "??", | ||
"duration": "??", | ||
"timestamp": "??", | ||
"type": "Transaction", | ||
"name": "OtherTransaction\/php__FILE__", | ||
"guid": "??", | ||
"priority": "??", | ||
"sampled": true, | ||
"totalTime": "??", | ||
"error": false | ||
}, | ||
{}, | ||
{} | ||
] | ||
] | ||
] | ||
*/ | ||
|
||
|
||
/*EXPECT | ||
Hello | ||
*/ | ||
|
||
newrelic_add_custom_tracer('computation'); | ||
|
||
function computation(float $a): int | ||
{ | ||
|
||
$b = intval($a) % (2 ** 32); | ||
return $b; | ||
} | ||
|
||
for ($i = 0; $i < 500; ++$i) { | ||
computation(2**64); | ||
} | ||
echo 'Hello'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
/* | ||
* Copyright 2020 New Relic Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/*DESCRIPTION | ||
Transaction event generated with JIT enabled even when doing lots of loops. | ||
*/ | ||
|
||
/*SKIPIF | ||
<?php | ||
require('skipif.inc'); | ||
*/ | ||
|
||
/*INI | ||
newrelic.distributed_tracing_enabled=1 | ||
newrelic.transaction_tracer.threshold = 0 | ||
newrelic.cross_application_tracer.enabled = false | ||
error_reporting = E_ALL | ||
opcache.enable=1 | ||
opcache.enable_cli=1 | ||
opcache.file_update_protection=0 | ||
opcache.jit_buffer_size=32M | ||
opcache.jit=function | ||
*/ | ||
|
||
/*PHPMODULES | ||
zend_extension=opcache.so | ||
*/ | ||
|
||
/*EXPECT_ERROR_EVENTS null */ | ||
|
||
/*EXPECT_ANALYTICS_EVENTS | ||
[ | ||
"?? agent run id", | ||
{ | ||
"reservoir_size": 50, | ||
"events_seen": 1 | ||
}, | ||
[ | ||
[ | ||
{ | ||
"traceId": "??", | ||
"duration": "??", | ||
"timestamp": "??", | ||
"type": "Transaction", | ||
"name": "OtherTransaction\/php__FILE__", | ||
"guid": "??", | ||
"priority": "??", | ||
"sampled": true, | ||
"totalTime": "??", | ||
"error": false | ||
}, | ||
{}, | ||
{} | ||
] | ||
] | ||
] | ||
*/ | ||
|
||
/*EXPECT | ||
5000 | ||
*/ | ||
|
||
|
||
function even(int $a): bool { | ||
if ($a == 1) { | ||
return false; | ||
} else if (($a % 2) == 0) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
$count = 0; | ||
for ($i = 1; $i <= 10000; $i++) | ||
{ | ||
if (even($i)) $count++; | ||
} | ||
echo "$count"; | ||
|
55 changes: 55 additions & 0 deletions
55
tests/integration/jit/function/test_recursion_no_segfault.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/* | ||
* Copyright 2022 New Relic Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/*DESCRIPTION | ||
JIT enabled, should still instrument without crashing. | ||
Previous tests would invariably cause a segfault when | ||
recursively finding the 10th fibonacci number. | ||
*/ | ||
|
||
/*SKIPIF | ||
<?php | ||
require('skipif.inc'); | ||
*/ | ||
|
||
/*INI | ||
error_reporting = E_ALL | ||
newrelic.distributed_tracing_enabled=1 | ||
newrelic.transaction_tracer.threshold = 0 | ||
newrelic.cross_application_tracer.enabled = false | ||
opcache.enable=1 | ||
opcache.enable_cli=1 | ||
opcache.file_update_protection=0 | ||
opcache.jit_buffer_size=32M | ||
opcache.jit=function | ||
*/ | ||
|
||
/*PHPMODULES | ||
zend_extension=opcache.so | ||
*/ | ||
|
||
/*EXPECT_ERROR_EVENTS | ||
null | ||
*/ | ||
|
||
/*EXPECT | ||
89 | ||
*/ | ||
|
||
newrelic_add_custom_tracer('fibonacci'); | ||
|
||
|
||
function fibonacci($n){ | ||
return(($n < 2) ? 1 : fibonacci($n - 2) + fibonacci($n - 1)); | ||
} | ||
|
||
$n = 10; /* Get the nth Fibonacci number. */ | ||
|
||
$fibonacci = fibonacci($n); | ||
echo $fibonacci; | ||
|
Oops, something went wrong.