On Wed, 10 Jan 2024 at 23:42, Nabih Estefan <[email protected]> wrote:
>
> From: Hao Wu <[email protected]>
>
> This patches adds a qtest for NPCM7XX PCI Mailbox module.
> It sends read and write requests to the module, and verifies that
> the module contains the correct data after the requests.
>
> Change-Id: I2e1dbaecf8be9ec7eab55cb54f7fdeb0715b8275
> Signed-off-by: Hao Wu <[email protected]>
> Signed-off-by: Nabih Estefan <[email protected]>
> Reviewed-by: Tyrone Ting <[email protected]>
> +/*
> + * Create a local TCP socket with any port, then save off the port we got.
> + */
> +static in_port_t open_socket(void)
This needs to be 'int', to avoid a compilation failure under
Windows, which doesn't define the in_port_t type.
> +{
> + struct sockaddr_in myaddr;
> + socklen_t addrlen;
> +
> + myaddr.sin_family = AF_INET;
> + myaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
> + myaddr.sin_port = 0;
> + sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
> + g_assert(sock != -1);
> + g_assert(bind(sock, (struct sockaddr *) &myaddr, sizeof(myaddr)) != -1);
> + addrlen = sizeof(myaddr);
> + g_assert(getsockname(sock, (struct sockaddr *) &myaddr , &addrlen) !=
> -1);
> + g_assert(listen(sock, 1) != -1);
> + return ntohs(myaddr.sin_port);
> +}
thanks
-- PMM