Module Name: src Committed By: pooka Date: Sat Feb 12 10:28:08 UTC 2011
Modified Files: src/tests/lib/librumphijack: h_client.c t_asyncio.sh Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/librumphijack/h_client.c \ src/tests/lib/librumphijack/t_asyncio.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/lib/librumphijack/h_client.c diff -u src/tests/lib/librumphijack/h_client.c:1.1 src/tests/lib/librumphijack/h_client.c:1.2 --- src/tests/lib/librumphijack/h_client.c:1.1 Fri Feb 11 15:38:14 2011 +++ src/tests/lib/librumphijack/h_client.c Sat Feb 12 10:28:08 2011 @@ -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 @@ 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; } Index: src/tests/lib/librumphijack/t_asyncio.sh diff -u src/tests/lib/librumphijack/t_asyncio.sh:1.1 src/tests/lib/librumphijack/t_asyncio.sh:1.2 --- src/tests/lib/librumphijack/t_asyncio.sh:1.1 Fri Feb 11 15:38:14 2011 +++ src/tests/lib/librumphijack/t_asyncio.sh Sat Feb 12 10:28:08 2011 @@ -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 @@ 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 }