Skip to content

Commit 1ceb45d

Browse files
committed
Fix the IO hooks tests on macOS and Windows
The priority select test skips where the auto poll backend has no priority event, which on Darwin is both kqueue and poll(). The read commit tests make their socket pairs with AF_INET on Windows.
1 parent b05a2fd commit 1ceb45d

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎ext/standard/tests/streams/hooks/cancel-after-completion.phpt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ $queues = ['poll' => new Io\Poll\OperationQueue(), 'ring' => new Io\Ring\Engine(
3939
foreach ($queues as $name => $queue) {
4040
foreach (['buffered', 'unbuffered'] as $mode) {
4141
echo "-- $name $mode --\n";
42-
[$r, $w] = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);
42+
[$r, $w] = stream_socket_pair(PHP_OS_FAMILY === 'Windows' ? STREAM_PF_INET : STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);
4343
stream_set_timeout($r, 1);
4444
if ($mode === 'unbuffered') {
4545
stream_set_read_buffer($r, 0);

‎ext/standard/tests/streams/hooks/ring-cancel-read-commit.phpt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function settle(Io\Ring\Engine $ring): void
1515

1616
function pair()
1717
{
18-
$pair = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);
18+
$pair = stream_socket_pair(PHP_OS_FAMILY === 'Windows' ? STREAM_PF_INET : STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);
1919
stream_set_timeout($pair[0], 1);
2020
return $pair;
2121
}

‎ext/standard/tests/streams/hooks/ring-orphan-read-commit.phpt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ function orphaned_read(Io\Ring\Engine $ring, $fp, $peer, int $len): void
4444
$ring = new Io\Ring\Engine();
4545

4646
echo "-- buffered socket --\n";
47-
[$r, $w] = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);
47+
[$r, $w] = stream_socket_pair(PHP_OS_FAMILY === 'Windows' ? STREAM_PF_INET : STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);
4848
stream_set_timeout($r, 1);
4949
orphaned_read($ring, $r, $w, 5);
5050
fwrite($w, " world");
5151
var_dump(fread($r, 11));
5252

5353
echo "-- unbuffered socket --\n";
54-
[$r, $w] = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);
54+
[$r, $w] = stream_socket_pair(PHP_OS_FAMILY === 'Windows' ? STREAM_PF_INET : STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);
5555
stream_set_timeout($r, 1);
5656
stream_set_read_buffer($r, 0);
5757
orphaned_read($ring, $r, $w, 5);

‎ext/standard/tests/streams/hooks/ring-poll-priority.phpt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Io\Ring\Engine: stream_select() reports the except set although ior has no prior
33
--SKIPIF--
44
<?php
55
if (!class_exists(Io\Ring\Engine::class)) die("skip Io\\Ring\\Engine not available");
6-
if (PHP_OS_FAMILY === 'Windows') die("skip no out-of-band data on Windows");
6+
if (!Io\Poll\Backend::Auto->supportsPriority()) die("skip the poll backend has no priority event");
77
?>
88
--FILE--
99
<?php

0 commit comments

Comments
 (0)