summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/sys/t_getrusage.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/regress/lib/libc/sys/t_getrusage.c')
-rw-r--r--src/regress/lib/libc/sys/t_getrusage.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/regress/lib/libc/sys/t_getrusage.c b/src/regress/lib/libc/sys/t_getrusage.c
index 481d73431b..316377f8ce 100644
--- a/src/regress/lib/libc/sys/t_getrusage.c
+++ b/src/regress/lib/libc/sys/t_getrusage.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t_getrusage.c,v 1.1.1.1 2019/11/19 19:57:03 bluhm Exp $ */ 1/* $OpenBSD: t_getrusage.c,v 1.2 2020/11/09 23:18:51 bluhm Exp $ */
2/* $NetBSD: t_getrusage.c,v 1.8 2018/05/09 08:45:03 mrg Exp $ */ 2/* $NetBSD: t_getrusage.c,v 1.8 2018/05/09 08:45:03 mrg Exp $ */
3 3
4/*- 4/*-
@@ -208,6 +208,9 @@ ATF_TC_BODY(getrusage_utime_back, tc)
208 /* 208 /*
209 * Test that two consecutive calls are sane. 209 * Test that two consecutive calls are sane.
210 */ 210 */
211#ifndef __OpenBSD__
212 atf_tc_expect_fail("PR kern/30115");
213#endif
211 214
212 for (i = 0; i < maxiter; i++) { 215 for (i = 0; i < maxiter; i++) {
213 216
@@ -225,6 +228,10 @@ ATF_TC_BODY(getrusage_utime_back, tc)
225 if (timercmp(&ru2.ru_utime, &ru1.ru_utime, <) != 0) 228 if (timercmp(&ru2.ru_utime, &ru1.ru_utime, <) != 0)
226 atf_tc_fail("user time went backwards"); 229 atf_tc_fail("user time went backwards");
227 } 230 }
231
232#ifndef __OpenBSD__
233 atf_tc_fail("anticipated error did not occur");
234#endif
228} 235}
229 236
230ATF_TC(getrusage_utime_zero); 237ATF_TC(getrusage_utime_zero);
@@ -241,18 +248,31 @@ ATF_TC_BODY(getrusage_utime_zero, tc)
241 /* 248 /*
242 * Test that getrusage(2) does not return 249 * Test that getrusage(2) does not return
243 * zero user time for the calling process. 250 * zero user time for the calling process.
251 *
252 * See also (duplicate) PR port-amd64/41734.
244 */ 253 */
254#ifndef __OpenBSD__
255 atf_tc_expect_fail("PR kern/30115");
256#endif
245 257
246 for (i = 0; i < maxiter; i++) { 258 for (i = 0; i < maxiter; i++) {
259
247 work(); 260 work();
261#ifdef __OpenBSD__
248 } 262 }
263#endif
249 264
250 (void)memset(&ru, 0, sizeof(struct rusage)); 265 (void)memset(&ru, 0, sizeof(struct rusage));
251 266
252 ATF_REQUIRE(getrusage(RUSAGE_SELF, &ru) == 0); 267 ATF_REQUIRE(getrusage(RUSAGE_SELF, &ru) == 0);
253 268
254 if (ru.ru_utime.tv_sec == 0 && ru.ru_utime.tv_usec == 0) 269 if (ru.ru_utime.tv_sec == 0 && ru.ru_utime.tv_usec == 0)
255 atf_tc_fail("zero user time from getrusage(2)"); 270 atf_tc_fail("zero user time from getrusage(2)");
271#ifndef __OpenBSD__
272 }
273
274 atf_tc_fail("anticipated error did not occur");
275#endif
256} 276}
257 277
258ATF_TP_ADD_TCS(tp) 278ATF_TP_ADD_TCS(tp)