On Wed, 10 Jan 2024 at 23:42, Nabih Estefan <nabiheste...@google.com> wrote: > > From: Hao Wu <wuhao...@google.com> > > 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 <wuhao...@google.com> > Signed-off-by: Nabih Estefan <nabiheste...@google.com> > Reviewed-by: Tyrone Ting <kft...@nuvoton.com>
> +/* > + * 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