From nobody Fri Jun 17 19:39:18 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3597F85C105; Fri, 17 Jun 2022 19:39:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LPq9f5KYdz3Qrc; Fri, 17 Jun 2022 19:39:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494758; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8p/BEaYoAT9okNZpO+IitTCzWSdnMAmyjRJWXdcHBpQ=; b=kIyX5HFrqMZq4xkHRw4fH0UafLqc20JUg33TDDlthyc6QFIsuLDnRrAT3hpAu5E4iBURko DfGX2PJJH+0RMc8B6vW3KM8IPsmvnDAjohYlPKQdwE/bT1EM/Eg0bynWX+VWRr4cPmqHEZ xc143Q/I1Lt0Han7v2tGetr2KW2908frBlVy/wl/GRuRNjdkCx+occWFR7zbuIjenjWZ0f NmUR5A7PJJJJ34fTZPBUoPGeBPikMdnJ6ZQw/cK672JPP2ZSyJDLprd/jB7KQuQm5nu0vt g4o1U4gR3sgpickvPDrQCpT9YWGVGPGfq+3QZfkRvu8qOtjLR8rieceo8cOMSw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 85E7425C98; Fri, 17 Jun 2022 19:39:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25HJdIxI015835; Fri, 17 Jun 2022 19:39:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25HJdI16015834; Fri, 17 Jun 2022 19:39:18 GMT (envelope-from git) Date: Fri, 17 Jun 2022 19:39:18 GMT Message-Id: <202206171939.25HJdI16015834@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: bbc82e55365d - stable/13 - Add tests for sigwait family syscalls. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bbc82e55365db3a838106cf4d543f22b9ddc26c4 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494758; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8p/BEaYoAT9okNZpO+IitTCzWSdnMAmyjRJWXdcHBpQ=; b=JQ2fiQJVJRrHb3T84pnmZHob/BqVR4v0eg1Oqg0TjM7PGnf09g6PurCWW/j5n/TP5kzOXb UygANUWpKRmsFowp3Z08xhIbXnpqkL5e32h+b4UcWVdIb6xIFIop1yQQUZqKiqJ5LWi1ar DL5qELGz6pxf0toxJBzAle2n85ey2zWSO22sB0EY2XJE4iXCqUHekUdVeOpxbn1MdW5qAA DHTBJ3x1dwipx8So01fGaFobtyQ/VE25ybV5CeUdsjdmtERZwAAgU470Q850E97CDwhsuN 2uNAHgyFMfedp9uzj6u1T5hc1xHC+vRuYnil9VW13jogZ3fKS9c3eQVgF9IeVA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655494758; a=rsa-sha256; cv=none; b=gSaUnPZsnfanJEtCd07Dhna4PV1NrAGA2Iz4GNzVkmLVsfUj7q3M7oQL/sApRYgzYCGQg/ GFdqr6LWwPAADAi/01MiZ/9HZ/LrHrLezJfBiMjyFbqZEGiP78zOedKYh4tvzzqJ3HaQ21 oL697+eZVhH/IQjUJgYaED6ex0IfP6O+xM8nQNoKkGv4ZFus2xMs64tZoRaye2BeYjXa/4 HNsaKhqEAC3qJfTF6p5HCCJC41yJi5tHIu2lunO63XrA8K5plRyeAGSItnNGzo/UIyvpk/ Acv2ixW9bxuwApw3+Gb/elYAddi59G3x8sGSzfDps4NACv27LGkxSJ+ilu49sg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=bbc82e55365db3a838106cf4d543f22b9ddc26c4 commit bbc82e55365db3a838106cf4d543f22b9ddc26c4 Author: Dmitry Chagin AuthorDate: 2022-06-17 19:33:56 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-17 19:33:56 +0000 Add tests for sigwait family syscalls. MFC after: 2 weeks (cherry picked from commit 128b9bf96cae36c33b45a4d418ff502497bbb834) --- tests/sys/kern/Makefile | 2 + tests/sys/kern/sigwait.c | 584 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 586 insertions(+) diff --git a/tests/sys/kern/Makefile b/tests/sys/kern/Makefile index 82373500cd21..36aad1ec797d 100644 --- a/tests/sys/kern/Makefile +++ b/tests/sys/kern/Makefile @@ -23,6 +23,7 @@ ATF_TESTS_C+= ptrace_test TEST_METADATA.ptrace_test+= timeout="15" ATF_TESTS_C+= reaper ATF_TESTS_C+= sigaltstack +ATF_TESTS_C+= sigwait .if ${MACHINE_ARCH} != "i386" && ${MACHINE_ARCH:Mpowerpc*} == "" && \ ${MACHINE_CPUARCH} != "mips" ATF_TESTS_C+= subr_physmem_test @@ -61,6 +62,7 @@ LIBADD.kcov+= pthread LIBADD.ktls_test+= crypto LIBADD.sendfile_helper+= pthread LIBADD.fdgrowtable_test+= util pthread kvm procstat +LIBADD.sigwait+= rt NETBSD_ATF_TESTS_C+= lockf_test NETBSD_ATF_TESTS_C+= mqueue_test diff --git a/tests/sys/kern/sigwait.c b/tests/sys/kern/sigwait.c new file mode 100644 index 000000000000..0b6e078b6548 --- /dev/null +++ b/tests/sys/kern/sigwait.c @@ -0,0 +1,584 @@ +/*- + * Copyright (c) 2022 Dmitry Chagin + * + * SPDX-License-Identifier: BSD-2-Clause + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +static inline struct timespec +make_timespec(time_t s, long int ns) +{ + struct timespec rts; + + rts.tv_sec = s; + rts.tv_nsec = ns; + return (rts); +} + +static void +dummy_sig_handler(int sig) +{ + +} + +static void +dummy_sigchld(int signo, siginfo_t *info, void *ctx) +{ + +} + +static void +support_signal(int sig, sig_t handler) +{ + + ATF_REQUIRE(signal(sig, handler) != SIG_ERR); +} + +static void +support_sysctlset(const char *name, int32_t val) +{ + + ATF_REQUIRE(sysctlbyname(name, NULL, NULL, &val, sizeof(val)) == 0); +} + +static timer_t +support_create_timer(uint64_t sec, long int nsec, bool repeat, + bool callback) +{ + struct sigevent ev = { + .sigev_notify = SIGEV_SIGNAL, + .sigev_signo = SIGALRM + }; + struct itimerspec its = + { + { .tv_sec = repeat ? sec : 0, .tv_nsec = repeat ? nsec : 0 }, + { .tv_sec = sec, .tv_nsec = nsec } + }; + struct sigaction sa; + timer_t timerid; + + if (callback) { + sa.sa_handler = dummy_sig_handler; + sigemptyset (&sa.sa_mask); + sa.sa_flags = 0; + ATF_REQUIRE(sigaction(SIGALRM, &sa, NULL) == 0); + } + ATF_REQUIRE(timer_create(CLOCK_REALTIME, &ev, &timerid) == 0); + ATF_REQUIRE(timer_settime(timerid, 0, &its, NULL) == 0); + return (timerid); +} + +static void +support_delete_timer(timer_t timer) +{ + + ATF_REQUIRE(timer_delete(timer) == 0); + support_signal(SIGALRM, SIG_DFL); +} + +static pid_t +support_create_sig_proc(int sig, int count, unsigned int usec) +{ + pid_t pid, cpid; + + pid = getpid(); + ATF_REQUIRE(pid > 0); + cpid = fork(); + ATF_REQUIRE(cpid >= 0); + + if (cpid == 0) { + while (count-- > 0) { + usleep(usec); + if (kill(pid, sig) == -1) + break; + } + exit(0); + } + return (cpid); +} + +#define TIMESPEC_HZ 1000000000 + +static void +test_sigtimedwait_timeout_eagain(time_t sec, bool zero_tmo) +{ + struct timespec ts, timeout, now; + sigset_t ss; + int rv; + + ATF_REQUIRE(clock_gettime(CLOCK_REALTIME, &ts) == 0); + + timeout = make_timespec(sec, zero_tmo ? 0 : TIMESPEC_HZ/2); + timespecadd(&ts, &timeout, &ts); + + sigemptyset(&ss); + sigaddset(&ss, SIGUSR1); + rv = sigtimedwait(&ss, NULL, &timeout); + ATF_REQUIRE_EQ_MSG(-1, rv, + "sigtimedwait () should fail: rv %d, errno %d", rv, errno); + ATF_REQUIRE_EQ_MSG(EAGAIN, errno, + "sigtimedwait() should fail with EAGAIN: rv %d, errno %d", + rv, errno); + /* now >= ts */ + ATF_REQUIRE(clock_gettime(CLOCK_REALTIME, &now) == 0); + ATF_REQUIRE_MSG(timespeccmp(&now, &ts, >=) == true, + "timespeccmp: now { %ld.%ld } < ts { %ld.%ld }", + now.tv_sec, now.tv_nsec, ts.tv_sec, ts.tv_nsec); +} + +ATF_TC(test_sigtimedwait_timeout_eagain0); +ATF_TC_HEAD(test_sigtimedwait_timeout_eagain0, tc) +{ + + atf_tc_set_md_var(tc, "descr", "Check if sigtimedwait exits immediately"); +} + +ATF_TC_BODY(test_sigtimedwait_timeout_eagain0, tc) +{ + + test_sigtimedwait_timeout_eagain(0, true); +} + +ATF_TC(test_sigtimedwait_timeout_eagain1); +ATF_TC_HEAD(test_sigtimedwait_timeout_eagain1, tc) +{ + + atf_tc_set_md_var(tc, "descr", "Check if sigtimedwait exits immediately"); +} + +ATF_TC_BODY(test_sigtimedwait_timeout_eagain1, tc) +{ + + test_sigtimedwait_timeout_eagain(-1, true); +} + +ATF_TC(test_sigtimedwait_timeout_eagain2); +ATF_TC_HEAD(test_sigtimedwait_timeout_eagain2, tc) +{ + + atf_tc_set_md_var(tc, "descr", "Check if sigtimedwait exits immediately"); +} + +ATF_TC_BODY(test_sigtimedwait_timeout_eagain2, tc) +{ + + test_sigtimedwait_timeout_eagain(-1, false); +} + +ATF_TC(test_sigtimedwait_timeout_eagain3); +ATF_TC_HEAD(test_sigtimedwait_timeout_eagain3, tc) +{ + + atf_tc_set_md_var(tc, "descr", "Check if sigtimedwait exits after specified timeout"); +} + +ATF_TC_BODY(test_sigtimedwait_timeout_eagain3, tc) +{ + + test_sigtimedwait_timeout_eagain(0, false); +} + +ATF_TC(test_sigtimedwait_large_timeout_eintr); +ATF_TC_HEAD(test_sigtimedwait_large_timeout_eintr, tc) +{ + + atf_tc_set_md_var(tc, "descr", "Check if sigtimedwait exits with EINTR"); +} + +ATF_TC_BODY(test_sigtimedwait_large_timeout_eintr, tc) +{ + struct timespec ts; + timer_t timerid; + sigset_t ss; + int rv; + + ts = make_timespec(LONG_MAX, 0); + timerid = support_create_timer(0, 100000000, false, true); + + sigemptyset(&ss); + sigaddset(&ss, SIGUSR1); + rv = sigtimedwait(&ss, NULL, &ts); + ATF_REQUIRE_EQ_MSG(-1, rv, + "sigtimedwait () should fail: rv %d, errno %d", rv, errno); + ATF_REQUIRE_EQ_MSG(EINTR, errno, + "sigtimedwait() should fail with EINTR: rv %d, errno %d", + rv, errno); + support_delete_timer(timerid); +} + +ATF_TC(test_sigtimedwait_infinity); +ATF_TC_HEAD(test_sigtimedwait_infinity, tc) +{ + + atf_tc_set_md_var(tc, "descr", "Check if sigtimedwait exits with EINTR"); +} + +ATF_TC_BODY(test_sigtimedwait_infinity, tc) +{ + timer_t timerid; + sigset_t ss; + int rv; + + timerid = support_create_timer(0, 100000000, false, true); + + sigemptyset(&ss); + sigaddset(&ss, SIGUSR1); + rv = sigtimedwait(&ss, NULL, NULL); + ATF_REQUIRE_EQ_MSG(-1, rv, + "sigtimedwait () should fail: rv %d, errno %d", rv, errno); + ATF_REQUIRE_EQ_MSG(EINTR, errno, + "sigtimedwait() should fail with EINTR: rv %d, errno %d", + rv, errno); + support_delete_timer(timerid); +} + +ATF_TC(test_sigtimedwait_einval); +ATF_TC_HEAD(test_sigtimedwait_einval, tc) +{ + + atf_tc_set_md_var(tc, "descr", "Check if sigtimedwait exits with EINVAL"); +} + +ATF_TC_BODY(test_sigtimedwait_einval, tc) +{ + struct timespec ts; + timer_t timerid; + sigset_t ss; + int rv; + + ts = make_timespec(0, -1); + timerid = support_create_timer(0, 100000000, false, true); + + sigemptyset(&ss); + sigaddset(&ss, SIGUSR1); + rv = sigtimedwait(&ss, NULL, &ts); + ATF_REQUIRE_EQ_MSG(-1, rv, + "sigtimedwait () should fail: rv %d, errno %d", rv, errno); + ATF_REQUIRE_EQ_MSG(EINVAL, errno, + "sigtimedwait() should fail with EINVAL: rv %d, errno %d", + rv, errno); + support_delete_timer(timerid); +} + +ATF_TC(test_sigwait_eintr); +ATF_TC_HEAD(test_sigwait_eintr, tc) +{ + + atf_tc_set_md_var(tc, "descr", "Check if sigwait exits with EINTR"); +} + +ATF_TC_BODY(test_sigwait_eintr, tc) +{ + timer_t timerid; + sigset_t ss; + int rv, sig, pid; + + support_signal(SIGUSR1, dummy_sig_handler); + + pid = support_create_sig_proc(SIGUSR1, 1, 400000); + timerid = support_create_timer(0, 200000, false, true); + + sigemptyset(&ss); + sigaddset(&ss, SIGUSR1); + rv = sigwait(&ss, &sig); + ATF_REQUIRE_EQ_MSG(0, rv, + "sigwait() should not fail: rv %d, errno %d", rv, errno); + ATF_REQUIRE_EQ_MSG(SIGUSR1, sig, + "sigwait() should return SIGUSR1: rv %d, sig %d", rv, sig); + ATF_REQUIRE(waitid(P_PID, pid, NULL, WEXITED) == 0); + support_delete_timer(timerid); +} + +ATF_TC(test_sigwaitinfo_eintr); +ATF_TC_HEAD(test_sigwaitinfo_eintr, tc) +{ + + atf_tc_set_md_var(tc, "descr", "Check if sigwaitinfo exits with EINTR"); +} + +ATF_TC_BODY(test_sigwaitinfo_eintr, tc) +{ + timer_t timerid; + sigset_t ss; + int rv; + + timerid = support_create_timer(0, 100000000, false, true); + + sigemptyset(&ss); + sigaddset(&ss, SIGUSR1); + rv = sigwaitinfo(&ss, NULL); + ATF_REQUIRE_EQ_MSG(-1, rv, + "sigwaitinfo() should fail, rv %d != -1", rv); + ATF_REQUIRE_EQ_MSG(EINTR, errno, + "sigwaitinfo() should fail errno %d != EINTR", errno); + support_delete_timer(timerid); +} + +/* + * Test kern.sig_discard_ign knob (default true). + * See commit bc387624 + */ +static void +test_sig_discard_ign(bool ignore) +{ + struct timespec ts; + sigset_t mask; + pid_t pid; + int rv; + + support_signal(SIGUSR2, SIG_IGN); + + if (ignore) + support_sysctlset("kern.sig_discard_ign", 1); + else + support_sysctlset("kern.sig_discard_ign", 0); + + sigemptyset(&mask); + sigaddset(&mask, SIGUSR2); + ATF_REQUIRE(sigprocmask(SIG_SETMASK, &mask, NULL) == 0); + + pid = support_create_sig_proc(SIGUSR2, 1, 100000); + + ts = make_timespec(1, 0); + rv = sigtimedwait(&mask, NULL, &ts); + if (ignore == true) { + ATF_REQUIRE_EQ_MSG(-1, rv, + "sigtimedwait() ign=on should fail, rv %d != -1", rv); + ATF_REQUIRE_EQ_MSG(EAGAIN, errno, + "sigtimedwait() ign=on should fail with EAGAIN errno %d", + errno); + } else + ATF_REQUIRE_EQ_MSG(SIGUSR2, rv, + "sigtimedwait() ign=off should return SIGUSR2, rv %d errno %d", + rv, errno); + ATF_REQUIRE(waitid(P_PID, pid, NULL, WEXITED) == 0); +} + +static void +support_check_siginfo(int code, int status, pid_t pid, + siginfo_t *si, int sig) +{ + + ATF_REQUIRE_EQ_MSG(sig, si->si_signo, + "check_siginfo: si_signo %d != sig %d", si->si_signo, sig); + ATF_REQUIRE_EQ_MSG(code, si->si_code, + "check_siginfo: si_code %d != code %d", si->si_code, code); + ATF_REQUIRE_EQ_MSG(status, si->si_status, + "check_siginfo: si_status %d != status %d", si->si_status, status); + ATF_REQUIRE_EQ_MSG(pid, si->si_pid, + "check_siginfo: si_pid %d != pid %d", si->si_pid, pid); +} + +static void +support_check_sigchld(sigset_t *set, int code, int status, pid_t pid, + bool dequeue) +{ + siginfo_t si; + int sig, kpid; + + if (dequeue == true) + kpid = support_create_sig_proc(SIGUSR2, 1, 1000000); + + sig = sigwaitinfo(set, &si); + if (dequeue == true) { + ATF_REQUIRE_EQ_MSG(-1, sig, + "sigwaitinfo() should fail, sig %d != -1", sig); + ATF_REQUIRE_EQ_MSG(EINTR, errno, + "sigwaitinfo() should fail errno %d != EINTR", errno); + } else + ATF_REQUIRE_EQ_MSG(SIGCHLD, sig, + "sigwaitinfo() %d != SIGCHLD", sig); + if (dequeue == false) + support_check_siginfo(code, status, pid, &si, SIGCHLD); + if (dequeue == true) + ATF_REQUIRE(waitid(P_PID, kpid, &si, WEXITED) == 0); +} + +static void +test_child(void) +{ + + raise(SIGSTOP); + while (1) + pause(); +} + +/* + * Test kern.wait_dequeue_sigchld knob. + */ +static void +test_wait_dequeue_sigchld(bool dequeue) +{ + struct sigaction sa; + siginfo_t si; + sigset_t set; + pid_t pid; + + sa.sa_flags = SA_SIGINFO | SA_RESTART; + sa.sa_sigaction = dummy_sigchld; + sigemptyset(&sa.sa_mask); + ATF_REQUIRE(sigaction(SIGCHLD, &sa, NULL) == 0); + + support_signal(SIGUSR2, dummy_sig_handler); + + sigemptyset(&set); + sigaddset(&set, SIGCHLD); + ATF_REQUIRE(sigprocmask(SIG_BLOCK, &set, NULL) == 0); + + if (dequeue) + support_sysctlset("kern.wait_dequeue_sigchld", 1); + else + support_sysctlset("kern.wait_dequeue_sigchld", 0); + + pid = fork(); + ATF_REQUIRE(pid >= 0); + if (pid == 0) { + test_child(); + exit(0); + } + + bzero(&si, sizeof(si)); + ATF_REQUIRE(waitid(P_PID, pid, &si, WSTOPPED) == 0); + + support_check_siginfo(CLD_STOPPED, SIGSTOP, pid, &si, SIGCHLD); + support_check_sigchld(&set, CLD_STOPPED, SIGSTOP, pid, dequeue); + + ATF_REQUIRE(kill(pid, SIGCONT) == 0); + + bzero(&si, sizeof(si)); + ATF_REQUIRE(waitid(P_PID, pid, &si, WCONTINUED) == 0); + + support_check_siginfo(CLD_CONTINUED, SIGCONT, pid, &si, SIGCHLD); + support_check_sigchld(&set, CLD_CONTINUED, SIGCONT, pid, dequeue); + + ATF_REQUIRE(kill(pid, SIGKILL) == 0); + + bzero(&si, sizeof(si)); + ATF_REQUIRE(waitid(P_PID, pid, &si, WEXITED) == 0); + + support_check_siginfo(CLD_KILLED, SIGKILL, pid, &si, SIGCHLD); +} + +ATF_TC_WITH_CLEANUP(test_sig_discard_ign_true); +ATF_TC_HEAD(test_sig_discard_ign_true, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); + atf_tc_set_md_var(tc, "descr", "Test kern.sig_discard_ign on"); +} + +ATF_TC_BODY(test_sig_discard_ign_true, tc) +{ + + test_sig_discard_ign(true); +} + +ATF_TC_CLEANUP(test_sig_discard_ign_true, tc) +{ + + support_sysctlset("kern.sig_discard_ign", 1); +} + +ATF_TC_WITH_CLEANUP(test_sig_discard_ign_false); +ATF_TC_HEAD(test_sig_discard_ign_false, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); + atf_tc_set_md_var(tc, "descr", "Test kern.sig_discard_ign off"); +} + +ATF_TC_BODY(test_sig_discard_ign_false, tc) +{ + + test_sig_discard_ign(false); +} + +ATF_TC_CLEANUP(test_sig_discard_ign_false, tc) +{ + + support_sysctlset("kern.sig_discard_ign", 1); +} + +ATF_TC_WITH_CLEANUP(test_wait_dequeue_sigchld_true); +ATF_TC_HEAD(test_wait_dequeue_sigchld_true, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); + atf_tc_set_md_var(tc, "descr", "Test kern.wait_dequeue_sigchld on"); +} + +ATF_TC_BODY(test_wait_dequeue_sigchld_true, tc) +{ + + test_wait_dequeue_sigchld(true); +} + +ATF_TC_CLEANUP(test_wait_dequeue_sigchld_true, tc) +{ + + support_sysctlset("kern.wait_dequeue_sigchld", 1); +} + +ATF_TC_WITH_CLEANUP(test_wait_dequeue_sigchld_false); +ATF_TC_HEAD(test_wait_dequeue_sigchld_false, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); + atf_tc_set_md_var(tc, "descr", "Test kern.wait_dequeue_sigchld off"); +} + +ATF_TC_BODY(test_wait_dequeue_sigchld_false, tc) +{ + + test_wait_dequeue_sigchld(false); +} + +ATF_TC_CLEANUP(test_wait_dequeue_sigchld_false, tc) +{ + + support_sysctlset("kern.wait_dequeue_sigchld", 1); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, test_sigtimedwait_timeout_eagain0); + ATF_TP_ADD_TC(tp, test_sigtimedwait_timeout_eagain1); + ATF_TP_ADD_TC(tp, test_sigtimedwait_timeout_eagain2); + ATF_TP_ADD_TC(tp, test_sigtimedwait_timeout_eagain3); + + ATF_TP_ADD_TC(tp, test_sigtimedwait_large_timeout_eintr); + ATF_TP_ADD_TC(tp, test_sigtimedwait_infinity); + + ATF_TP_ADD_TC(tp, test_sigtimedwait_einval); + + ATF_TP_ADD_TC(tp, test_sigwait_eintr); + ATF_TP_ADD_TC(tp, test_sigwaitinfo_eintr); + + ATF_TP_ADD_TC(tp, test_sig_discard_ign_true); + ATF_TP_ADD_TC(tp, test_sig_discard_ign_false); + + ATF_TP_ADD_TC(tp, test_wait_dequeue_sigchld_true); + ATF_TP_ADD_TC(tp, test_wait_dequeue_sigchld_false); + + return (atf_no_error()); +}