diff --git a/.github/print-logs.php b/.github/print-logs.php index a3cf1ae01e..8838e7ee51 100644 --- a/.github/print-logs.php +++ b/.github/print-logs.php @@ -111,6 +111,35 @@ { echo 'Not found!', \PHP_EOL; } +foreach ([ + 'websocket', + 'register', + 'gateway', + 'http', +] as $serviceName) +{ + $fileName = \dirname(__DIR__) . '/src/Components/workerman-gateway/tests/unit/AppServer/logs/' . $serviceName . '.log'; + echo 'File: ', $fileName, \PHP_EOL; + if (is_file($fileName)) + { + echo file_get_contents($fileName), \PHP_EOL; + } + else + { + echo 'Not found!', \PHP_EOL; + } + + $fileName = \dirname(__DIR__) . '/src/Components/workerman-gateway/tests/unit/AppServer/logs/' . $serviceName . '.error.log'; + echo 'File: ', $fileName, \PHP_EOL; + if (is_file($fileName)) + { + echo file_get_contents($fileName), \PHP_EOL; + } + else + { + echo 'Not found!', \PHP_EOL; + } +} echo '[RoadRunner]', \PHP_EOL; $fileName = \dirname(__DIR__) . '/src/Components/roadrunner/tests/unit/HttpServer/logs/cli.log'; diff --git a/src/Components/workerman-gateway/tests/bootstrap.php b/src/Components/workerman-gateway/tests/bootstrap.php index 30988e9e98..e7254d2a49 100644 --- a/src/Components/workerman-gateway/tests/bootstrap.php +++ b/src/Components/workerman-gateway/tests/bootstrap.php @@ -177,19 +177,20 @@ function runTestServer(string $name, array $options): void { $checkStatuses = [$options['checkStatus']]; } - foreach ($checkStatuses as $checkStatus) + foreach ($checkStatuses as $i => $checkStatus) { if ($checkStatus()) { - echo "{$name} started!", \PHP_EOL; - - return; + var_export($checkStatus); + echo ' OK', \PHP_EOL; + unset($checkStatuses[$i]); } else { throw new \RuntimeException("{$name} start failed"); } } + echo "{$name} started!", \PHP_EOL; } } diff --git a/src/Components/workerman-gateway/tests/unit/AppServer/bin/start-server.ps1 b/src/Components/workerman-gateway/tests/unit/AppServer/bin/start-server.ps1 new file mode 100755 index 0000000000..c28e686eca --- /dev/null +++ b/src/Components/workerman-gateway/tests/unit/AppServer/bin/start-server.ps1 @@ -0,0 +1,6 @@ +$__DIR__ = $(Split-Path -Parent $MyInvocation.MyCommand.Definition) + +$server = $args[0] + +$procss = Start-Process -PassThru -FilePath "php" -ArgumentList "$__DIR__\workerman workerman/start --name $server" -RedirectStandardOutput "$__DIR__\..\logs\$server.log" -RedirectStandardError "$__DIR__\..\logs\$server.error.log" +$procss.Id | Out-File $__DIR__/$server.pid diff --git a/src/Components/workerman-gateway/tests/unit/AppServer/bin/start-workerman.ps1 b/src/Components/workerman-gateway/tests/unit/AppServer/bin/start-workerman.ps1 index 23f8ec828b..73598fff7e 100755 --- a/src/Components/workerman-gateway/tests/unit/AppServer/bin/start-workerman.ps1 +++ b/src/Components/workerman-gateway/tests/unit/AppServer/bin/start-workerman.ps1 @@ -2,14 +2,10 @@ $__DIR__ = $(Split-Path -Parent $MyInvocation.MyCommand.Definition) & $__DIR__\stop-workerman.ps1 -$procss = Start-Process -PassThru -FilePath "php" -ArgumentList "$__DIR__\workerman workerman/start --name websocket" -$procss.Id | Out-File $__DIR__/websocket.pid +$procss = Start-Process -PassThru -FilePath "powershell" -ArgumentList "$__DIR__\start-server.ps1 websocket" -$procss = Start-Process -PassThru -FilePath "php" -ArgumentList "$__DIR__\workerman workerman/start --name register" -$procss.Id | Out-File $__DIR__/register.pid +$procss = Start-Process -PassThru -FilePath "powershell" -ArgumentList "$__DIR__\start-server.ps1 register" -$procss = Start-Process -PassThru -FilePath "php" -ArgumentList "$__DIR__\workerman workerman/start --name gateway" -$procss.Id | Out-File $__DIR__/gateway.pid +$procss = Start-Process -PassThru -FilePath "powershell" -ArgumentList "$__DIR__\start-server.ps1 gateway" -$procss = Start-Process -PassThru -FilePath "php" -ArgumentList "$__DIR__\workerman workerman/start --name http" -$procss.Id | Out-File $__DIR__/http.pid +$procss = Start-Process -PassThru -FilePath "powershell" -ArgumentList "$__DIR__\start-server.ps1 http"