Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/51dc422d6cd4
branches:  netbsd-8
changeset: 434652:51dc422d6cd4
user:      snj <snj%NetBSD.org@localhost>
date:      Sun Feb 25 20:59:46 2018 +0000

description:
Pull up following revision(s) (requested by martin in ticket #586):
        tests/lib/libc/sys/t_ptrace_amd64_wait.h: 1.2
        tests/lib/libc/sys/t_ptrace_i386_wait.h: 1.2
        tests/lib/libc/sys/t_ptrace_wait.c: 1.10-1.20
        tests/lib/libc/sys/t_ptrace_x86_wait.h: 1.2-1.3
PR kern/52167 strikes on sparc64 too.
--
Temporarily disable t_ptrace_wait*::resume1 in ATF tests
It hangs forever on releng machines.
Sponsored by <The NetBSD Foundation>
--
Remove expected failure (fixed in kern_sig.c 1.339)
--
sync a bit more with reality; some things still fail, some new failures.
reduce spewage, be more explanatory about syscall errors.
--
Add expected failures.
--
make it fail instead of hang under qemu; XXX: need to investigate.
--
t_ptrace_wait*: Disable suspend* tests
These tests can hang the system. These interfaces will be improved and
temporarily disable them.
--
ptrace atf: Clanup reports of failures
Mark resume* suspend* tests as expected failure and link with PR 51995.
Sponsored by <The NetBSD Foundation>
--
report which errno failed
--
atf: t_ptrace_wait: Mark attach2 as racy
--
atf: ptrace: Temporarily disable signal3 as it breaks now on some ports
This test is marked as failing with: PR kern/51918.

diffstat:

 tests/lib/libc/sys/t_ptrace_amd64_wait.h |    74 +-
 tests/lib/libc/sys/t_ptrace_i386_wait.h  |    60 +-
 tests/lib/libc/sys/t_ptrace_wait.c       |  3764 +++++++++++++++--------------
 tests/lib/libc/sys/t_ptrace_x86_wait.h   |   618 ++--
 4 files changed, 2282 insertions(+), 2234 deletions(-)

diffs (truncated from 8703 to 300 lines):

diff -r d6f9452c21c0 -r 51dc422d6cd4 tests/lib/libc/sys/t_ptrace_amd64_wait.h
--- a/tests/lib/libc/sys/t_ptrace_amd64_wait.h  Mon Feb 19 19:08:18 2018 +0000
+++ b/tests/lib/libc/sys/t_ptrace_amd64_wait.h  Sun Feb 25 20:59:46 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_ptrace_amd64_wait.h,v 1.1 2017/04/02 21:44:00 kamil Exp $    */
+/*     $NetBSD: t_ptrace_amd64_wait.h,v 1.1.8.1 2018/02/25 20:59:46 snj Exp $  */
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -44,67 +44,67 @@
 #endif
        struct reg r;
 
-       printf("Before forking process PID=%d\n", getpid());
-       ATF_REQUIRE((child = fork()) != -1);
+       DPRINTF("Before forking process PID=%d\n", getpid());
+       SYSCALL_REQUIRE((child = fork()) != -1);
        if (child == 0) {
-               printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+               DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
                FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
 
-               printf("Before raising %s from child\n", strsignal(sigval));
+               DPRINTF("Before raising %s from child\n", strsignal(sigval));
                FORKEE_ASSERT(raise(sigval) == 0);
 
-               printf("Before exiting of the child process\n");
+               DPRINTF("Before exiting of the child process\n");
                _exit(exitval);
        }
-       printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+       DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
 
-       printf("Before calling %s() for the child\n", TWAIT_FNAME);
+       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);
 
-       printf("Call GETREGS for the child process\n");
-       ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1);
+       DPRINTF("Call GETREGS for the child process\n");
+       SYSCALL_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1);
 
-       printf("RAX=%#" PRIxREGISTER "\n", r.regs[_REG_RAX]);
-       printf("RBX=%#" PRIxREGISTER "\n", r.regs[_REG_RBX]);
-       printf("RCX=%#" PRIxREGISTER "\n", r.regs[_REG_RCX]);
-       printf("RDX=%#" PRIxREGISTER "\n", r.regs[_REG_RDX]);
+       DPRINTF("RAX=%#" PRIxREGISTER "\n", r.regs[_REG_RAX]);
+       DPRINTF("RBX=%#" PRIxREGISTER "\n", r.regs[_REG_RBX]);
+       DPRINTF("RCX=%#" PRIxREGISTER "\n", r.regs[_REG_RCX]);
+       DPRINTF("RDX=%#" PRIxREGISTER "\n", r.regs[_REG_RDX]);
 
-       printf("RDI=%#" PRIxREGISTER "\n", r.regs[_REG_RDI]);
-       printf("RSI=%#" PRIxREGISTER "\n", r.regs[_REG_RSI]);
+       DPRINTF("RDI=%#" PRIxREGISTER "\n", r.regs[_REG_RDI]);
+       DPRINTF("RSI=%#" PRIxREGISTER "\n", r.regs[_REG_RSI]);
 
-       printf("GS=%#" PRIxREGISTER "\n", r.regs[_REG_GS]);
-       printf("FS=%#" PRIxREGISTER "\n", r.regs[_REG_FS]);
-       printf("ES=%#" PRIxREGISTER "\n", r.regs[_REG_ES]);
-       printf("DS=%#" PRIxREGISTER "\n", r.regs[_REG_DS]);
-       printf("CS=%#" PRIxREGISTER "\n", r.regs[_REG_CS]);
-       printf("SS=%#" PRIxREGISTER "\n", r.regs[_REG_SS]);
+       DPRINTF("GS=%#" PRIxREGISTER "\n", r.regs[_REG_GS]);
+       DPRINTF("FS=%#" PRIxREGISTER "\n", r.regs[_REG_FS]);
+       DPRINTF("ES=%#" PRIxREGISTER "\n", r.regs[_REG_ES]);
+       DPRINTF("DS=%#" PRIxREGISTER "\n", r.regs[_REG_DS]);
+       DPRINTF("CS=%#" PRIxREGISTER "\n", r.regs[_REG_CS]);
+       DPRINTF("SS=%#" PRIxREGISTER "\n", r.regs[_REG_SS]);
 
-       printf("RSP=%#" PRIxREGISTER "\n", r.regs[_REG_RSP]);
-       printf("RIP=%#" PRIxREGISTER "\n", r.regs[_REG_RIP]);
+       DPRINTF("RSP=%#" PRIxREGISTER "\n", r.regs[_REG_RSP]);
+       DPRINTF("RIP=%#" PRIxREGISTER "\n", r.regs[_REG_RIP]);
 
-       printf("RFLAGS=%#" PRIxREGISTER "\n", r.regs[_REG_RFLAGS]);
+       DPRINTF("RFLAGS=%#" PRIxREGISTER "\n", r.regs[_REG_RFLAGS]);
 
-       printf("R8=%#" PRIxREGISTER "\n", r.regs[_REG_R8]);
-       printf("R9=%#" PRIxREGISTER "\n", r.regs[_REG_R9]);
-       printf("R10=%#" PRIxREGISTER "\n", r.regs[_REG_R10]);
-       printf("R11=%#" PRIxREGISTER "\n", r.regs[_REG_R11]);
-       printf("R12=%#" PRIxREGISTER "\n", r.regs[_REG_R12]);
-       printf("R13=%#" PRIxREGISTER "\n", r.regs[_REG_R13]);
-       printf("R14=%#" PRIxREGISTER "\n", r.regs[_REG_R14]);
-       printf("R15=%#" PRIxREGISTER "\n", r.regs[_REG_R15]);
+       DPRINTF("R8=%#" PRIxREGISTER "\n", r.regs[_REG_R8]);
+       DPRINTF("R9=%#" PRIxREGISTER "\n", r.regs[_REG_R9]);
+       DPRINTF("R10=%#" PRIxREGISTER "\n", r.regs[_REG_R10]);
+       DPRINTF("R11=%#" PRIxREGISTER "\n", r.regs[_REG_R11]);
+       DPRINTF("R12=%#" PRIxREGISTER "\n", r.regs[_REG_R12]);
+       DPRINTF("R13=%#" PRIxREGISTER "\n", r.regs[_REG_R13]);
+       DPRINTF("R14=%#" PRIxREGISTER "\n", r.regs[_REG_R14]);
+       DPRINTF("R15=%#" PRIxREGISTER "\n", r.regs[_REG_R15]);
 
-       printf("Before resuming the child process where it left off and "
+       DPRINTF("Before resuming the child process where it left off and "
            "without signal to be sent\n");
-       ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+       SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
 
-       printf("Before calling %s() for the child\n", TWAIT_FNAME);
+       DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
        TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
 
        validate_status_exited(status, exitval);
 
-       printf("Before calling %s() for the child\n", TWAIT_FNAME);
+       DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
        TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
 }
 #define ATF_TP_ADD_TCS_PTRACE_WAIT_AMD64() \
diff -r d6f9452c21c0 -r 51dc422d6cd4 tests/lib/libc/sys/t_ptrace_i386_wait.h
--- a/tests/lib/libc/sys/t_ptrace_i386_wait.h   Mon Feb 19 19:08:18 2018 +0000
+++ b/tests/lib/libc/sys/t_ptrace_i386_wait.h   Sun Feb 25 20:59:46 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_ptrace_i386_wait.h,v 1.1 2017/04/02 21:44:00 kamil Exp $     */
+/*     $NetBSD: t_ptrace_i386_wait.h,v 1.1.8.1 2018/02/25 20:59:46 snj Exp $   */
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -44,60 +44,60 @@
 #endif
        struct reg r;
 
-       printf("Before forking process PID=%d\n", getpid());
-       ATF_REQUIRE((child = fork()) != -1);
+       DPRINTF("Before forking process PID=%d\n", getpid());
+       SYSCALL_REQUIRE((child = fork()) != -1);
        if (child == 0) {
-               printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+               DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
                FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
 
-               printf("Before raising %s from child\n", strsignal(sigval));
+               DPRINTF("Before raising %s from child\n", strsignal(sigval));
                FORKEE_ASSERT(raise(sigval) == 0);
 
-               printf("Before exiting of the child process\n");
+               DPRINTF("Before exiting of the child process\n");
                _exit(exitval);
        }
-       printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+       DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
 
-       printf("Before calling %s() for the child\n", TWAIT_FNAME);
+       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);
 
-       printf("Call GETREGS for the child process\n");
-       ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1);
+       DPRINTF("Call GETREGS for the child process\n");
+       SYSCALL_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1);
 
-       printf("EAX=%#" PRIxREGISTER "\n", r.r_eax);
-       printf("EBX=%#" PRIxREGISTER "\n", r.r_ebx);
-       printf("ECX=%#" PRIxREGISTER "\n", r.r_ecx);
-       printf("EDX=%#" PRIxREGISTER "\n", r.r_edx);
+       DPRINTF("EAX=%#" PRIxREGISTER "\n", r.r_eax);
+       DPRINTF("EBX=%#" PRIxREGISTER "\n", r.r_ebx);
+       DPRINTF("ECX=%#" PRIxREGISTER "\n", r.r_ecx);
+       DPRINTF("EDX=%#" PRIxREGISTER "\n", r.r_edx);
 
-       printf("ESP=%#" PRIxREGISTER "\n", r.r_esp);
-       printf("EBP=%#" PRIxREGISTER "\n", r.r_ebp);
+       DPRINTF("ESP=%#" PRIxREGISTER "\n", r.r_esp);
+       DPRINTF("EBP=%#" PRIxREGISTER "\n", r.r_ebp);
 
-       printf("ESI=%#" PRIxREGISTER "\n", r.r_esi);
-       printf("EDI=%#" PRIxREGISTER "\n", r.r_edi);
+       DPRINTF("ESI=%#" PRIxREGISTER "\n", r.r_esi);
+       DPRINTF("EDI=%#" PRIxREGISTER "\n", r.r_edi);
 
-       printf("EIP=%#" PRIxREGISTER "\n", r.r_eip);
+       DPRINTF("EIP=%#" PRIxREGISTER "\n", r.r_eip);
 
-       printf("EFLAGS=%#" PRIxREGISTER "\n", r.r_eflags);
+       DPRINTF("EFLAGS=%#" PRIxREGISTER "\n", r.r_eflags);
 
-       printf("CS=%#" PRIxREGISTER "\n", r.r_cs);
-       printf("SS=%#" PRIxREGISTER "\n", r.r_ss);
-       printf("DS=%#" PRIxREGISTER "\n", r.r_ds);
-       printf("ES=%#" PRIxREGISTER "\n", r.r_es);
-       printf("FS=%#" PRIxREGISTER "\n", r.r_fs);
-       printf("GS=%#" PRIxREGISTER "\n", r.r_gs);
+       DPRINTF("CS=%#" PRIxREGISTER "\n", r.r_cs);
+       DPRINTF("SS=%#" PRIxREGISTER "\n", r.r_ss);
+       DPRINTF("DS=%#" PRIxREGISTER "\n", r.r_ds);
+       DPRINTF("ES=%#" PRIxREGISTER "\n", r.r_es);
+       DPRINTF("FS=%#" PRIxREGISTER "\n", r.r_fs);
+       DPRINTF("GS=%#" PRIxREGISTER "\n", r.r_gs);
 
-       printf("Before resuming the child process where it left off and "
+       DPRINTF("Before resuming the child process where it left off and "
            "without signal to be sent\n");
-       ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+       SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
 
-       printf("Before calling %s() for the child\n", TWAIT_FNAME);
+       DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
        TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
 
        validate_status_exited(status, exitval);
 
-       printf("Before calling %s() for the child\n", TWAIT_FNAME);
+       DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
        TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
 }
 #define ATF_TP_ADD_TCS_PTRACE_WAIT_I386() \
diff -r d6f9452c21c0 -r 51dc422d6cd4 tests/lib/libc/sys/t_ptrace_wait.c
--- a/tests/lib/libc/sys/t_ptrace_wait.c        Mon Feb 19 19:08:18 2018 +0000
+++ b/tests/lib/libc/sys/t_ptrace_wait.c        Sun Feb 25 20:59:46 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_ptrace_wait.c,v 1.9 2017/05/03 19:46:54 kamil Exp $  */
+/*     $NetBSD: t_ptrace_wait.c,v 1.9.2.1 2018/02/25 20:59:46 snj Exp $        */
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.9 2017/05/03 19:46:54 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.9.2.1 2018/02/25 20:59:46 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -58,7 +58,7 @@
 #include "msg.h"
 
 #define PARENT_TO_CHILD(info, fds, msg) \
-    ATF_REQUIRE(msg_write_child(info " to child " # fds, &fds, &msg, sizeof(msg)) == 0)
+    SYSCALL_REQUIRE(msg_write_child(info " to child " # fds, &fds, &msg, sizeof(msg)) == 0)
 
 #define CHILD_FROM_PARENT(info, fds, msg) \
     FORKEE_ASSERT(msg_read_parent(info " from parent " # fds, &fds, &msg, sizeof(msg)) == 0)
@@ -67,7 +67,18 @@
     FORKEE_ASSERT(msg_write_parent(info " to parent " # fds, &fds, &msg, sizeof(msg)) == 0)
 
 #define PARENT_FROM_CHILD(info, fds, msg) \
-    ATF_REQUIRE(msg_read_child(info " from parent " # fds, &fds, &msg, sizeof(msg)) == 0)
+    SYSCALL_REQUIRE(msg_read_child(info " from parent " # fds, &fds, &msg, sizeof(msg)) == 0)
+
+#define SYSCALL_REQUIRE(expr) ATF_REQUIRE_MSG(expr, "%s: %s", # expr, \
+    strerror(errno))
+#define SYSCALL_REQUIRE_ERRNO(res, exp) ATF_REQUIRE_MSG(res == exp, \
+    "%d(%s) != %d", res, strerror(res), exp)
+
+static int debug = 0;
+
+#define DPRINTF(a, ...)        do  \
+       if (debug) printf(a,  ##__VA_ARGS__); \
+    while (/*CONSTCOND*/0)
 
 
 ATF_TC(traceme1);
@@ -86,35 +97,35 @@
        int status;
 #endif
 
-       printf("Before forking process PID=%d\n", getpid());
-       ATF_REQUIRE((child = fork()) != -1);
+       DPRINTF("Before forking process PID=%d\n", getpid());
+       SYSCALL_REQUIRE((child = fork()) != -1);
        if (child == 0) {
-               printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+               DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
                FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
 
-               printf("Before raising %s from child\n", strsignal(sigval));
+               DPRINTF("Before raising %s from child\n", strsignal(sigval));
                FORKEE_ASSERT(raise(sigval) == 0);
 
-               printf("Before exiting of the child process\n");
+               DPRINTF("Before exiting of the child process\n");
                _exit(exitval);
        }
-       printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
-       printf("Before calling %s() for the child\n", TWAIT_FNAME);
+       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);
 
-       printf("Before resuming the child process where it left off and "
+       DPRINTF("Before resuming the child process where it left off and "
            "without signal to be sent\n");
-       ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
-       printf("Before calling %s() for the child\n", TWAIT_FNAME);
+       SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+       DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
        TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);



Home | Main Index | Thread Index | Old Index