From: visa Date: Sat, 27 Nov 2021 15:06:10 +0000 (+0000) Subject: Fix timeouts in poll/select regress tests X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7ad332b8450a3d41711774b710950ad4decc92d5;p=openbsd Fix timeouts in poll/select regress tests Disable poll/select timeout so that the wchan wait would work as intended. The timeout is not essential to the test flow. In addition, the top-level alarm timer prevents the tests from getting stuck should something go wrong. --- diff --git a/regress/sys/kern/poll/poll_close.c b/regress/sys/kern/poll/poll_close.c index a05b0c69b1e..e8dd86864bf 100644 --- a/regress/sys/kern/poll/poll_close.c +++ b/regress/sys/kern/poll/poll_close.c @@ -1,4 +1,4 @@ -/* $OpenBSD: poll_close.c,v 1.1 2021/11/21 06:21:01 visa Exp $ */ +/* $OpenBSD: poll_close.c,v 1.2 2021/11/27 15:06:10 visa Exp $ */ /* * Copyright (c) 2021 Visa Hankala @@ -88,7 +88,7 @@ thread_main(void *arg) memset(pfd, 0, sizeof(pfd)); pfd[0].fd = sock[1]; pfd[0].events = POLLIN; - ret = poll(pfd, 1, 100); + ret = poll(pfd, 1, INFTIM); assert(ret == 1); assert(pfd[0].revents & POLLIN); @@ -102,7 +102,7 @@ thread_main(void *arg) memset(pfd, 0, sizeof(pfd)); pfd[0].fd = sock[1]; pfd[0].events = POLLIN; - ret = poll(pfd, 1, 100); + ret = poll(pfd, 1, INFTIM); assert(ret == 1); assert(pfd[0].revents & POLLNVAL); diff --git a/regress/sys/kern/select/select_close.c b/regress/sys/kern/select/select_close.c index b06a5a2cb6d..a9e56dd76cf 100644 --- a/regress/sys/kern/select/select_close.c +++ b/regress/sys/kern/select/select_close.c @@ -1,4 +1,4 @@ -/* $OpenBSD: select_close.c,v 1.1 2021/11/21 06:21:01 visa Exp $ */ +/* $OpenBSD: select_close.c,v 1.2 2021/11/27 15:06:10 visa Exp $ */ /* * Copyright (c) 2021 Visa Hankala @@ -83,15 +83,12 @@ static void * thread_main(void *arg) { fd_set rfds; - struct timeval tv; int ret; char b; FD_ZERO(&rfds); FD_SET(sock[1], &rfds); - tv.tv_sec = 0; - tv.tv_usec = 100000; - ret = select(sock[1] + 1, &rfds, NULL, NULL, &tv); + ret = select(sock[1] + 1, &rfds, NULL, NULL, NULL); assert(ret == 1); assert(FD_ISSET(sock[1], &rfds)); @@ -104,9 +101,7 @@ thread_main(void *arg) FD_ZERO(&rfds); FD_SET(sock[1], &rfds); - tv.tv_sec = 0; - tv.tv_usec = 100000; - ret = select(sock[1] + 1, &rfds, NULL, NULL, &tv); + ret = select(sock[1] + 1, &rfds, NULL, NULL, NULL); assert(ret == -1); assert(errno == EBADF);