Repository navigation
test: cover upstream Swoole regressions #661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a332550
docs: plan Swoole regression coverage
binaryfire d5d17f6
test: cover Swoole engine regressions
binaryfire e81f58d
test: cover native HTTP request parsing regressions
binaryfire fb35fe3
test: cover Swoole HTTP client regressions
binaryfire fb33aec
test: cover Hypervel HTTP server regressions
binaryfire 6e59f20
test: cover Swoole server TLS regressions
binaryfire c8dc3cc
test: tighten Swoole engine regressions
binaryfire 12b8c48
test: exercise HTTP regressions through the server
binaryfire 178f312
test: make Swoole TLS regressions exact
binaryfire 3e4186d
test: harden Swoole regression failures
binaryfire add25a6
test: track read-through stream leaks by identity
binaryfire File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
25 changes: 25 additions & 0 deletions
25
docs/plans/2026-10-13-swoole-upstream-regression-coverage.md
This file contains hidden or 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,25 @@ | ||
| # Swoole Upstream Regression Coverage | ||
|
|
||
| ## Goal | ||
|
|
||
| Keep deterministic Hypervel regressions for upstream Swoole defects that affect real framework and application paths. Tests remain skipped only while Hypervel's minimum Swoole release lacks the corresponding fix. | ||
|
|
||
| ## Test Scope | ||
|
|
||
| - Cover hooked stream shutdown and immediate listener release (#6109 and #6274). | ||
| - Cover HTTP client reuse, rejected deferred settings, and closing an unconnected client (#6149, #6173/#6267, and #6186). | ||
| - Cover masked/compressed WebSocket frames, fresh masking keys, and invalid compressed control frames (#6158, #6165, and #6209). | ||
| - Cover coroutine socket timeout and linger option handling (#6166). | ||
| - Cover incremental and multipart request parsing, upload-marker safety, and QUERY requests (#6154, #6161, #6162, #6224, and #6256). | ||
| - Cover chunked request boundaries, `100 Continue`, and pipelined response ordering through the real Hypervel HTTP server (#6205 and #6220). | ||
| - Cover cancellation during directory iteration and `Coroutine::setTimeLimit()` timer ownership (#6185 and #6270). | ||
| - Cover client-certificate enforcement and SNI/default-certificate initialization through TLS integration tests (#6188 and #6214). | ||
|
|
||
| ## Verification | ||
|
|
||
| Run each new regression without its version guard against the current Swoole extension and confirm it fails for the expected defect. Then add the narrow Swoole-version skip, including the upstream pull-request URL, and rerun the affected test class. Run the existing package-level suites for every changed area. | ||
|
|
||
| ## Deferred Coverage | ||
|
|
||
| - #6126 (`Swoole\Table` atomic row operations) is not included for now because Hypervel does not currently use those APIs. Revisit it if the framework adopts them. | ||
| - #6174 (Unix datagram address ownership) is not included for now because Hypervel does not currently expose or use Unix datagram sockets. Revisit it if that changes. |
This file contains hidden or 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 hidden or 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,28 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| use Swoole\Coroutine; | ||
| use Swoole\Coroutine\CanceledException; | ||
| use Swoole\Event; | ||
| use Swoole\Runtime; | ||
|
|
||
| require $argv[1]; | ||
|
|
||
| Runtime::enableCoroutine(SWOOLE_HOOK_FILE); | ||
|
|
||
| Coroutine\run(static function (): void { | ||
| try { | ||
| $coroutine = Coroutine::getCid(); | ||
|
|
||
| foreach (new DirectoryIterator(__DIR__) as $entry) { | ||
| Event::defer(static function () use ($coroutine): void { | ||
| Coroutine::cancel($coroutine, true); | ||
| }); | ||
| } | ||
|
|
||
| exit(1); | ||
| } catch (CanceledException) { | ||
| echo "canceled\n"; | ||
| } | ||
| }); |
This file contains hidden or 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,67 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Hypervel\Tests\Engine; | ||
|
|
||
| use Hypervel\Tests\TestCase; | ||
|
|
||
| class HookedStreamTest extends TestCase | ||
| { | ||
| public function testSocketShutdownReportsTheNativeResult(): void | ||
| { | ||
| if (SWOOLE_VERSION_ID <= 60203) { | ||
| $this->markTestSkipped('Requires hooked stream shutdown result parity from https://github.com/swoole/swoole-src/pull/6109.'); | ||
| } | ||
|
|
||
| $server = stream_socket_server('tcp://127.0.0.1:0'); | ||
| $this->assertIsResource($server); | ||
| $address = stream_socket_get_name($server, false); | ||
| $this->assertIsString($address); | ||
| $sender = stream_socket_client('tcp://' . $address); | ||
| $receiver = stream_socket_accept($server, 1); | ||
|
|
||
| try { | ||
| $this->assertIsResource($sender); | ||
| $this->assertIsResource($receiver); | ||
| stream_set_timeout($receiver, 1); | ||
| $this->assertSame(7, fwrite($sender, 'payload')); | ||
| $this->assertTrue(stream_socket_shutdown($sender, STREAM_SHUT_WR)); | ||
| $this->assertSame('payload', stream_get_contents($receiver)); | ||
| $this->assertTrue(feof($receiver)); | ||
| $this->assertFalse(@stream_socket_shutdown($sender, STREAM_SHUT_WR)); | ||
| } finally { | ||
| foreach ([$sender, $receiver, $server] as $stream) { | ||
| if (is_resource($stream)) { | ||
| fclose($stream); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| public function testClosingAListenerImmediatelyReleasesItsAddress(): void | ||
| { | ||
| if (SWOOLE_VERSION_ID <= 60203) { | ||
| $this->markTestSkipped('Requires immediate hooked listener release from https://github.com/swoole/swoole-src/pull/6274.'); | ||
| } | ||
|
|
||
| $server = stream_socket_server('tcp://127.0.0.1:0'); | ||
| $this->assertIsResource($server); | ||
| $address = stream_socket_get_name($server, false); | ||
| $this->assertIsString($address); | ||
|
|
||
| fclose($server); | ||
|
|
||
| $this->assertFalse(@stream_socket_client('tcp://' . $address)); | ||
|
|
||
| $replacement = stream_socket_server('tcp://' . $address); | ||
|
|
||
| try { | ||
| $this->assertIsResource($replacement); | ||
| } finally { | ||
| if (is_resource($replacement)) { | ||
| fclose($replacement); | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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,23 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Hypervel\Tests\Engine; | ||
|
|
||
| use Hypervel\Engine\Http\Client; | ||
| use Hypervel\Tests\TestCase; | ||
|
|
||
| class HttpClientTest extends TestCase | ||
| { | ||
| public function testClosingAnUnconnectedClientReportsNoConnection(): void | ||
| { | ||
| if (SWOOLE_VERSION_ID <= 60203) { | ||
| $this->markTestSkipped('Requires initialized coroutine HTTP client socket state from https://github.com/swoole/swoole-src/pull/6186.'); | ||
| } | ||
|
|
||
| $client = new Client('127.0.0.1', 80); | ||
|
|
||
| $this->assertFalse($client->close()); | ||
| $this->assertSame(SWOOLE_ERROR_CLIENT_NO_CONNECTION, $client->errCode); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.