xref: /freebsd/contrib/netbsd-tests/lib/libc/sys/t_wait.c (revision 0c47338023d44ff130cf69465bd1b2e75ff0bb39)
163d1fd59SEnji Cooper /* $NetBSD: t_wait.c,v 1.8 2017/01/13 19:28:55 christos Exp $ */
2640235e2SEnji Cooper 
3640235e2SEnji Cooper /*-
4640235e2SEnji Cooper  * Copyright (c) 2016 The NetBSD Foundation, Inc.
5640235e2SEnji Cooper  * All rights reserved.
6640235e2SEnji Cooper  *
7640235e2SEnji Cooper  * This code is derived from software contributed to The NetBSD Foundation
8640235e2SEnji Cooper  * by Christos Zoulas.
9640235e2SEnji Cooper  *
10640235e2SEnji Cooper  * Redistribution and use in source and binary forms, with or without
11640235e2SEnji Cooper  * modification, are permitted provided that the following conditions
12640235e2SEnji Cooper  * are met:
13640235e2SEnji Cooper  * 1. Redistributions of source code must retain the above copyright
14640235e2SEnji Cooper  *    notice, this list of conditions and the following disclaimer.
15640235e2SEnji Cooper  * 2. Redistributions in binary form must reproduce the above copyright
16640235e2SEnji Cooper  *    notice, this list of conditions and the following disclaimer in the
17640235e2SEnji Cooper  *    documentation and/or other materials provided with the distribution.
18640235e2SEnji Cooper  *
19640235e2SEnji Cooper  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20640235e2SEnji Cooper  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21640235e2SEnji Cooper  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22640235e2SEnji Cooper  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23640235e2SEnji Cooper  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24640235e2SEnji Cooper  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25640235e2SEnji Cooper  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26640235e2SEnji Cooper  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27640235e2SEnji Cooper  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28640235e2SEnji Cooper  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29640235e2SEnji Cooper  * POSSIBILITY OF SUCH DAMAGE.
30640235e2SEnji Cooper  */
31640235e2SEnji Cooper #include <sys/cdefs.h>
3263d1fd59SEnji Cooper __RCSID("$NetBSD: t_wait.c,v 1.8 2017/01/13 19:28:55 christos Exp $");
33640235e2SEnji Cooper 
346dfb9460SJohn Baldwin #ifdef __FreeBSD__
356dfb9460SJohn Baldwin #include <sys/types.h>
366dfb9460SJohn Baldwin #include <sys/sysctl.h>
376dfb9460SJohn Baldwin #endif
38640235e2SEnji Cooper #include <sys/wait.h>
39640235e2SEnji Cooper #include <sys/resource.h>
40640235e2SEnji Cooper 
41640235e2SEnji Cooper #include <errno.h>
4263d1fd59SEnji Cooper #include <inttypes.h>
43640235e2SEnji Cooper #include <limits.h>
44640235e2SEnji Cooper #include <pwd.h>
45640235e2SEnji Cooper #include <signal.h>
4663d1fd59SEnji Cooper #include <stdio.h>
47640235e2SEnji Cooper #include <stdlib.h>
48640235e2SEnji Cooper #include <unistd.h>
49640235e2SEnji Cooper 
50640235e2SEnji Cooper #include <atf-c.h>
51640235e2SEnji Cooper 
52640235e2SEnji Cooper ATF_TC(wait6_invalid);
ATF_TC_HEAD(wait6_invalid,tc)53640235e2SEnji Cooper ATF_TC_HEAD(wait6_invalid, tc)
54640235e2SEnji Cooper {
55640235e2SEnji Cooper 	atf_tc_set_md_var(tc, "descr",
56640235e2SEnji Cooper 	    "Test that wait6(2) returns EINVAL with 0 options");
57640235e2SEnji Cooper }
58640235e2SEnji Cooper 
ATF_TC_BODY(wait6_invalid,tc)59640235e2SEnji Cooper ATF_TC_BODY(wait6_invalid, tc)
60640235e2SEnji Cooper {
61640235e2SEnji Cooper 	siginfo_t si;
62640235e2SEnji Cooper 	struct wrusage wru;
63640235e2SEnji Cooper 	int st;
64640235e2SEnji Cooper 	ATF_REQUIRE(wait6(P_ALL, 0, &st, 0, &wru, &si) == -1
65640235e2SEnji Cooper 	    && errno == EINVAL);
66640235e2SEnji Cooper }
67640235e2SEnji Cooper 
68640235e2SEnji Cooper ATF_TC(wait6_exited);
ATF_TC_HEAD(wait6_exited,tc)69640235e2SEnji Cooper ATF_TC_HEAD(wait6_exited, tc)
70640235e2SEnji Cooper {
71640235e2SEnji Cooper 	atf_tc_set_md_var(tc, "descr",
72640235e2SEnji Cooper 	    "Test that wait6(2) handled exiting process and code");
73640235e2SEnji Cooper }
74640235e2SEnji Cooper 
ATF_TC_BODY(wait6_exited,tc)75640235e2SEnji Cooper ATF_TC_BODY(wait6_exited, tc)
76640235e2SEnji Cooper {
77640235e2SEnji Cooper 	siginfo_t si;
78640235e2SEnji Cooper 	struct wrusage wru;
79640235e2SEnji Cooper 	int st;
80640235e2SEnji Cooper 	pid_t pid;
81640235e2SEnji Cooper 
82640235e2SEnji Cooper 	switch (pid = fork()) {
83640235e2SEnji Cooper 	case -1:
84640235e2SEnji Cooper 		ATF_REQUIRE(pid > 0);
85640235e2SEnji Cooper 	case 0:
86640235e2SEnji Cooper 		exit(0x5a5a5a5a);
87640235e2SEnji Cooper 		/*NOTREACHED*/
88640235e2SEnji Cooper 	default:
89640235e2SEnji Cooper 		ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
90640235e2SEnji Cooper 		ATF_REQUIRE(WIFEXITED(st) && WEXITSTATUS(st) == 0x5a);
91*0c473380SJilles Tjoelker 		ATF_REQUIRE(si.si_status == 0x5a5a5a5a);
92640235e2SEnji Cooper 		ATF_REQUIRE(si.si_pid == pid);
93640235e2SEnji Cooper 		ATF_REQUIRE(si.si_uid == getuid());
94640235e2SEnji Cooper 		ATF_REQUIRE(si.si_code == CLD_EXITED);
95640235e2SEnji Cooper #ifdef __NetBSD__
96640235e2SEnji Cooper 		printf("user: %ju system: %ju\n", (uintmax_t)si.si_utime,
97640235e2SEnji Cooper 		    (uintmax_t)si.si_utime);
98640235e2SEnji Cooper #endif
99640235e2SEnji Cooper 		break;
100640235e2SEnji Cooper 	}
101640235e2SEnji Cooper }
102640235e2SEnji Cooper 
103640235e2SEnji Cooper ATF_TC(wait6_terminated);
ATF_TC_HEAD(wait6_terminated,tc)104640235e2SEnji Cooper ATF_TC_HEAD(wait6_terminated, tc)
105640235e2SEnji Cooper {
106640235e2SEnji Cooper 	atf_tc_set_md_var(tc, "descr",
107640235e2SEnji Cooper 	    "Test that wait6(2) handled terminated process and code");
108640235e2SEnji Cooper }
109640235e2SEnji Cooper 
ATF_TC_BODY(wait6_terminated,tc)110640235e2SEnji Cooper ATF_TC_BODY(wait6_terminated, tc)
111640235e2SEnji Cooper {
112640235e2SEnji Cooper 	siginfo_t si;
113640235e2SEnji Cooper 	struct wrusage wru;
114640235e2SEnji Cooper 	int st;
115640235e2SEnji Cooper 	pid_t pid;
116640235e2SEnji Cooper 
117640235e2SEnji Cooper 	switch (pid = fork()) {
118640235e2SEnji Cooper 	case 0:
119640235e2SEnji Cooper 		sleep(100);
120640235e2SEnji Cooper 		/*FALLTHROUGH*/
121640235e2SEnji Cooper 	case -1:
122640235e2SEnji Cooper 		ATF_REQUIRE(pid > 0);
123640235e2SEnji Cooper 	default:
124640235e2SEnji Cooper 		ATF_REQUIRE(kill(pid, SIGTERM) == 0);
125640235e2SEnji Cooper 		ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
126640235e2SEnji Cooper 		ATF_REQUIRE(WIFSIGNALED(st) && WTERMSIG(st) == SIGTERM);
127640235e2SEnji Cooper 		ATF_REQUIRE(si.si_status == SIGTERM);
128640235e2SEnji Cooper 		ATF_REQUIRE(si.si_pid == pid);
129640235e2SEnji Cooper 		ATF_REQUIRE(si.si_uid == getuid());
130640235e2SEnji Cooper 		ATF_REQUIRE(si.si_code == CLD_KILLED);
131640235e2SEnji Cooper #ifdef __NetBSD__
132640235e2SEnji Cooper 		printf("user: %ju system: %ju\n", (uintmax_t)si.si_utime,
133640235e2SEnji Cooper 		    (uintmax_t)si.si_utime);
134640235e2SEnji Cooper #endif
135640235e2SEnji Cooper 		break;
136640235e2SEnji Cooper 	}
137640235e2SEnji Cooper }
138640235e2SEnji Cooper 
139640235e2SEnji Cooper ATF_TC(wait6_coredumped);
ATF_TC_HEAD(wait6_coredumped,tc)140640235e2SEnji Cooper ATF_TC_HEAD(wait6_coredumped, tc)
141640235e2SEnji Cooper {
142640235e2SEnji Cooper 	atf_tc_set_md_var(tc, "descr",
143640235e2SEnji Cooper 	    "Test that wait6(2) handled coredumped process and code");
144640235e2SEnji Cooper }
145640235e2SEnji Cooper 
ATF_TC_BODY(wait6_coredumped,tc)146640235e2SEnji Cooper ATF_TC_BODY(wait6_coredumped, tc)
147640235e2SEnji Cooper {
148640235e2SEnji Cooper 	siginfo_t si;
149640235e2SEnji Cooper 	struct wrusage wru;
150640235e2SEnji Cooper 	int st;
151640235e2SEnji Cooper 	pid_t pid;
152640235e2SEnji Cooper 	static const struct rlimit rl = { RLIM_INFINITY, RLIM_INFINITY };
153640235e2SEnji Cooper 
1546dfb9460SJohn Baldwin #ifdef __FreeBSD__
1556dfb9460SJohn Baldwin 	int coredump_enabled;
1566dfb9460SJohn Baldwin 	size_t ce_len = sizeof(coredump_enabled);
1576dfb9460SJohn Baldwin 	if (sysctlbyname("kern.coredump", &coredump_enabled, &ce_len, NULL,
1586dfb9460SJohn Baldwin 	    0) == 0 && !coredump_enabled)
1596dfb9460SJohn Baldwin 		atf_tc_skip("Coredumps disabled");
1606dfb9460SJohn Baldwin #endif
1616dfb9460SJohn Baldwin 
162640235e2SEnji Cooper 	switch (pid = fork()) {
163640235e2SEnji Cooper 	case 0:
164640235e2SEnji Cooper 		ATF_REQUIRE(setrlimit(RLIMIT_CORE, &rl) == 0);
165640235e2SEnji Cooper 		*(char *)8 = 0;
166640235e2SEnji Cooper 		/*FALLTHROUGH*/
167640235e2SEnji Cooper 	case -1:
168640235e2SEnji Cooper 		ATF_REQUIRE(pid > 0);
169640235e2SEnji Cooper 	default:
170640235e2SEnji Cooper 		ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
171640235e2SEnji Cooper 		ATF_REQUIRE(WIFSIGNALED(st) && WTERMSIG(st) == SIGSEGV
172640235e2SEnji Cooper 		    && WCOREDUMP(st));
173640235e2SEnji Cooper 		ATF_REQUIRE(si.si_status == SIGSEGV);
174640235e2SEnji Cooper 		ATF_REQUIRE(si.si_pid == pid);
175640235e2SEnji Cooper 		ATF_REQUIRE(si.si_uid == getuid());
176640235e2SEnji Cooper 		ATF_REQUIRE(si.si_code == CLD_DUMPED);
177640235e2SEnji Cooper #ifdef __NetBSD__
178640235e2SEnji Cooper 		printf("user: %ju system: %ju\n", (uintmax_t)si.si_utime,
179640235e2SEnji Cooper 		    (uintmax_t)si.si_utime);
180640235e2SEnji Cooper #endif
181640235e2SEnji Cooper 		break;
182640235e2SEnji Cooper 	}
183640235e2SEnji Cooper }
184640235e2SEnji Cooper 
185640235e2SEnji Cooper ATF_TC(wait6_stop_and_go);
ATF_TC_HEAD(wait6_stop_and_go,tc)186640235e2SEnji Cooper ATF_TC_HEAD(wait6_stop_and_go, tc)
187640235e2SEnji Cooper {
188640235e2SEnji Cooper 	atf_tc_set_md_var(tc, "descr",
189640235e2SEnji Cooper 	    "Test that wait6(2) handled stopped/continued process and code");
190640235e2SEnji Cooper }
191640235e2SEnji Cooper 
ATF_TC_BODY(wait6_stop_and_go,tc)192640235e2SEnji Cooper ATF_TC_BODY(wait6_stop_and_go, tc)
193640235e2SEnji Cooper {
194640235e2SEnji Cooper 	siginfo_t si;
195640235e2SEnji Cooper 	struct wrusage wru;
196640235e2SEnji Cooper 	int st;
197640235e2SEnji Cooper 	pid_t pid;
198640235e2SEnji Cooper 	static const struct rlimit rl = { 0, 0 };
199640235e2SEnji Cooper 
200640235e2SEnji Cooper 	ATF_REQUIRE(setrlimit(RLIMIT_CORE, &rl) == 0);
201640235e2SEnji Cooper 	switch (pid = fork()) {
202640235e2SEnji Cooper 	case 0:
203640235e2SEnji Cooper 		sleep(100);
204640235e2SEnji Cooper 		/*FALLTHROUGH*/
205640235e2SEnji Cooper 	case -1:
206640235e2SEnji Cooper 		ATF_REQUIRE(pid > 0);
207640235e2SEnji Cooper 	default:
208640235e2SEnji Cooper 		ATF_REQUIRE(kill(pid, SIGSTOP) == 0);
209640235e2SEnji Cooper 		ATF_REQUIRE(wait6(P_PID, pid, &st, WSTOPPED, &wru, &si) == pid);
210ddba0402SEnji Cooper 		ATF_REQUIRE(!WIFEXITED(st));
211ddba0402SEnji Cooper 		ATF_REQUIRE(!WIFSIGNALED(st));
212640235e2SEnji Cooper 		ATF_REQUIRE(WIFSTOPPED(st) && WSTOPSIG(st) == SIGSTOP);
213ddba0402SEnji Cooper 		ATF_REQUIRE(!WIFCONTINUED(st));
214640235e2SEnji Cooper 		ATF_REQUIRE(si.si_status == SIGSTOP);
215640235e2SEnji Cooper 		ATF_REQUIRE(si.si_pid == pid);
216640235e2SEnji Cooper 		ATF_REQUIRE(si.si_uid == getuid());
217640235e2SEnji Cooper 		ATF_REQUIRE(si.si_code == CLD_STOPPED);
218640235e2SEnji Cooper #ifdef __NetBSD__
219640235e2SEnji Cooper 		printf("user: %ju system: %ju\n", (uintmax_t)si.si_utime,
220640235e2SEnji Cooper 		    (uintmax_t)si.si_utime);
221640235e2SEnji Cooper #endif
222640235e2SEnji Cooper 
223640235e2SEnji Cooper 		ATF_REQUIRE(kill(pid, SIGCONT) == 0);
224640235e2SEnji Cooper 		ATF_REQUIRE(wait6(P_PID, pid, &st, WCONTINUED, &wru, &si) == pid);
225ddba0402SEnji Cooper 		ATF_REQUIRE(!WIFEXITED(st));
226ddba0402SEnji Cooper 		ATF_REQUIRE(!WIFSIGNALED(st));
227640235e2SEnji Cooper 		ATF_REQUIRE(WIFCONTINUED(st));
228ddba0402SEnji Cooper 		ATF_REQUIRE(!WIFSTOPPED(st));
229640235e2SEnji Cooper 		ATF_REQUIRE(si.si_status == SIGCONT);
230640235e2SEnji Cooper 		ATF_REQUIRE(si.si_pid == pid);
231640235e2SEnji Cooper 		ATF_REQUIRE(si.si_uid == getuid());
232640235e2SEnji Cooper 		ATF_REQUIRE(si.si_code == CLD_CONTINUED);
233640235e2SEnji Cooper #ifdef __NetBSD__
234640235e2SEnji Cooper 		printf("user: %ju system: %ju\n", (uintmax_t)si.si_utime,
235640235e2SEnji Cooper 		    (uintmax_t)si.si_utime);
236640235e2SEnji Cooper #endif
237640235e2SEnji Cooper 
238640235e2SEnji Cooper 		ATF_REQUIRE(kill(pid, SIGQUIT) == 0);
239640235e2SEnji Cooper 		ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
240ddba0402SEnji Cooper 		ATF_REQUIRE(!WIFEXITED(st));
241640235e2SEnji Cooper 		ATF_REQUIRE(WIFSIGNALED(st) && WTERMSIG(st) == SIGQUIT);
242ddba0402SEnji Cooper 		ATF_REQUIRE(!WIFSTOPPED(st));
243ddba0402SEnji Cooper 		ATF_REQUIRE(!WIFCONTINUED(st));
244640235e2SEnji Cooper 		ATF_REQUIRE(si.si_status == SIGQUIT);
245640235e2SEnji Cooper 		ATF_REQUIRE(si.si_pid == pid);
246640235e2SEnji Cooper 		ATF_REQUIRE(si.si_uid == getuid());
247640235e2SEnji Cooper 		ATF_REQUIRE(si.si_code == CLD_KILLED);
248640235e2SEnji Cooper #ifdef __NetBSD__
249640235e2SEnji Cooper 		printf("user: %ju system: %ju\n", (uintmax_t)si.si_utime,
250640235e2SEnji Cooper 		    (uintmax_t)si.si_utime);
251640235e2SEnji Cooper #endif
252640235e2SEnji Cooper 		break;
253640235e2SEnji Cooper 	}
254640235e2SEnji Cooper }
255640235e2SEnji Cooper 
256ddba0402SEnji Cooper ATF_TC(wait6_stopgo_loop);
ATF_TC_HEAD(wait6_stopgo_loop,tc)257ddba0402SEnji Cooper ATF_TC_HEAD(wait6_stopgo_loop, tc)
258ddba0402SEnji Cooper {
259ddba0402SEnji Cooper 	atf_tc_set_md_var(tc, "descr",
260ddba0402SEnji Cooper 	    "Test that wait6(2) handled stopped/continued process loop");
261ddba0402SEnji Cooper }
262ddba0402SEnji Cooper 
ATF_TC_BODY(wait6_stopgo_loop,tc)263ddba0402SEnji Cooper ATF_TC_BODY(wait6_stopgo_loop, tc)
264ddba0402SEnji Cooper {
265ddba0402SEnji Cooper 	siginfo_t si;
266ddba0402SEnji Cooper 	struct wrusage wru;
267ddba0402SEnji Cooper 	int st;
268ddba0402SEnji Cooper 	pid_t pid;
269ddba0402SEnji Cooper 	static const struct rlimit rl = { 0, 0 };
270ddba0402SEnji Cooper 	size_t N = 100;
271ddba0402SEnji Cooper 
272ddba0402SEnji Cooper 	ATF_REQUIRE(setrlimit(RLIMIT_CORE, &rl) == 0);
273ddba0402SEnji Cooper 	switch (pid = fork()) {
274ddba0402SEnji Cooper 	case 0:
275ddba0402SEnji Cooper 		sleep(100);
276ddba0402SEnji Cooper 		/*FALLTHROUGH*/
277ddba0402SEnji Cooper 	case -1:
278ddba0402SEnji Cooper 		ATF_REQUIRE(pid > 0);
279ddba0402SEnji Cooper 	}
280ddba0402SEnji Cooper 
281ddba0402SEnji Cooper 	printf("Before loop of SIGSTOP/SIGCONT sequence %zu times\n", N);
282ddba0402SEnji Cooper 	while (N --> 0) {
283ddba0402SEnji Cooper 		ATF_REQUIRE(kill(pid, SIGSTOP) == 0);
284ddba0402SEnji Cooper 		ATF_REQUIRE(wait6(P_PID, pid, &st, WSTOPPED, &wru, &si) == pid);
285ddba0402SEnji Cooper 		ATF_REQUIRE(!WIFEXITED(st));
286ddba0402SEnji Cooper 		ATF_REQUIRE(!WIFSIGNALED(st));
287ddba0402SEnji Cooper 		ATF_REQUIRE(WIFSTOPPED(st) && WSTOPSIG(st) == SIGSTOP);
288ddba0402SEnji Cooper 		ATF_REQUIRE(!WIFCONTINUED(st));
289ddba0402SEnji Cooper 		ATF_REQUIRE(si.si_status == SIGSTOP);
290ddba0402SEnji Cooper 		ATF_REQUIRE(si.si_pid == pid);
291ddba0402SEnji Cooper 		ATF_REQUIRE(si.si_uid == getuid());
292ddba0402SEnji Cooper 		ATF_REQUIRE(si.si_code == CLD_STOPPED);
293ddba0402SEnji Cooper 
294ddba0402SEnji Cooper 		ATF_REQUIRE(kill(pid, SIGCONT) == 0);
295ddba0402SEnji Cooper 		ATF_REQUIRE(wait6(P_PID, pid, &st, WCONTINUED, &wru, &si) == pid);
296ddba0402SEnji Cooper 		ATF_REQUIRE(!WIFEXITED(st));
297ddba0402SEnji Cooper 		ATF_REQUIRE(!WIFSIGNALED(st));
298ddba0402SEnji Cooper 		ATF_REQUIRE(WIFCONTINUED(st));
299ddba0402SEnji Cooper 		ATF_REQUIRE(!WIFSTOPPED(st));
300ddba0402SEnji Cooper 		ATF_REQUIRE(si.si_status == SIGCONT);
301ddba0402SEnji Cooper 		ATF_REQUIRE(si.si_pid == pid);
302ddba0402SEnji Cooper 		ATF_REQUIRE(si.si_uid == getuid());
303ddba0402SEnji Cooper 		ATF_REQUIRE(si.si_code == CLD_CONTINUED);
304ddba0402SEnji Cooper 	}
305ddba0402SEnji Cooper 	ATF_REQUIRE(kill(pid, SIGQUIT) == 0);
306ddba0402SEnji Cooper 	ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
307ddba0402SEnji Cooper 	ATF_REQUIRE(!WIFEXITED(st));
308ddba0402SEnji Cooper 	ATF_REQUIRE(WIFSIGNALED(st) && WTERMSIG(st) == SIGQUIT);
309ddba0402SEnji Cooper 	ATF_REQUIRE(!WIFSTOPPED(st));
310ddba0402SEnji Cooper 	ATF_REQUIRE(!WIFCONTINUED(st));
311ddba0402SEnji Cooper 	ATF_REQUIRE(si.si_status == SIGQUIT);
312ddba0402SEnji Cooper 	ATF_REQUIRE(si.si_pid == pid);
313ddba0402SEnji Cooper 	ATF_REQUIRE(si.si_uid == getuid());
314ddba0402SEnji Cooper 	ATF_REQUIRE(si.si_code == CLD_KILLED);
315ddba0402SEnji Cooper #ifdef __NetBSD__
316ddba0402SEnji Cooper 	printf("user: %ju system: %ju\n", (uintmax_t)si.si_utime,
317ddba0402SEnji Cooper 	    (uintmax_t)si.si_utime);
318ddba0402SEnji Cooper #endif
319ddba0402SEnji Cooper }
320ddba0402SEnji Cooper 
ATF_TP_ADD_TCS(tp)321640235e2SEnji Cooper ATF_TP_ADD_TCS(tp)
322640235e2SEnji Cooper {
323640235e2SEnji Cooper 
324640235e2SEnji Cooper 	ATF_TP_ADD_TC(tp, wait6_invalid);
325640235e2SEnji Cooper 	ATF_TP_ADD_TC(tp, wait6_exited);
326640235e2SEnji Cooper 	ATF_TP_ADD_TC(tp, wait6_terminated);
327640235e2SEnji Cooper 	ATF_TP_ADD_TC(tp, wait6_coredumped);
328640235e2SEnji Cooper 	ATF_TP_ADD_TC(tp, wait6_stop_and_go);
329ddba0402SEnji Cooper 	ATF_TP_ADD_TC(tp, wait6_stopgo_loop);
330640235e2SEnji Cooper 
331640235e2SEnji Cooper 	return atf_no_error();
332640235e2SEnji Cooper }
333