Mercurial > gnulib
changeset 40016:9edd1d1403bb
select tests: Avoid test failure on Cygwin.
* tests/test-select.h (test_bad_fd): Use an fd < FD_SETSIZE.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Thu, 13 Dec 2018 22:17:50 +0100 |
parents | a4bc639f0003 |
children | fb1ee0d2d690 |
files | ChangeLog tests/test-select.h |
diffstat | 2 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Dec 13 12:00:22 2018 +0100 +++ b/ChangeLog Thu Dec 13 22:17:50 2018 +0100 @@ -1,3 +1,8 @@ +2018-12-13 Bruno Haible <bruno@clisp.org> + + select tests: Avoid test failure on Cygwin. + * tests/test-select.h (test_bad_fd): Use an fd < FD_SETSIZE. + 2018-12-13 Bruno Haible <bruno@clisp.org> localtime-buffer: Avoid endless recursion in localtime and gmtime.
--- a/tests/test-select.h Thu Dec 13 12:00:22 2018 +0100 +++ b/tests/test-select.h Thu Dec 13 22:17:50 2018 +0100 @@ -242,9 +242,11 @@ /* Can't test FD_SETSIZE + 1 for EINVAL, since some systems allow dynamically larger set size by redefining FD_SETSIZE anywhere up to the actual maximum fd. */ - /* if (do_select_bad_nfd_nowait (FD_SETSIZE + 1, my_select) != -1 */ - /* || errno != EINVAL) */ - /* failed ("invalid errno after bogus nfds"); */ +#if 0 + if (do_select_bad_nfd_nowait (FD_SETSIZE + 1, my_select) != -1 + || errno != EINVAL) + failed ("invalid errno after bogus nfds"); +#endif } /* Test select(2) on invalid file descriptors. */ @@ -294,6 +296,11 @@ # else fd = 99; # endif + /* Even on the best POSIX compliant platforms, values of fd >= FD_SETSIZE + require an nfds argument that is > FD_SETSIZE and thus may lead to EINVAL, + not EBADF. */ + if (fd >= FD_SETSIZE) + fd = FD_SETSIZE - 1; close (fd); if (do_select_bad_fd_nowait (fd, SEL_IN, my_select) == 0 || errno != EBADF)