mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
tests/unit: Update test-io-channel-socket.c for Windows
Change to dynamically include the test cases by checking AF_UNIX availability using a new helper socket_check_afunix_support(). With such changes testing on a Windows host can be covered as well. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220802075200.907360-5-bmeng.cn@gmail.com>
This commit is contained in:
parent
120fa5e0e6
commit
0370f239ad
3 changed files with 48 additions and 14 deletions
|
@ -154,3 +154,19 @@ int socket_check_protocol_support(bool *has_ipv4, bool *has_ipv6)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void socket_check_afunix_support(bool *has_afunix)
|
||||
{
|
||||
int fd;
|
||||
|
||||
fd = socket(PF_UNIX, SOCK_STREAM, 0);
|
||||
closesocket(fd);
|
||||
|
||||
#ifdef _WIN32
|
||||
*has_afunix = (fd != (int)INVALID_SOCKET);
|
||||
#else
|
||||
*has_afunix = (fd >= 0);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue