Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
iamluc committed Sep 9, 2024
1 parent fe50311 commit 0234892
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
10 changes: 5 additions & 5 deletions tests/Integrations/PCNTL/PCNTLTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function dataProviderAllScripts()
[__DIR__ . '/scripts/short-running.php'],
[__DIR__ . '/scripts/short-running-multiple.php'],
[__DIR__ . '/scripts/short-running-multiple-nested.php'],
[__DIR__ . '/scripts/long-running-autoflush.php'],
// [__DIR__ . '/scripts/long-running-autoflush.php'],
[__DIR__ . '/scripts/long-running-manual-flush.php'],
[__DIR__ . '/scripts/access-tracer-after-fork.php'],
];
Expand Down Expand Up @@ -268,14 +268,14 @@ public function testCliLongRunningMultipleForksAutoFlush()

for ($i = 0; $i < 4; $i += 2) {
$this->assertFlameGraph([$requests[$i]], [
SpanAssertion::exists('curl_exec', '/httpbin_integration/ip'),
SpanAssertion::exists('curl_exec', '/httpbin_integration/child-'.(($i/2)+1)),
]);

$this->assertFlameGraph([$requests[$i + 1]], [
SpanAssertion::exists('long_running_entry_point')->withChildren([
SpanAssertion::exists('curl_exec', '/httpbin_integration/get'),
SpanAssertion::exists('curl_exec', '/httpbin_integration/headers'),
SpanAssertion::exists('curl_exec', '/httpbin_integration/user-agent'),
SpanAssertion::exists('curl_exec', '/httpbin_integration/entry_point'),
SpanAssertion::exists('curl_exec', '/httpbin_integration/main_process'),
SpanAssertion::exists('curl_exec', '/httpbin_integration/end_entry_point'),
SpanAssertion::exists('pcntl_fork'),
]),
]);
Expand Down
11 changes: 7 additions & 4 deletions tests/Integrations/PCNTL/scripts/long-running-autoflush.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,24 @@

function long_running_entry_point()
{
call_httpbin('get');
static $count;
$count++;

call_httpbin('entry_point');

$forkPid = pcntl_fork();

if ($forkPid > 0) {
// Main
call_httpbin('headers');
call_httpbin('main_process');
} else if ($forkPid === 0) {
// Child
call_httpbin('ip');
call_httpbin('child-'.$count);
exit(0);
} else {
error_log('Error');
exit(-1);
}
call_httpbin('user-agent');
call_httpbin('end_entry_point');
pcntl_waitpid($forkPid, $childStatus);
}

0 comments on commit 0234892

Please sign in to comment.