Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/kernel Explain expected behavior for PTRACE_FORK event...



details:   https://anonhg.NetBSD.org/src/rev/f3e7374a2eb4
branches:  trunk
changeset: 822623:f3e7374a2eb4
user:      kamil <kamil%NetBSD.org@localhost>
date:      Tue Mar 28 13:16:30 2017 +0000

description:
Explain expected behavior for PTRACE_FORK events in t_ptrace_wait*

PR kern/52117 ptrace(2) PTRACE_FORK fails on some platforms

Add message similar to:
    We expect two SIGTRAP events, for child 22199 (TRAP_CHLD,
    pe_report_event=PTRACE_FORK, state.pe_other_pid=child2) and for child2
    (TRAP_CHLD, pe_report_event=PTRACE_FORK, state.pe_other_pid=child)

This should make the expected behavior more clear.

Sponsored by <The NetBSD Foundation>

diffstat:

 tests/kernel/t_ptrace_wait.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r 56f6fafd3ba2 -r f3e7374a2eb4 tests/kernel/t_ptrace_wait.c
--- a/tests/kernel/t_ptrace_wait.c      Tue Mar 28 12:39:07 2017 +0000
+++ b/tests/kernel/t_ptrace_wait.c      Tue Mar 28 13:16:30 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_ptrace_wait.c,v 1.83 2017/03/28 12:39:07 kamil Exp $ */
+/*     $NetBSD: t_ptrace_wait.c,v 1.84 2017/03/28 13:16:30 kamil Exp $ */
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.83 2017/03/28 12:39:07 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.84 2017/03/28 13:16:30 kamil Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -1360,6 +1360,10 @@
 
        printf("Before resuming the child process where it left off and "
            "without signal to be sent\n");
+        printf("We expect two SIGTRAP events, for child %d (TRAP_CHLD, "
+               "pe_report_event=PTRACE_FORK, state.pe_other_pid=child2) and "
+               "for child2 (TRAP_CHLD, pe_report_event=PTRACE_FORK, "
+                "state.pe_other_pid=child)\n", child);
        ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
 
        printf("Before calling %s() for the child %d\n", TWAIT_FNAME, child);
@@ -5328,6 +5332,10 @@
 
        printf("Before resuming the child process where it left off and "
            "without signal to be sent\n");
+        printf("We expect two SIGTRAP events, for child %d (TRAP_CHLD, "
+               "pe_report_event=PTRACE_FORK, state.pe_other_pid=child2) and "
+               "for child2 (TRAP_CHLD, pe_report_event=PTRACE_FORK, "
+                "state.pe_other_pid=child)\n", child);
        ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
 
        printf("Before calling %s() for the child %d\n", TWAIT_FNAME, child);



Home | Main Index | Thread Index | Old Index