svn commit: r283836 - head/tests/sys/kern
John Baldwin
jhb at FreeBSD.org
Sun May 31 19:43:36 UTC 2015
Author: jhb
Date: Sun May 31 19:43:35 2015
New Revision: 283836
URL: https://svnweb.freebsd.org/changeset/base/283836
Log:
Consistently only use one end of the pipe in the parent and debugger
processes and do not rely on EOF due to a close() in the debugger.
PR: 200489
Differential Revision: https://reviews.freebsd.org/D2674
Reviewed by: kib, ngie, rodrigc
Modified:
head/tests/sys/kern/ptrace_test.c
Modified: head/tests/sys/kern/ptrace_test.c
==============================================================================
--- head/tests/sys/kern/ptrace_test.c Sun May 31 19:09:24 2015 (r283835)
+++ head/tests/sys/kern/ptrace_test.c Sun May 31 19:43:35 2015 (r283836)
@@ -304,7 +304,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_aft
ATF_REQUIRE(write(dpipe[1], &c, sizeof(c)) == sizeof(c));
/* Wait for parent's failed wait. */
- ATF_REQUIRE(read(dpipe[1], &c, sizeof(c)) == 0);
+ ATF_REQUIRE(read(dpipe[1], &c, sizeof(c)) == sizeof(c));
wpid = waitpid(child, &status, 0);
ATF_REQUIRE(wpid == child);
@@ -313,6 +313,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_aft
exit(0);
}
+ close(dpipe[1]);
/* Parent process. */
@@ -365,10 +366,11 @@ ATF_TC_BODY(ptrace__parent_sees_exit_aft
ATF_REQUIRE(wpid == 0);
/* Signal the debugger to wait for the child. */
- close(dpipe[0]);
+ ATF_REQUIRE(write(dpipe[0], &c, sizeof(c)) == sizeof(c));
/* Wait for the debugger. */
- ATF_REQUIRE(read(dpipe[1], &c, sizeof(c)) == 0);
+ ATF_REQUIRE(read(dpipe[0], &c, sizeof(c)) == 0);
+ close(dpipe[0]);
/* The child process should now be ready. */
wpid = waitpid(child, &status, WNOHANG);
More information about the svn-src-head
mailing list