Add test case from PR lib/44552 by Alexander Nasonov. I also lobbed

in a test for select(0, NULL, NULL, NULL, &tv) in there.
This commit is contained in:
pooka 2011-02-12 10:28:08 +00:00
parent b981a177b2
commit e43200f113
2 changed files with 45 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: h_client.c,v 1.1 2011/02/11 15:38:14 pooka Exp $ */
/* $NetBSD: h_client.c,v 1.2 2011/02/12 10:28:08 pooka Exp $ */
/*
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@ -65,6 +65,29 @@ main(int argc, char *argv[])
if (FD_ISSET(STDIN_FILENO, &rfds))
errx(1, "stdin fileno is still set");
exit(0);
} else if (strcmp(argv[1], "select_allunset") == 0) {
fd_set fds;
struct timeval tv;
int rv;
tv.tv_sec = 0;
tv.tv_usec = 1;
FD_ZERO(&fds);
rv = select(100, &fds, &fds, &fds, &tv);
if (rv == -1)
err(1, "select");
if (rv != 0)
errx(1, "select succesful");
rv = select(0, NULL, NULL, NULL, &tv);
if (rv == -1)
err(1, "select2");
if (rv != 0)
errx(1, "select2 succesful");
exit(0);
} else {
return ENOTSUP;
}

View File

@ -1,4 +1,4 @@
# $NetBSD: t_asyncio.sh,v 1.1 2011/02/11 15:38:14 pooka Exp $
# $NetBSD: t_asyncio.sh,v 1.2 2011/02/12 10:28:08 pooka Exp $
#
# Copyright (c) 2011 The NetBSD Foundation, Inc.
# All rights reserved.
@ -47,7 +47,27 @@ select_timeout_cleanup()
rump.halt
}
atf_test_case select_allunset cleanup
select_allunset_head()
{
atf_set "descr" "select() with no set fds in fd_set should not crash"
}
select_allunset_body()
{
atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER}
atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \
$(atf_get_srcdir)/h_client select_allunset
}
select_allunset_cleanup()
{
rump.halt
}
atf_init_test_cases()
{
atf_add_test_case select_timeout
atf_add_test_case select_allunset
}