Add new tests: tests/lib/libc/sys/t_wait_noproc and t_wait_noproc_wnohang
The t_wait_noproc test checks whether wait(2)-family of functions return error and set ECHILD for lack of childs. The t_wait_noproc_wnohang adds to options (except wait(2), wait3(2)) new parameter WNOHANG and verifies that error is still signaled and errno set to ECHILD. Currently t_wait_noproc_wnohang reports failures, these have been marked as expected and referenced to PR standards/51606. The problem report is authored by Robert Elz, and the initial regression has been notified by Nicolas Joly. Remove redundant test in tests/lib/libc/sys/t_wait for wait6(2) with no WNOHANG specified. Sponsored by <The NetBSD Foundation>.
This commit is contained in:
parent
838eb24361
commit
2945e8c443
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: mi,v 1.170 2016/11/02 12:51:22 kamil Exp $
|
||||
# $NetBSD: mi,v 1.171 2016/11/06 15:03:30 kamil Exp $
|
||||
./etc/mtree/set.debug comp-sys-root
|
||||
./usr/lib comp-sys-usr compatdir
|
||||
./usr/lib/i18n/libBIG5_g.a comp-c-debuglib debuglib,compatfile
|
||||
|
@ -2063,6 +2063,8 @@
|
|||
./usr/libdata/debug/usr/tests/lib/libc/sys/t_umask.debug tests-lib-debug debug,atf,compattestfile
|
||||
./usr/libdata/debug/usr/tests/lib/libc/sys/t_unlink.debug tests-lib-debug debug,atf,compattestfile
|
||||
./usr/libdata/debug/usr/tests/lib/libc/sys/t_wait.debug tests-lib-debug debug,atf,compattestfile
|
||||
./usr/libdata/debug/usr/tests/lib/libc/sys/t_wait_noproc.debug tests-lib-debug debug,atf,compattestfile
|
||||
./usr/libdata/debug/usr/tests/lib/libc/sys/t_wait_noproc_wnohang.debug tests-lib-debug debug,atf,compattestfile
|
||||
./usr/libdata/debug/usr/tests/lib/libc/sys/t_write.debug tests-lib-debug debug,atf,compattestfile
|
||||
./usr/libdata/debug/usr/tests/lib/libc/t_cdb.debug tests-lib-debug debug,atf,compattestfile
|
||||
./usr/libdata/debug/usr/tests/lib/libc/t_cerror.debug tests-obsolete obsolete,compattestfile
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: mi,v 1.692 2016/11/06 10:54:42 alnsn Exp $
|
||||
# $NetBSD: mi,v 1.693 2016/11/06 15:03:30 kamil Exp $
|
||||
#
|
||||
# Note: don't delete entries from here - mark them as "obsolete" instead.
|
||||
#
|
||||
|
@ -2735,6 +2735,8 @@
|
|||
./usr/tests/lib/libc/sys/t_umask tests-lib-tests compattestfile,atf
|
||||
./usr/tests/lib/libc/sys/t_unlink tests-lib-tests compattestfile,atf
|
||||
./usr/tests/lib/libc/sys/t_wait tests-lib-tests compattestfile,atf
|
||||
./usr/tests/lib/libc/sys/t_wait_noproc tests-lib-tests compattestfile,atf
|
||||
./usr/tests/lib/libc/sys/t_wait_noproc_wnohang tests-lib-tests compattestfile,atf
|
||||
./usr/tests/lib/libc/sys/t_write tests-lib-tests compattestfile,atf
|
||||
./usr/tests/lib/libc/t_atexit tests-obsolete obsolete
|
||||
./usr/tests/lib/libc/t_cdb tests-lib-tests compattestfile,atf
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.43 2016/07/30 11:03:54 njoly Exp $
|
||||
# $NetBSD: Makefile,v 1.44 2016/11/06 15:04:14 kamil Exp $
|
||||
|
||||
MKMAN= no
|
||||
|
||||
|
@ -67,6 +67,8 @@ TESTS_C+= t_ucontext
|
|||
TESTS_C+= t_umask
|
||||
TESTS_C+= t_unlink
|
||||
TESTS_C+= t_wait
|
||||
TESTS_C+= t_wait_noproc
|
||||
TESTS_C+= t_wait_noproc_wnohang
|
||||
TESTS_C+= t_write
|
||||
|
||||
SRCS.t_mprotect= t_mprotect.c ${SRCS_EXEC_PROT}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: t_wait.c,v 1.6 2016/11/06 02:28:57 kamil Exp $ */
|
||||
/* $NetBSD: t_wait.c,v 1.7 2016/11/06 15:04:14 kamil Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2016 The NetBSD Foundation, Inc.
|
||||
|
@ -29,7 +29,7 @@
|
|||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: t_wait.c,v 1.6 2016/11/06 02:28:57 kamil Exp $");
|
||||
__RCSID("$NetBSD: t_wait.c,v 1.7 2016/11/06 15:04:14 kamil Exp $");
|
||||
|
||||
#include <sys/wait.h>
|
||||
#include <sys/resource.h>
|
||||
|
@ -60,22 +60,6 @@ ATF_TC_BODY(wait6_invalid, tc)
|
|||
&& errno == EINVAL);
|
||||
}
|
||||
|
||||
ATF_TC(wait6_noproc);
|
||||
ATF_TC_HEAD(wait6_noproc, tc)
|
||||
{
|
||||
atf_tc_set_md_var(tc, "descr",
|
||||
"Test that wait6(2) returns ECHILD with for no processes");
|
||||
}
|
||||
|
||||
ATF_TC_BODY(wait6_noproc, tc)
|
||||
{
|
||||
siginfo_t si;
|
||||
struct wrusage wru;
|
||||
int st;
|
||||
ATF_REQUIRE(wait6(P_ALL, 0, &st, WEXITED, &wru, &si) == -1
|
||||
&& errno == ECHILD);
|
||||
}
|
||||
|
||||
ATF_TC(wait6_exited);
|
||||
ATF_TC_HEAD(wait6_exited, tc)
|
||||
{
|
||||
|
@ -311,7 +295,6 @@ ATF_TP_ADD_TCS(tp)
|
|||
{
|
||||
|
||||
ATF_TP_ADD_TC(tp, wait6_invalid);
|
||||
ATF_TP_ADD_TC(tp, wait6_noproc);
|
||||
ATF_TP_ADD_TC(tp, wait6_exited);
|
||||
ATF_TP_ADD_TC(tp, wait6_terminated);
|
||||
ATF_TP_ADD_TC(tp, wait6_coredumped);
|
||||
|
|
|
@ -0,0 +1,166 @@
|
|||
/* $NetBSD: t_wait_noproc.c,v 1.1 2016/11/06 15:03:30 kamil Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2016 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: t_wait_noproc.c,v 1.1 2016/11/06 15:03:30 kamil Exp $");
|
||||
|
||||
#include <sys/wait.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <atf-c.h>
|
||||
|
||||
#ifndef TWAIT_OPTION
|
||||
#define TWAIT_OPTION 0
|
||||
#endif
|
||||
|
||||
#if TWAIT_OPTION == 0
|
||||
ATF_TC(wait);
|
||||
ATF_TC_HEAD(wait, tc)
|
||||
{
|
||||
atf_tc_set_md_var(tc, "descr",
|
||||
"Test that wait(2) returns ECHILD for no child");
|
||||
}
|
||||
|
||||
ATF_TC_BODY(wait, tc)
|
||||
{
|
||||
errno = 0;
|
||||
ATF_REQUIRE(wait(NULL) == -1);
|
||||
ATF_REQUIRE(errno == ECHILD);
|
||||
}
|
||||
#endif
|
||||
|
||||
ATF_TC(waitpid);
|
||||
ATF_TC_HEAD(waitpid, tc)
|
||||
{
|
||||
atf_tc_set_md_var(tc, "descr",
|
||||
"Test that waitpid(2) returns ECHILD for WAIT_ANY and option %s",
|
||||
___STRING(TWAIT_OPTION));
|
||||
}
|
||||
|
||||
ATF_TC_BODY(waitpid, tc)
|
||||
{
|
||||
#if TWAIT_OPTION
|
||||
/* wait4() (and friends) with WNOHANG and no children does not error */
|
||||
atf_tc_expect_fail("PR standards/51606");
|
||||
#endif
|
||||
errno = 0;
|
||||
ATF_REQUIRE(waitpid(WAIT_ANY, NULL, TWAIT_OPTION) == -1);
|
||||
ATF_REQUIRE(errno == ECHILD);
|
||||
}
|
||||
|
||||
ATF_TC(waitid);
|
||||
ATF_TC_HEAD(waitid, tc)
|
||||
{
|
||||
atf_tc_set_md_var(tc, "descr",
|
||||
"Test that waitid(2) returns ECHILD for P_ALL and option %s",
|
||||
___STRING(TWAIT_OPTION));
|
||||
}
|
||||
|
||||
ATF_TC_BODY(waitid, tc)
|
||||
{
|
||||
#if TWAIT_OPTION
|
||||
/* wait4() (and friends) with WNOHANG and no children does not error */
|
||||
atf_tc_expect_fail("PR standards/51606");
|
||||
#endif
|
||||
errno = 0;
|
||||
ATF_REQUIRE(waitid(P_ALL, 0, NULL, WEXITED | TWAIT_OPTION) == -1);
|
||||
ATF_REQUIRE(errno == ECHILD);
|
||||
}
|
||||
|
||||
#if TWAIT_OPTION == 0
|
||||
ATF_TC(wait3);
|
||||
ATF_TC_HEAD(wait3, tc)
|
||||
{
|
||||
atf_tc_set_md_var(tc, "descr",
|
||||
"Test that wait3(2) returns ECHILD for no child");
|
||||
}
|
||||
|
||||
ATF_TC_BODY(wait3, tc)
|
||||
{
|
||||
errno = 0;
|
||||
ATF_REQUIRE(wait3(NULL, 0, NULL) == -1);
|
||||
ATF_REQUIRE(errno == ECHILD);
|
||||
}
|
||||
#endif
|
||||
|
||||
ATF_TC(wait4);
|
||||
ATF_TC_HEAD(wait4, tc)
|
||||
{
|
||||
atf_tc_set_md_var(tc, "descr",
|
||||
"Test that wait4(2) returns ECHILD for WAIT_ANY and option %s",
|
||||
___STRING(TWAIT_OPTION));
|
||||
}
|
||||
|
||||
ATF_TC_BODY(wait4, tc)
|
||||
{
|
||||
#if TWAIT_OPTION
|
||||
/* wait4() (and friends) with WNOHANG and no children does not error */
|
||||
atf_tc_expect_fail("PR standards/51606");
|
||||
#endif
|
||||
errno = 0;
|
||||
ATF_REQUIRE(wait4(WAIT_ANY, NULL, TWAIT_OPTION, NULL) == -1);
|
||||
ATF_REQUIRE(errno == ECHILD);
|
||||
}
|
||||
|
||||
ATF_TC(wait6);
|
||||
ATF_TC_HEAD(wait6, tc)
|
||||
{
|
||||
atf_tc_set_md_var(tc, "descr",
|
||||
"Test that wait6(2) returns ECHILD for P_ALL and option %s",
|
||||
___STRING(TWAIT_OPTION));
|
||||
}
|
||||
|
||||
ATF_TC_BODY(wait6, tc)
|
||||
{
|
||||
#if TWAIT_OPTION
|
||||
/* wait4() (and friends) with WNOHANG and no children does not error */
|
||||
atf_tc_expect_fail("PR standards/51606");
|
||||
#endif
|
||||
errno = 0;
|
||||
ATF_REQUIRE(wait6(P_ALL, 0, NULL, WEXITED | TWAIT_OPTION, NULL, NULL) == -1);
|
||||
ATF_REQUIRE(errno == ECHILD);
|
||||
}
|
||||
|
||||
ATF_TP_ADD_TCS(tp)
|
||||
{
|
||||
|
||||
#if TWAIT_OPTION == 0
|
||||
ATF_TP_ADD_TC(tp, wait);
|
||||
#endif
|
||||
ATF_TP_ADD_TC(tp, waitpid);
|
||||
ATF_TP_ADD_TC(tp, waitid);
|
||||
#if TWAIT_OPTION == 0
|
||||
ATF_TP_ADD_TC(tp, wait3);
|
||||
#endif
|
||||
ATF_TP_ADD_TC(tp, wait4);
|
||||
ATF_TP_ADD_TC(tp, wait6);
|
||||
|
||||
return atf_no_error();
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/* $NetBSD: t_wait_noproc_wnohang.c,v 1.1 2016/11/06 15:03:30 kamil Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2016 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define TWAIT_OPTION WNOHANG
|
||||
#include "t_wait_noproc.c"
|
Loading…
Reference in New Issue