Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libc/sys Add a new function in ATF t_ptrace_wait*:...
details: https://anonhg.NetBSD.org/src/rev/d9999189bfa8
branches: trunk
changeset: 321364:d9999189bfa8
user: kamil <kamil%NetBSD.org@localhost>
date: Tue Mar 13 13:34:40 2018 +0000
description:
Add a new function in ATF t_ptrace_wait*: await_zombie_raw()
Add await_zombie_raw() that is the same as await_zombie(), whith an
addition of additional "useconds_t ms" parameter indicating delays between
new polling for a zombie process.
This new function will be used for testing a race condition that has been
observed occassionally crashing a test case -- returning duplicate entries
for KERN_PROC_PID.
Sponsored by <The NetBSD Foundation>
diffstat:
tests/lib/libc/sys/t_ptrace_wait.h | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diffs (39 lines):
diff -r 25c53290a27f -r d9999189bfa8 tests/lib/libc/sys/t_ptrace_wait.h
--- a/tests/lib/libc/sys/t_ptrace_wait.h Tue Mar 13 09:04:02 2018 +0000
+++ b/tests/lib/libc/sys/t_ptrace_wait.h Tue Mar 13 13:34:40 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ptrace_wait.h,v 1.1 2017/04/02 21:44:00 kamil Exp $ */
+/* $NetBSD: t_ptrace_wait.h,v 1.2 2018/03/13 13:34:40 kamil Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -328,7 +328,7 @@
/* This function is currently designed to be run in the main/parent process */
static void __used
-await_zombie(pid_t process)
+await_zombie_raw(pid_t process, useconds_t ms)
{
struct kinfo_proc2 p;
size_t len = sizeof(p);
@@ -351,10 +351,19 @@
if (p.p_stat == LSZOMB)
break;
- ATF_REQUIRE(usleep(1000) == 0);
+ if (ms > 0) {
+ ATF_REQUIRE(usleep(ms) == 0);
+ }
}
}
+static void __used
+await_zombie(pid_t process)
+{
+
+ await_zombie_raw(process, 1000);
+}
+
/* Happy number sequence -- this function is used to just consume cpu cycles */
#define HAPPY_NUMBER 1
Home |
Main Index |
Thread Index |
Old Index