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 report which errno failed
details: https://anonhg.NetBSD.org/src/rev/97b3cc4a1fcb
branches: trunk
changeset: 358351:97b3cc4a1fcb
user: christos <christos%NetBSD.org@localhost>
date: Sat Dec 23 22:07:57 2017 +0000
description:
report which errno failed
diffstat:
tests/lib/libc/sys/t_ptrace_wait.c | 50 +++++++++++++++++++------------------
1 files changed, 26 insertions(+), 24 deletions(-)
diffs (225 lines):
diff -r a2f4b1d9f283 -r 97b3cc4a1fcb tests/lib/libc/sys/t_ptrace_wait.c
--- a/tests/lib/libc/sys/t_ptrace_wait.c Sat Dec 23 18:25:03 2017 +0000
+++ b/tests/lib/libc/sys/t_ptrace_wait.c Sat Dec 23 22:07:57 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ptrace_wait.c,v 1.17 2017/12/22 17:35:14 kamil Exp $ */
+/* $NetBSD: t_ptrace_wait.c,v 1.18 2017/12/23 22:07:57 christos Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.17 2017/12/22 17:35:14 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.18 2017/12/23 22:07:57 christos Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -71,6 +71,8 @@
#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;
@@ -2533,7 +2535,7 @@
child, getpid());
errno = 0;
lookup_me = ptrace(PT_READ_D, child, &lookup_me, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me, magic,
"got value %#x != expected %#x", lookup_me, magic);
@@ -2597,7 +2599,7 @@
child, getpid());
errno = 0;
lookup_me1 = ptrace(PT_READ_D, child, &lookup_me1, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me1, magic1,
"got value %#x != expected %#x", lookup_me1, magic1);
@@ -2606,7 +2608,7 @@
child, getpid());
errno = 0;
lookup_me2 = ptrace(PT_READ_D, child, &lookup_me2, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me2, magic2,
"got value %#x != expected %#x", lookup_me2, magic2);
@@ -2673,7 +2675,7 @@
child, getpid());
errno = 0;
lookup_me1 = ptrace(PT_READ_D, child, &lookup_me1, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me1, magic1,
"got value %#x != expected %#x", lookup_me1, magic1);
@@ -2682,7 +2684,7 @@
child, getpid());
errno = 0;
lookup_me2 = ptrace(PT_READ_D, child, &lookup_me2, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me2, magic2,
"got value %#x != expected %#x", lookup_me2, magic2);
@@ -2691,7 +2693,7 @@
child, getpid());
errno = 0;
lookup_me3 = ptrace(PT_READ_D, child, &lookup_me3, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me3, magic3,
"got value %#x != expected %#x", lookup_me3, magic3);
@@ -2761,7 +2763,7 @@
child, getpid());
errno = 0;
lookup_me1 = ptrace(PT_READ_D, child, &lookup_me1, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me1, magic1,
"got value %#x != expected %#x", lookup_me1, magic1);
@@ -2770,7 +2772,7 @@
child, getpid());
errno = 0;
lookup_me2 = ptrace(PT_READ_D, child, &lookup_me2, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me2, magic2,
"got value %#x != expected %#x", lookup_me2, magic2);
@@ -2779,7 +2781,7 @@
child, getpid());
errno = 0;
lookup_me3 = ptrace(PT_READ_D, child, &lookup_me3, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me3, magic3,
"got value %#x != expected %#x", lookup_me3, magic3);
@@ -2788,7 +2790,7 @@
child, getpid());
errno = 0;
lookup_me4 = ptrace(PT_READ_D, child, &lookup_me4, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me4, magic4,
"got value %#x != expected %#x", lookup_me4, magic4);
@@ -3292,7 +3294,7 @@
errno = 0;
lookup_me_fromtracee =
ptrace(PT_READ_D, child, &lookup_me_fromtracee, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me_fromtracee, magic_fromtracee,
"got value %#x != expected %#x", lookup_me_fromtracee,
@@ -3371,7 +3373,7 @@
errno = 0;
lookup_me_fromtracee =
ptrace(PT_READ_D, child, &lookup_me_fromtracee, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me_fromtracee, magic_fromtracee,
"got value %#x != expected %#x", lookup_me_fromtracee,
@@ -3737,7 +3739,7 @@
child, getpid());
errno = 0;
lookup_me = ptrace(PT_READ_I, child, dummy_fn1, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me, magic,
"got value %#x != expected %#x", lookup_me, magic);
@@ -3800,7 +3802,7 @@
child, getpid());
errno = 0;
lookup_me1 = ptrace(PT_READ_I, child, dummy_fn1, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me1, magic1,
"got value %#x != expected %#x", lookup_me1, magic1);
@@ -3809,7 +3811,7 @@
child, getpid());
errno = 0;
lookup_me2 = ptrace(PT_READ_I, child, dummy_fn2, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me2, magic2,
"got value %#x != expected %#x", lookup_me2, magic2);
@@ -3875,7 +3877,7 @@
child, getpid());
errno = 0;
lookup_me1 = ptrace(PT_READ_I, child, dummy_fn1, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me1, magic1,
"got value %#x != expected %#x", lookup_me1, magic1);
@@ -3884,7 +3886,7 @@
child, getpid());
errno = 0;
lookup_me2 = ptrace(PT_READ_I, child, dummy_fn2, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me2, magic2,
"got value %#x != expected %#x", lookup_me2, magic2);
@@ -3893,7 +3895,7 @@
child, getpid());
errno = 0;
lookup_me3 = ptrace(PT_READ_I, child, dummy_fn3, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me3, magic3,
"got value %#x != expected %#x", lookup_me3, magic3);
@@ -3962,7 +3964,7 @@
child, getpid());
errno = 0;
lookup_me1 = ptrace(PT_READ_I, child, dummy_fn1, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me1, magic1,
"got value %#x != expected %#x", lookup_me1, magic1);
@@ -3971,7 +3973,7 @@
child, getpid());
errno = 0;
lookup_me2 = ptrace(PT_READ_I, child, dummy_fn2, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me2, magic2,
"got value %#x != expected %#x", lookup_me2, magic2);
@@ -3980,7 +3982,7 @@
child, getpid());
errno = 0;
lookup_me3 = ptrace(PT_READ_I, child, dummy_fn3, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me3, magic3,
"got value %#x != expected %#x", lookup_me3, magic3);
@@ -3989,7 +3991,7 @@
child, getpid());
errno = 0;
lookup_me4 = ptrace(PT_READ_I, child, dummy_fn4, 0);
- ATF_REQUIRE_EQ(errno, 0);
+ SYSCALL_REQUIRE_ERRNO(errno, 0);
ATF_REQUIRE_EQ_MSG(lookup_me4, magic4,
"got value %#x != expected %#x", lookup_me4, magic4);
Home |
Main Index |
Thread Index |
Old Index