fix flaky sockets test - form of response is OS dependent

This commit is contained in:
Joe Watkins 2019-06-12 08:47:35 +02:00
parent abe38b5e48
commit c54a247cb0
No known key found for this signature in database
GPG Key ID: F9BA0ADA31CBD89E

View File

@ -55,7 +55,28 @@ $data = [
];
var_dump($data);
if (!socket_recvmsg($s, $data, 0)) die("recvmsg");
print_r($data);
if ($data["control"]) {
$control = $data["control"][0];
if ($control["level"] == SOL_SOCKET &&
$control["type"] == SCM_RIGHTS) {
foreach ($control["data"] as $resource) {
if (!is_resource($resource)) {
echo "FAIL RES\n";
var_dump($data);
exit;
}
}
echo "OK";
} else {
echo "FAIL RIGHTS\n";
var_dump($data);
exit;
}
} else {
echo "FAIL CONTROL\n";
var_dump($data);
}
--EXPECTF--
creating send socket
resource(%d) of type (Socket)
@ -72,32 +93,4 @@ array(3) {
["controllen"]=>
int(%d)
}
Array
(
[name] =>
[control] => Array
(
[0] => Array
(
[level] => %d
[type] => %d
[data] => Array
(
[0] => Resource id #%d
[1] => Resource id #%d
[2] => Resource id #%d
[3] => Resource id #%d
)
)
)
[iov] => Array
(
[0] => test thing
)
[flags] => 0
)
OK