Source-Changes-HG archive

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

[src/netbsd-9]: src/tests/lib/libc/sys Pull up following revision(s) (request...



details:   https://anonhg.NetBSD.org/src/rev/7a2cb66656ba
branches:  netbsd-9
changeset: 1000979:7a2cb66656ba
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Oct 15 18:22:55 2019 +0000

description:
Pull up following revision(s) (requested by kamil in ticket #310):

        tests/lib/libc/sys/t_ptrace_wait.c: revision 1.134

Remove ATF t_ptrace_wait test suspend1

The tests verifies that a thread can be suspended by a debugger and later
resumed by a tracee.

This is an unwanted behavior and will be fixed soon.

diffstat:

 tests/lib/libc/sys/t_ptrace_wait.c |  132 +------------------------------------
 1 files changed, 2 insertions(+), 130 deletions(-)

diffs (160 lines):

diff -r acfcd95637aa -r 7a2cb66656ba tests/lib/libc/sys/t_ptrace_wait.c
--- a/tests/lib/libc/sys/t_ptrace_wait.c        Tue Oct 15 18:21:06 2019 +0000
+++ b/tests/lib/libc/sys/t_ptrace_wait.c        Tue Oct 15 18:22:55 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_ptrace_wait.c,v 1.131 2019/07/01 02:04:37 kamil Exp $        */
+/*     $NetBSD: t_ptrace_wait.c,v 1.131.2.1 2019/10/15 18:22:55 martin Exp $   */
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131 2019/07/01 02:04:37 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.1 2019/10/15 18:22:55 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -6328,133 +6328,6 @@
        _lwp_exit();
 }
 
-ATF_TC(suspend1);
-ATF_TC_HEAD(suspend1, tc)
-{
-       atf_tc_set_md_var(tc, "descr",
-           "Verify that a thread can be suspended by a debugger and later "
-           "resumed by a tracee");
-}
-
-ATF_TC_BODY(suspend1, tc)
-{
-       const int exitval = 5;
-       const int sigval = SIGSTOP;
-       pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
-       int status;
-#endif
-       ucontext_t uc;
-       lwpid_t lid;
-       static const size_t ssize = 16*1024;
-       void *stack;
-       struct ptrace_lwpinfo pl;
-       struct ptrace_siginfo psi;
-       volatile int go = 0;
-
-       DPRINTF("Before forking process PID=%d\n", getpid());
-       SYSCALL_REQUIRE((child = fork()) != -1);
-       if (child == 0) {
-               DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
-               FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
-               DPRINTF("Before raising %s from child\n", strsignal(sigval));
-               FORKEE_ASSERT(raise(sigval) == 0);
-
-               DPRINTF("Before allocating memory for stack in child\n");
-               FORKEE_ASSERT((stack = malloc(ssize)) != NULL);
-
-               DPRINTF("Before making context for new lwp in child\n");
-               _lwp_makecontext(&uc, lwp_main_stop, NULL, NULL, stack, ssize);
-
-               DPRINTF("Before creating new in child\n");
-               FORKEE_ASSERT(_lwp_create(&uc, 0, &lid) == 0);
-
-               while (go == 0)
-                       continue;
-
-               raise(SIGINT);
-
-               FORKEE_ASSERT(_lwp_continue(lid) == 0);
-
-               DPRINTF("Before waiting for lwp %d to exit\n", lid);
-               FORKEE_ASSERT(_lwp_wait(lid, NULL) == 0);
-
-               DPRINTF("Before verifying that reported %d and running lid %d "
-                   "are the same\n", lid, the_lwp_id);
-               FORKEE_ASSERT_EQ(lid, the_lwp_id);
-
-               DPRINTF("Before exiting of the child process\n");
-               _exit(exitval);
-       }
-       DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
-       DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
-       TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-       validate_status_stopped(status, sigval);
-
-       DPRINTF("Before resuming the child process where it left off and "
-           "without signal to be sent\n");
-       SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
-       DPRINTF("Before calling %s() for the child - expected stopped "
-           "SIGTRAP\n", TWAIT_FNAME);
-       TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-       validate_status_stopped(status, SIGTRAP);
-
-       DPRINTF("Before reading siginfo and lwpid_t\n");
-       SYSCALL_REQUIRE(ptrace(PT_GET_SIGINFO, child, &psi, sizeof(psi)) != -1);
-
-       DPRINTF("Before suspending LWP %d\n", psi.psi_lwpid);
-       SYSCALL_REQUIRE(ptrace(PT_SUSPEND, child, NULL, psi.psi_lwpid) != -1);
-
-        DPRINTF("Write new go to tracee (PID=%d) from tracer (PID=%d)\n",
-           child, getpid());
-       SYSCALL_REQUIRE(ptrace(PT_WRITE_D, child, __UNVOLATILE(&go), 1) != -1);
-
-       DPRINTF("Before resuming the child process where it left off and "
-           "without signal to be sent\n");
-       SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
-       DPRINTF("Before calling %s() for the child - expected stopped "
-           "SIGINT\n", TWAIT_FNAME);
-       TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-       validate_status_stopped(status, SIGINT);
-
-       pl.pl_lwpid = 0;
-
-       SYSCALL_REQUIRE(ptrace(PT_LWPINFO, child, &pl, sizeof(pl)) != -1);
-       while (pl.pl_lwpid != 0) {
-
-               SYSCALL_REQUIRE(ptrace(PT_LWPINFO, child, &pl, sizeof(pl)) != -1);
-               switch (pl.pl_lwpid) {
-               case 1:
-                       ATF_REQUIRE_EQ(pl.pl_event, PL_EVENT_SIGNAL);
-                       break;
-               case 2:
-                       ATF_REQUIRE_EQ(pl.pl_event, PL_EVENT_SUSPENDED);
-                       break;
-               }
-       }
-
-       DPRINTF("Before resuming the child process where it left off and "
-           "without signal to be sent\n");
-       SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
-       DPRINTF("Before calling %s() for the child - expected exited\n",
-           TWAIT_FNAME);
-       TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-       validate_status_exited(status, exitval);
-
-       DPRINTF("Before calling %s() for the child - expected no process\n",
-           TWAIT_FNAME);
-       TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-
 ATF_TC(suspend2);
 ATF_TC_HEAD(suspend2, tc)
 {
@@ -8216,7 +8089,6 @@
        ATF_TP_ADD_TC(tp, signal9);
        ATF_TP_ADD_TC(tp, signal10);
 
-       ATF_TP_ADD_TC(tp, suspend1);
        ATF_TP_ADD_TC(tp, suspend2);
 
        ATF_TP_ADD_TC(tp, resume1);



Home | Main Index | Thread Index | Old Index