Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142972749
D28887.id84561.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
114 KB
Referenced Files
None
Subscribers
None
D28887.id84561.diff
View Options
Index: tests/sys/kern/ptrace_test.c
===================================================================
--- tests/sys/kern/ptrace_test.c
+++ tests/sys/kern/ptrace_test.c
@@ -47,6 +47,7 @@
#include <sched.h>
#include <semaphore.h>
#include <signal.h>
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -88,22 +89,41 @@
* processes. This only works if the parent process is tripped up by
* the early exit and fails some requirement itself.
*/
-#define CHILD_REQUIRE(exp) do { \
- if (!(exp)) \
- child_fail_require(__FILE__, __LINE__, \
- #exp " not met"); \
- } while (0)
+#define CHILD_REQUIRE(exp) do { \
+ if (!(exp)) \
+ child_fail_require(__FILE__, __LINE__, \
+ #exp " not met\n"); \
+} while (0)
+
+#define CHILD_REQUIRE_EQ_INT(actual, expected) do { \
+ __typeof__(expected) _e = expected; \
+ __typeof__(actual) _a = actual; \
+ if (_e != _a) \
+ child_fail_require(__FILE__, __LINE__, #actual \
+ " (%lld) == " #expected " (%lld) not met\n", \
+ (long long)_a, (long long)_e); \
+} while (0)
static __dead2 void
-child_fail_require(const char *file, int line, const char *str)
+child_fail_require(const char *file, int line, const char *fmt, ...)
{
- char buf[128];
+ va_list ap;
+
+ dprintf(2, "%s:%d: ", file, line);
+ va_start(ap, fmt);
+ vdprintf(2, fmt, ap);
+ va_end(ap);
- snprintf(buf, sizeof(buf), "%s:%d: %s\n", file, line, str);
- write(2, buf, strlen(buf));
_exit(32);
}
+#define REQUIRE_EQ_INT(actual, expected) do { \
+ __typeof__(expected) _e = expected; \
+ __typeof__(actual) _a = actual; \
+ ATF_REQUIRE_MSG(_e == _a, #actual " (%lld) == " \
+ #expected " (%lld) not met", (long long)_a, (long long)_e); \
+} while (0)
+
static void
trace_me(void)
{
@@ -121,12 +141,12 @@
pid_t wpid;
int status;
- ATF_REQUIRE(ptrace(PT_ATTACH, pid, NULL, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_ATTACH, pid, NULL, 0), 0);
wpid = waitpid(pid, &status, 0);
- ATF_REQUIRE(wpid == pid);
+ REQUIRE_EQ_INT(wpid, pid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
}
static void
@@ -152,7 +172,7 @@
mib[3] = pid;
len = sizeof(kp);
if (sysctl(mib, nitems(mib), &kp, &len, NULL, 0) == -1) {
- ATF_REQUIRE(errno == ESRCH);
+ REQUIRE_EQ_INT(errno, ESRCH);
break;
}
if (kp.ki_stat == SZOMB)
@@ -183,23 +203,23 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(child, &status, 0);
- ATF_REQUIRE(wpid == child);
+ REQUIRE_EQ_INT(wpid, child);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
/* Continue the child ignoring the SIGSTOP. */
ATF_REQUIRE(ptrace(PT_CONTINUE, child, (caddr_t)1, 0) != -1);
/* The second wait() should report the exit status. */
wpid = waitpid(child, &status, 0);
- ATF_REQUIRE(wpid == child);
+ REQUIRE_EQ_INT(wpid, child);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
/* The child should no longer exist. */
wpid = waitpid(child, &status, 0);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -216,14 +236,14 @@
if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
atf_tc_skip("https://bugs.freebsd.org/244055");
- ATF_REQUIRE(pipe(cpipe) == 0);
+ REQUIRE_EQ_INT(pipe(cpipe), 0);
ATF_REQUIRE((child = fork()) != -1);
if (child == 0) {
/* Child process. */
close(cpipe[0]);
/* Wait for the parent to attach. */
- CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == 0);
+ CHILD_REQUIRE_EQ_INT(0, read(cpipe[1], &c, sizeof(c)));
_exit(1);
}
@@ -242,14 +262,14 @@
/* The second wait() should report the exit status. */
wpid = waitpid(child, &status, 0);
- ATF_REQUIRE(wpid == child);
+ REQUIRE_EQ_INT(wpid, child);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
/* The child should no longer exist. */
wpid = waitpid(child, &status, 0);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -266,7 +286,7 @@
if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
atf_tc_skip("https://bugs.freebsd.org/239399");
- ATF_REQUIRE(pipe(cpipe) == 0);
+ REQUIRE_EQ_INT(pipe(cpipe), 0);
ATF_REQUIRE((child = fork()) != -1);
if (child == 0) {
@@ -274,13 +294,13 @@
close(cpipe[0]);
/* Wait for parent to be ready. */
- CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == sizeof(c));
+ CHILD_REQUIRE_EQ_INT(read(cpipe[1], &c, sizeof(c)), sizeof(c));
_exit(1);
}
close(cpipe[1]);
- ATF_REQUIRE(pipe(dpipe) == 0);
+ REQUIRE_EQ_INT(pipe(dpipe), 0);
ATF_REQUIRE((debugger = fork()) != -1);
if (debugger == 0) {
@@ -290,22 +310,22 @@
CHILD_REQUIRE(ptrace(PT_ATTACH, child, NULL, 0) != -1);
wpid = waitpid(child, &status, 0);
- CHILD_REQUIRE(wpid == child);
+ CHILD_REQUIRE_EQ_INT(wpid, child);
CHILD_REQUIRE(WIFSTOPPED(status));
- CHILD_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ CHILD_REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
CHILD_REQUIRE(ptrace(PT_CONTINUE, child, (caddr_t)1, 0) != -1);
/* Signal parent that debugger is attached. */
- CHILD_REQUIRE(write(dpipe[1], &c, sizeof(c)) == sizeof(c));
+ CHILD_REQUIRE_EQ_INT(write(dpipe[1], &c, sizeof(c)), sizeof(c));
/* Wait for parent's failed wait. */
- CHILD_REQUIRE(read(dpipe[1], &c, sizeof(c)) == 0);
+ CHILD_REQUIRE_EQ_INT(read(dpipe[1], &c, sizeof(c)), 0);
wpid = waitpid(child, &status, 0);
- CHILD_REQUIRE(wpid == child);
+ CHILD_REQUIRE_EQ_INT(wpid, child);
CHILD_REQUIRE(WIFEXITED(status));
- CHILD_REQUIRE(WEXITSTATUS(status) == 1);
+ CHILD_REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
_exit(0);
}
@@ -314,11 +334,11 @@
/* Parent process. */
/* Wait for the debugger to attach to the child. */
- ATF_REQUIRE(read(dpipe[0], &c, sizeof(c)) == sizeof(c));
+ REQUIRE_EQ_INT(read(dpipe[0], &c, sizeof(c)), sizeof(c));
/* Release the child. */
- ATF_REQUIRE(write(cpipe[0], &c, sizeof(c)) == sizeof(c));
- ATF_REQUIRE(read(cpipe[0], &c, sizeof(c)) == 0);
+ REQUIRE_EQ_INT(write(cpipe[0], &c, sizeof(c)), sizeof(c));
+ REQUIRE_EQ_INT(read(cpipe[0], &c, sizeof(c)), 0);
close(cpipe[0]);
wait_for_zombie(child);
@@ -329,22 +349,22 @@
* until the debugger sees the exit.
*/
wpid = waitpid(child, &status, WNOHANG);
- ATF_REQUIRE(wpid == 0);
+ REQUIRE_EQ_INT(wpid, 0);
/* Signal the debugger to wait for the child. */
close(dpipe[0]);
/* Wait for the debugger. */
wpid = waitpid(debugger, &status, 0);
- ATF_REQUIRE(wpid == debugger);
+ REQUIRE_EQ_INT(wpid, debugger);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 0);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 0);
/* The child process should now be ready. */
wpid = waitpid(child, &status, WNOHANG);
- ATF_REQUIRE(wpid == child);
+ REQUIRE_EQ_INT(wpid, child);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
}
/*
@@ -360,7 +380,7 @@
int cpipe[2], dpipe[2], status;
char c;
- ATF_REQUIRE(pipe(cpipe) == 0);
+ REQUIRE_EQ_INT(pipe(cpipe), 0);
ATF_REQUIRE((child = fork()) != -1);
if (child == 0) {
@@ -368,13 +388,13 @@
close(cpipe[0]);
/* Wait for parent to be ready. */
- CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == sizeof(c));
+ CHILD_REQUIRE_EQ_INT(read(cpipe[1], &c, sizeof(c)), sizeof(c));
_exit(1);
}
close(cpipe[1]);
- ATF_REQUIRE(pipe(dpipe) == 0);
+ REQUIRE_EQ_INT(pipe(dpipe), 0);
ATF_REQUIRE((debugger = fork()) != -1);
if (debugger == 0) {
@@ -394,22 +414,22 @@
CHILD_REQUIRE(ptrace(PT_ATTACH, child, NULL, 0) != -1);
wpid = waitpid(child, &status, 0);
- CHILD_REQUIRE(wpid == child);
+ CHILD_REQUIRE_EQ_INT(wpid, child);
CHILD_REQUIRE(WIFSTOPPED(status));
- CHILD_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ CHILD_REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
CHILD_REQUIRE(ptrace(PT_CONTINUE, child, (caddr_t)1, 0) != -1);
/* Signal parent that debugger is attached. */
- CHILD_REQUIRE(write(dpipe[1], &c, sizeof(c)) == sizeof(c));
+ CHILD_REQUIRE_EQ_INT(write(dpipe[1], &c, sizeof(c)), sizeof(c));
/* Wait for parent's failed wait. */
- CHILD_REQUIRE(read(dpipe[1], &c, sizeof(c)) == sizeof(c));
+ CHILD_REQUIRE_EQ_INT(read(dpipe[1], &c, sizeof(c)), sizeof(c));
wpid = waitpid(child, &status, 0);
- CHILD_REQUIRE(wpid == child);
+ CHILD_REQUIRE_EQ_INT(wpid, child);
CHILD_REQUIRE(WIFEXITED(status));
- CHILD_REQUIRE(WEXITSTATUS(status) == 1);
+ CHILD_REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
_exit(0);
}
@@ -419,20 +439,20 @@
/* Wait for the debugger parent process to exit. */
wpid = waitpid(debugger, &status, 0);
- ATF_REQUIRE(wpid == debugger);
+ REQUIRE_EQ_INT(wpid, debugger);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 2);
/* A WNOHANG wait here should see the non-exited child. */
wpid = waitpid(child, &status, WNOHANG);
- ATF_REQUIRE(wpid == 0);
+ REQUIRE_EQ_INT(wpid, 0);
/* Wait for the debugger to attach to the child. */
- ATF_REQUIRE(read(dpipe[0], &c, sizeof(c)) == sizeof(c));
+ REQUIRE_EQ_INT(read(dpipe[0], &c, sizeof(c)), sizeof(c));
/* Release the child. */
- ATF_REQUIRE(write(cpipe[0], &c, sizeof(c)) == sizeof(c));
- ATF_REQUIRE(read(cpipe[0], &c, sizeof(c)) == 0);
+ REQUIRE_EQ_INT(write(cpipe[0], &c, sizeof(c)), sizeof(c));
+ REQUIRE_EQ_INT(read(cpipe[0], &c, sizeof(c)), 0);
close(cpipe[0]);
wait_for_zombie(child);
@@ -443,20 +463,20 @@
* until the debugger sees the exit.
*/
wpid = waitpid(child, &status, WNOHANG);
- ATF_REQUIRE(wpid == 0);
+ REQUIRE_EQ_INT(wpid, 0);
/* Signal the debugger to wait for the child. */
- ATF_REQUIRE(write(dpipe[0], &c, sizeof(c)) == sizeof(c));
+ REQUIRE_EQ_INT(write(dpipe[0], &c, sizeof(c)), sizeof(c));
/* Wait for the debugger. */
- ATF_REQUIRE(read(dpipe[0], &c, sizeof(c)) == 0);
+ REQUIRE_EQ_INT(read(dpipe[0], &c, sizeof(c)), 0);
close(dpipe[0]);
/* The child process should now be ready. */
wpid = waitpid(child, &status, WNOHANG);
- ATF_REQUIRE(wpid == child);
+ REQUIRE_EQ_INT(wpid, child);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
}
/*
@@ -472,11 +492,11 @@
if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
atf_tc_skip("https://bugs.freebsd.org/244056");
- ATF_REQUIRE(pipe(cpipe1) == 0);
- ATF_REQUIRE(pipe(cpipe2) == 0);
- ATF_REQUIRE(pipe(gcpipe) == 0);
+ REQUIRE_EQ_INT(pipe(cpipe1), 0);
+ REQUIRE_EQ_INT(pipe(cpipe2), 0);
+ REQUIRE_EQ_INT(pipe(gcpipe), 0);
- ATF_REQUIRE(procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL) == 0);
+ REQUIRE_EQ_INT(procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL), 0);
ATF_REQUIRE((child = fork()) != -1);
if (child == 0) {
@@ -496,31 +516,34 @@
_exit(status);
}
- ATF_REQUIRE(read(cpipe1[0], &gchild, sizeof(gchild)) == sizeof(gchild));
+ REQUIRE_EQ_INT(read(cpipe1[0], &gchild, sizeof(gchild)),
+ sizeof(gchild));
- ATF_REQUIRE(ptrace(PT_ATTACH, gchild, NULL, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_ATTACH, gchild, NULL, 0), 0);
status = 0;
- ATF_REQUIRE(write(cpipe2[1], &status, sizeof(status)) ==
+ REQUIRE_EQ_INT(write(cpipe2[1], &status, sizeof(status)),
sizeof(status));
- ATF_REQUIRE(waitpid(child, &status, 0) == child);
- ATF_REQUIRE(WIFEXITED(status) && WEXITSTATUS(status) == 0);
+ REQUIRE_EQ_INT(waitpid(child, &status, 0), child);
+ ATF_REQUIRE(WIFEXITED(status));
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 0);
status = 0;
- ATF_REQUIRE(write(gcpipe[1], &status, sizeof(status)) ==
+ REQUIRE_EQ_INT(write(gcpipe[1], &status, sizeof(status)),
sizeof(status));
- ATF_REQUIRE(waitpid(gchild, &status, 0) == gchild);
+ REQUIRE_EQ_INT(waitpid(gchild, &status, 0), gchild);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(ptrace(PT_DETACH, gchild, (caddr_t)1, 0) == 0);
- ATF_REQUIRE(waitpid(gchild, &status, 0) == gchild);
- ATF_REQUIRE(WIFEXITED(status) && WEXITSTATUS(status) == 0);
-
- ATF_REQUIRE(close(cpipe1[0]) == 0);
- ATF_REQUIRE(close(cpipe1[1]) == 0);
- ATF_REQUIRE(close(cpipe2[0]) == 0);
- ATF_REQUIRE(close(cpipe2[1]) == 0);
- ATF_REQUIRE(close(gcpipe[0]) == 0);
- ATF_REQUIRE(close(gcpipe[1]) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_DETACH, gchild, (caddr_t)1, 0), 0);
+ REQUIRE_EQ_INT(waitpid(gchild, &status, 0), gchild);
+ ATF_REQUIRE(WIFEXITED(status));
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 0);
+
+ REQUIRE_EQ_INT(close(cpipe1[0]), 0);
+ REQUIRE_EQ_INT(close(cpipe1[1]), 0);
+ REQUIRE_EQ_INT(close(cpipe2[0]), 0);
+ REQUIRE_EQ_INT(close(cpipe2[1]), 0);
+ REQUIRE_EQ_INT(close(gcpipe[0]), 0);
+ REQUIRE_EQ_INT(close(gcpipe[1]), 0);
}
/*
@@ -543,9 +566,9 @@
_exit(2);
wpid = waitpid(fpid, &status, 0);
- CHILD_REQUIRE(wpid == fpid);
+ CHILD_REQUIRE_EQ_INT(wpid, fpid);
CHILD_REQUIRE(WIFEXITED(status));
- CHILD_REQUIRE(WEXITSTATUS(status) == 2);
+ CHILD_REQUIRE_EQ_INT(WEXITSTATUS(status), 2);
_exit(1);
}
@@ -585,23 +608,23 @@
(PL_FLAG_FORKED | PL_FLAG_CHILD));
if (pl.pl_flags & PL_FLAG_CHILD) {
ATF_REQUIRE(wpid != parent);
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(!fork_reported[1]);
if (child == -1)
child = wpid;
else
- ATF_REQUIRE(child == wpid);
+ REQUIRE_EQ_INT(child, wpid);
if (ppl != NULL)
ppl[1] = pl;
fork_reported[1] = true;
} else {
- ATF_REQUIRE(wpid == parent);
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(wpid, parent);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(!fork_reported[0]);
if (child == -1)
child = pl.pl_child_pid;
else
- ATF_REQUIRE(child == pl.pl_child_pid);
+ REQUIRE_EQ_INT(child, pl.pl_child_pid);
if (ppl != NULL)
ppl[0] = pl;
fork_reported[0] = true;
@@ -633,9 +656,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(children[0], &status, 0);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ_INT(wpid, children[0]);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, children[0], NULL, 1) != -1);
@@ -653,18 +676,18 @@
* grandchild should report its exit first to the debugger.
*/
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[1]);
+ REQUIRE_EQ_INT(wpid, children[1]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 2);
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ_INT(wpid, children[0]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -689,9 +712,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(children[0], &status, 0);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ_INT(wpid, children[0]);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, children[0], NULL, 1) != -1);
@@ -709,13 +732,13 @@
* child.
*/
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ_INT(wpid, children[0]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -740,9 +763,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(children[0], &status, 0);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ_INT(wpid, children[0]);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, children[0], NULL, 1) != -1);
@@ -764,18 +787,18 @@
* after the grandchild.
*/
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[1]);
+ REQUIRE_EQ_INT(wpid, children[1]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 2);
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ_INT(wpid, children[0]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
static void
@@ -792,10 +815,11 @@
/* Send the pid of the disassociated child to the debugger. */
fpid = getpid();
- CHILD_REQUIRE(write(cpipe[1], &fpid, sizeof(fpid)) == sizeof(fpid));
+ CHILD_REQUIRE_EQ_INT(write(cpipe[1], &fpid, sizeof(fpid)),
+ sizeof(fpid));
/* Wait for the debugger to attach. */
- CHILD_REQUIRE(read(cpipe[1], &fpid, sizeof(fpid)) == 0);
+ CHILD_REQUIRE_EQ_INT(read(cpipe[1], &fpid, sizeof(fpid)), 0);
}
/*
@@ -813,7 +837,7 @@
if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
atf_tc_skip("https://bugs.freebsd.org/239397");
- ATF_REQUIRE(pipe(cpipe) == 0);
+ REQUIRE_EQ_INT(pipe(cpipe), 0);
ATF_REQUIRE((fpid = fork()) != -1);
if (fpid == 0) {
attach_fork_parent(cpipe);
@@ -825,12 +849,12 @@
/* Wait for the direct child to exit. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 3);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 3);
/* Read the pid of the fork parent. */
- ATF_REQUIRE(read(cpipe[0], &children[0], sizeof(children[0])) ==
+ REQUIRE_EQ_INT(read(cpipe[0], &children[0], sizeof(children[0])),
sizeof(children[0]));
/* Attach to the fork parent. */
@@ -855,18 +879,18 @@
* so the child should report its exit first to the debugger.
*/
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[1]);
+ REQUIRE_EQ_INT(wpid, children[1]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 2);
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ_INT(wpid, children[0]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -884,7 +908,7 @@
if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
atf_tc_skip("https://bugs.freebsd.org/239292");
- ATF_REQUIRE(pipe(cpipe) == 0);
+ REQUIRE_EQ_INT(pipe(cpipe), 0);
ATF_REQUIRE((fpid = fork()) != -1);
if (fpid == 0) {
attach_fork_parent(cpipe);
@@ -896,12 +920,12 @@
/* Wait for the direct child to exit. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 3);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 3);
/* Read the pid of the fork parent. */
- ATF_REQUIRE(read(cpipe[0], &children[0], sizeof(children[0])) ==
+ REQUIRE_EQ_INT(read(cpipe[0], &children[0], sizeof(children[0])),
sizeof(children[0]));
/* Attach to the fork parent. */
@@ -926,13 +950,13 @@
* parent.
*/
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ_INT(wpid, children[0]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -950,7 +974,7 @@
if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
atf_tc_skip("https://bugs.freebsd.org/239425");
- ATF_REQUIRE(pipe(cpipe) == 0);
+ REQUIRE_EQ_INT(pipe(cpipe), 0);
ATF_REQUIRE((fpid = fork()) != -1);
if (fpid == 0) {
attach_fork_parent(cpipe);
@@ -962,12 +986,12 @@
/* Wait for the direct child to exit. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 3);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 3);
/* Read the pid of the fork parent. */
- ATF_REQUIRE(read(cpipe[0], &children[0], sizeof(children[0])) ==
+ REQUIRE_EQ_INT(read(cpipe[0], &children[0], sizeof(children[0])),
sizeof(children[0]));
/* Attach to the fork parent. */
@@ -992,13 +1016,13 @@
* the child.
*/
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[1]);
+ REQUIRE_EQ_INT(wpid, children[1]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 2);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -1015,8 +1039,7 @@
if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
atf_tc_skip("https://bugs.freebsd.org/240510");
-
- ATF_REQUIRE(pipe(cpipe) == 0);
+ REQUIRE_EQ_INT(pipe(cpipe), 0);
ATF_REQUIRE((child = fork()) != -1);
if (child == 0) {
@@ -1024,7 +1047,7 @@
close(cpipe[0]);
/* Wait for parent to be ready. */
- CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == sizeof(c));
+ CHILD_REQUIRE_EQ_INT(read(cpipe[1], &c, sizeof(c)), sizeof(c));
/* Report the parent PID to the parent. */
ppid = getppid();
@@ -1035,7 +1058,7 @@
}
close(cpipe[1]);
- ATF_REQUIRE(pipe(dpipe) == 0);
+ REQUIRE_EQ_INT(pipe(dpipe), 0);
ATF_REQUIRE((debugger = fork()) != -1);
if (debugger == 0) {
@@ -1045,20 +1068,20 @@
CHILD_REQUIRE(ptrace(PT_ATTACH, child, NULL, 0) != -1);
wpid = waitpid(child, &status, 0);
- CHILD_REQUIRE(wpid == child);
+ CHILD_REQUIRE_EQ_INT(wpid, child);
CHILD_REQUIRE(WIFSTOPPED(status));
- CHILD_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ CHILD_REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
CHILD_REQUIRE(ptrace(PT_CONTINUE, child, (caddr_t)1, 0) != -1);
/* Signal parent that debugger is attached. */
- CHILD_REQUIRE(write(dpipe[1], &c, sizeof(c)) == sizeof(c));
+ CHILD_REQUIRE_EQ_INT(write(dpipe[1], &c, sizeof(c)), sizeof(c));
/* Wait for traced child to exit. */
wpid = waitpid(child, &status, 0);
- CHILD_REQUIRE(wpid == child);
+ CHILD_REQUIRE_EQ_INT(wpid, child);
CHILD_REQUIRE(WIFEXITED(status));
- CHILD_REQUIRE(WEXITSTATUS(status) == 1);
+ CHILD_REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
_exit(0);
}
@@ -1067,28 +1090,28 @@
/* Parent process. */
/* Wait for the debugger to attach to the child. */
- ATF_REQUIRE(read(dpipe[0], &c, sizeof(c)) == sizeof(c));
+ REQUIRE_EQ_INT(read(dpipe[0], &c, sizeof(c)), sizeof(c));
/* Release the child. */
- ATF_REQUIRE(write(cpipe[0], &c, sizeof(c)) == sizeof(c));
+ REQUIRE_EQ_INT(write(cpipe[0], &c, sizeof(c)), sizeof(c));
/* Read the parent PID from the child. */
- ATF_REQUIRE(read(cpipe[0], &ppid, sizeof(ppid)) == sizeof(ppid));
+ REQUIRE_EQ_INT(read(cpipe[0], &ppid, sizeof(ppid)), sizeof(ppid));
close(cpipe[0]);
- ATF_REQUIRE(ppid == getpid());
+ REQUIRE_EQ_INT(ppid, getpid());
/* Wait for the debugger. */
wpid = waitpid(debugger, &status, 0);
- ATF_REQUIRE(wpid == debugger);
+ REQUIRE_EQ_INT(wpid, debugger);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 0);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 0);
/* The child process should now be ready. */
wpid = waitpid(child, &status, WNOHANG);
- ATF_REQUIRE(wpid == child);
+ REQUIRE_EQ_INT(wpid, child);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
}
/*
@@ -1113,9 +1136,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(children[0], &status, 0);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ_INT(wpid, children[0]);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, children[0], NULL, 1) != -1);
@@ -1128,9 +1151,9 @@
ATF_REQUIRE((pl[0].pl_flags & PL_FLAG_SCX) != 0);
ATF_REQUIRE((pl[1].pl_flags & PL_FLAG_SCX) != 0);
- ATF_REQUIRE(pl[0].pl_syscall_code == SYS_fork);
- ATF_REQUIRE(pl[0].pl_syscall_code == pl[1].pl_syscall_code);
- ATF_REQUIRE(pl[0].pl_syscall_narg == pl[1].pl_syscall_narg);
+ REQUIRE_EQ_INT(pl[0].pl_syscall_code, SYS_fork);
+ REQUIRE_EQ_INT(pl[0].pl_syscall_code, pl[1].pl_syscall_code);
+ REQUIRE_EQ_INT(pl[0].pl_syscall_narg, pl[1].pl_syscall_narg);
ATF_REQUIRE(ptrace(PT_CONTINUE, children[0], (caddr_t)1, 0) != -1);
ATF_REQUIRE(ptrace(PT_CONTINUE, children[1], (caddr_t)1, 0) != -1);
@@ -1140,18 +1163,18 @@
* grandchild should report its exit first to the debugger.
*/
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[1]);
+ REQUIRE_EQ_INT(wpid, children[1]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 2);
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ_INT(wpid, children[0]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -1176,9 +1199,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(children[0], &status, 0);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ_INT(wpid, children[0]);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, children[0], NULL, 1) != -1);
@@ -1191,9 +1214,9 @@
ATF_REQUIRE((pl[0].pl_flags & PL_FLAG_SCX) != 0);
ATF_REQUIRE((pl[1].pl_flags & PL_FLAG_SCX) != 0);
- ATF_REQUIRE(pl[0].pl_syscall_code == SYS_vfork);
- ATF_REQUIRE(pl[0].pl_syscall_code == pl[1].pl_syscall_code);
- ATF_REQUIRE(pl[0].pl_syscall_narg == pl[1].pl_syscall_narg);
+ REQUIRE_EQ_INT(pl[0].pl_syscall_code, SYS_vfork);
+ REQUIRE_EQ_INT(pl[0].pl_syscall_code, pl[1].pl_syscall_code);
+ REQUIRE_EQ_INT(pl[0].pl_syscall_narg, pl[1].pl_syscall_narg);
ATF_REQUIRE(ptrace(PT_CONTINUE, children[0], (caddr_t)1, 0) != -1);
ATF_REQUIRE(ptrace(PT_CONTINUE, children[1], (caddr_t)1, 0) != -1);
@@ -1203,18 +1226,18 @@
* grandchild should report its exit first to the debugger.
*/
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[1]);
+ REQUIRE_EQ_INT(wpid, children[1]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 2);
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ_INT(wpid, children[0]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
static void *
@@ -1229,8 +1252,9 @@
{
pthread_t thread;
- CHILD_REQUIRE(pthread_create(&thread, NULL, simple_thread, NULL) == 0);
- CHILD_REQUIRE(pthread_join(thread, NULL) == 0);
+ CHILD_REQUIRE_EQ_INT(pthread_create(&thread, NULL, simple_thread, NULL),
+ 0);
+ CHILD_REQUIRE_EQ_INT(pthread_join(thread, NULL), 0);
exit(1);
}
@@ -1254,9 +1278,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl,
sizeof(pl)) != -1);
@@ -1277,10 +1301,10 @@
*/
for (;;) {
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
-
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
+
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl,
sizeof(pl)) != -1);
ATF_REQUIRE((pl.pl_flags & PL_FLAG_SCX) != 0);
@@ -1289,27 +1313,27 @@
/* New thread seen. */
break;
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
}
/* Wait for the child to exit. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
for (;;) {
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
if (WIFEXITED(status))
break;
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
}
-
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -1331,54 +1355,54 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl,
sizeof(pl)) != -1);
lwps[0] = pl.pl_lwpid;
- ATF_REQUIRE(ptrace(PT_LWP_EVENTS, wpid, NULL, 1) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_LWP_EVENTS, wpid, NULL, 1), 0);
/* Continue the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The first event should be for the child thread's birth. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
-
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
+
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
- ATF_REQUIRE((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)) ==
+ REQUIRE_EQ_INT((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)),
(PL_FLAG_BORN | PL_FLAG_SCX));
ATF_REQUIRE(pl.pl_lwpid != lwps[0]);
lwps[1] = pl.pl_lwpid;
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The next event should be for the child thread's death. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
-
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
+
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
- ATF_REQUIRE((pl.pl_flags & (PL_FLAG_EXITED | PL_FLAG_SCE)) ==
+ REQUIRE_EQ_INT((pl.pl_flags & (PL_FLAG_EXITED | PL_FLAG_SCE)),
(PL_FLAG_EXITED | PL_FLAG_SCE));
- ATF_REQUIRE(pl.pl_lwpid == lwps[1]);
+ REQUIRE_EQ_INT(pl.pl_lwpid, lwps[1]);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The last event should be for the child process's exit. */
wpid = waitpid(fpid, &status, 0);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
static void *
@@ -1394,7 +1418,8 @@
{
pthread_t thread;
- CHILD_REQUIRE(pthread_create(&thread, NULL, exec_thread, NULL) == 0);
+ CHILD_REQUIRE_EQ_INT(pthread_create(&thread, NULL, exec_thread, NULL),
+ 0);
for (;;)
sleep(60);
exit(1);
@@ -1420,69 +1445,69 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl,
sizeof(pl)) != -1);
lwps[0] = pl.pl_lwpid;
- ATF_REQUIRE(ptrace(PT_LWP_EVENTS, wpid, NULL, 1) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_LWP_EVENTS, wpid, NULL, 1), 0);
/* Continue the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The first event should be for the child thread's birth. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
-
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
+
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
- ATF_REQUIRE((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)) ==
+ REQUIRE_EQ_INT((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)),
(PL_FLAG_BORN | PL_FLAG_SCX));
ATF_REQUIRE(pl.pl_lwpid != lwps[0]);
lwps[1] = pl.pl_lwpid;
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/*
* The next event should be for the main thread's death due to
* single threading from execve().
*/
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
- ATF_REQUIRE((pl.pl_flags & (PL_FLAG_EXITED | PL_FLAG_SCE)) ==
+ REQUIRE_EQ_INT((pl.pl_flags & (PL_FLAG_EXITED | PL_FLAG_SCE)),
(PL_FLAG_EXITED));
- ATF_REQUIRE(pl.pl_lwpid == lwps[0]);
+ REQUIRE_EQ_INT(pl.pl_lwpid, lwps[0]);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The next event should be for the child process's exec. */
wpid = waitpid(fpid, &status, 0);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
- ATF_REQUIRE((pl.pl_flags & (PL_FLAG_EXEC | PL_FLAG_SCX)) ==
+ REQUIRE_EQ_INT((pl.pl_flags & (PL_FLAG_EXEC | PL_FLAG_SCX)),
(PL_FLAG_EXEC | PL_FLAG_SCX));
- ATF_REQUIRE(pl.pl_lwpid == lwps[1]);
+ REQUIRE_EQ_INT(pl.pl_lwpid, lwps[1]);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The last event should be for the child process's exit. */
wpid = waitpid(fpid, &status, 0);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 0);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 0);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
static void
@@ -1517,33 +1542,33 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The next event should be for the SIGINFO. */
wpid = waitpid(fpid, &status, 0);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGINFO);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGINFO);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
- ATF_REQUIRE(pl.pl_event == PL_EVENT_SIGNAL);
+ REQUIRE_EQ_INT(pl.pl_event, PL_EVENT_SIGNAL);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SI);
- ATF_REQUIRE(pl.pl_siginfo.si_code == SI_LWP);
- ATF_REQUIRE(pl.pl_siginfo.si_pid == wpid);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_code, SI_LWP);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_pid, wpid);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The last event should be for the child process's exit. */
wpid = waitpid(fpid, &status, 0);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 0);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 0);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -1563,24 +1588,24 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
events = 0;
ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, fpid, (caddr_t)&events,
sizeof(events)) == 0);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* Should get one event at exit. */
wpid = waitpid(fpid, &status, 0);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 0);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 0);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
ATF_TC_WITHOUT_HEAD(ptrace__ptrace_exec_enable);
@@ -1598,35 +1623,35 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
events = PTRACE_EXEC;
ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, fpid, (caddr_t)&events,
sizeof(events)) == 0);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The next event should be for the child process's exec. */
wpid = waitpid(fpid, &status, 0);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
- ATF_REQUIRE((pl.pl_flags & (PL_FLAG_EXEC | PL_FLAG_SCX)) ==
+ REQUIRE_EQ_INT((pl.pl_flags & (PL_FLAG_EXEC | PL_FLAG_SCX)),
(PL_FLAG_EXEC | PL_FLAG_SCX));
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The last event should be for the child process's exit. */
wpid = waitpid(fpid, &status, 0);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 0);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 0);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
ATF_TC_WITHOUT_HEAD(ptrace__event_mask);
@@ -1643,9 +1668,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
/* PT_FOLLOW_FORK should toggle the state of PTRACE_FORK. */
ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, fpid, NULL, 1) != -1);
@@ -1667,16 +1692,16 @@
sizeof(events)) == 0);
ATF_REQUIRE(!(events & PTRACE_LWP));
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* Should get one event at exit. */
wpid = waitpid(fpid, &status, 0);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 0);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 0);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -1697,9 +1722,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, fpid, (caddr_t)&events,
sizeof(events)) == 0);
@@ -1712,22 +1737,22 @@
/* The next event should report the end of the vfork. */
wpid = wait(&status);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE((pl.pl_flags & PL_FLAG_VFORK_DONE) != 0);
ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) != -1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
ATF_TC_WITHOUT_HEAD(ptrace__ptrace_vfork_follow);
@@ -1748,9 +1773,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(children[0], &status, 0);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ_INT(wpid, children[0]);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, children[0], (caddr_t)&events,
sizeof(events)) == 0);
@@ -1775,18 +1800,18 @@
* grandchild should report its exit first to the debugger.
*/
wpid = waitpid(children[1], &status, 0);
- ATF_REQUIRE(wpid == children[1]);
+ REQUIRE_EQ_INT(wpid, children[1]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 2);
/*
* The child should report it's vfork() completion before it
* exits.
*/
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ_INT(wpid, children[0]);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl[0], sizeof(pl[0])) !=
-1);
ATF_REQUIRE((pl[0].pl_flags & PL_FLAG_VFORK_DONE) != 0);
@@ -1794,13 +1819,13 @@
ATF_REQUIRE(ptrace(PT_CONTINUE, children[0], (caddr_t)1, 0) != -1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ_INT(wpid, children[0]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
#ifdef HAVE_BREAKPOINT
@@ -1823,31 +1848,31 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
/* Continue the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The second wait() should report hitting the breakpoint. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
/* Kill the child process. */
- ATF_REQUIRE(ptrace(PT_KILL, fpid, 0, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_KILL, fpid, 0, 0), 0);
/* The last wait() should report the SIGKILL. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSIGNALED(status));
- ATF_REQUIRE(WTERMSIG(status) == SIGKILL);
+ REQUIRE_EQ_INT(WTERMSIG(status), SIGKILL);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
#endif /* HAVE_BREAKPOINT */
@@ -1871,34 +1896,34 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
/* Continue the child ignoring the SIGSTOP and tracing system calls. */
- ATF_REQUIRE(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0), 0);
/* The second wait() should report a system call entry for getpid(). */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCE);
/* Kill the child process. */
- ATF_REQUIRE(ptrace(PT_KILL, fpid, 0, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_KILL, fpid, 0, 0), 0);
/* The last wait() should report the SIGKILL. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSIGNALED(status));
- ATF_REQUIRE(WTERMSIG(status) == SIGKILL);
+ REQUIRE_EQ_INT(WTERMSIG(status), SIGKILL);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -1921,42 +1946,42 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl,
sizeof(pl)) != -1);
main_lwp = pl.pl_lwpid;
- ATF_REQUIRE(ptrace(PT_LWP_EVENTS, wpid, NULL, 1) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_LWP_EVENTS, wpid, NULL, 1), 0);
/* Continue the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The first event should be for the child thread's birth. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
-
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
+
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
- ATF_REQUIRE((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)) ==
+ REQUIRE_EQ_INT((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)),
(PL_FLAG_BORN | PL_FLAG_SCX));
ATF_REQUIRE(pl.pl_lwpid != main_lwp);
/* Kill the child process. */
- ATF_REQUIRE(ptrace(PT_KILL, fpid, 0, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_KILL, fpid, 0, 0), 0);
/* The last wait() should report the SIGKILL. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSIGNALED(status));
- ATF_REQUIRE(WTERMSIG(status) == SIGKILL);
+ REQUIRE_EQ_INT(WTERMSIG(status), SIGKILL);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
static void *
@@ -1969,7 +1994,7 @@
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGUSR1);
- CHILD_REQUIRE(pthread_sigmask(SIG_BLOCK, &sigmask, NULL) == 0);
+ CHILD_REQUIRE_EQ_INT(pthread_sigmask(SIG_BLOCK, &sigmask, NULL), 0);
/* Sync up with other thread after sigmask updated. */
pthread_barrier_wait(pbarrier);
@@ -2005,11 +2030,12 @@
CPU_ZERO(&setmask);
CPU_SET(0, &setmask);
cpusetid_t setid;
- CHILD_REQUIRE(cpuset(&setid) == 0);
+ CHILD_REQUIRE_EQ_INT(cpuset(&setid), 0);
CHILD_REQUIRE(cpuset_setaffinity(CPU_LEVEL_CPUSET,
CPU_WHICH_CPUSET, setid, sizeof(setmask), &setmask) == 0);
- CHILD_REQUIRE(pthread_barrier_init(&barrier, NULL, 2) == 0);
+ CHILD_REQUIRE_EQ_INT(pthread_barrier_init(&barrier, NULL, 2),
+ 0);
CHILD_REQUIRE(pthread_create(&t, NULL, mask_usr1_thread,
(void*)&barrier) == 0);
@@ -2031,7 +2057,8 @@
sigset_t sigmask;
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGUSR2);
- CHILD_REQUIRE(pthread_sigmask(SIG_BLOCK, &sigmask, NULL) == 0);
+ CHILD_REQUIRE_EQ_INT(pthread_sigmask(SIG_BLOCK, &sigmask, NULL),
+ 0);
/* Sync up with other thread after sigmask updated. */
pthread_barrier_wait(&barrier);
@@ -2046,37 +2073,37 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
/* Continue the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* Send a signal that only the second thread can handle. */
- ATF_REQUIRE(kill(fpid, SIGUSR2) == 0);
+ REQUIRE_EQ_INT(kill(fpid, SIGUSR2), 0);
/* The second wait() should report the SIGUSR2. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGUSR2);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGUSR2);
/* Send a signal that only the first thread can handle. */
- ATF_REQUIRE(kill(fpid, SIGUSR1) == 0);
+ REQUIRE_EQ_INT(kill(fpid, SIGUSR1), 0);
/* Replace the SIGUSR2 with a kill. */
- ATF_REQUIRE(ptrace(PT_KILL, fpid, 0, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_KILL, fpid, 0, 0), 0);
/* The last wait() should report the SIGKILL (not the SIGUSR signal). */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSIGNALED(status));
- ATF_REQUIRE(WTERMSIG(status) == SIGKILL);
+ REQUIRE_EQ_INT(WTERMSIG(status), SIGKILL);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -2111,11 +2138,12 @@
CPU_ZERO(&setmask);
CPU_SET(0, &setmask);
cpusetid_t setid;
- CHILD_REQUIRE(cpuset(&setid) == 0);
+ CHILD_REQUIRE_EQ_INT(cpuset(&setid), 0);
CHILD_REQUIRE(cpuset_setaffinity(CPU_LEVEL_CPUSET,
CPU_WHICH_CPUSET, setid, sizeof(setmask), &setmask) == 0);
- CHILD_REQUIRE(pthread_barrier_init(&barrier, NULL, 2) == 0);
+ CHILD_REQUIRE_EQ_INT(pthread_barrier_init(&barrier, NULL, 2),
+ 0);
CHILD_REQUIRE(pthread_create(&t, NULL, mask_usr1_thread,
(void*)&barrier) == 0);
@@ -2137,7 +2165,8 @@
sigset_t sigmask;
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGUSR2);
- CHILD_REQUIRE(pthread_sigmask(SIG_BLOCK, &sigmask, NULL) == 0);
+ CHILD_REQUIRE_EQ_INT(pthread_sigmask(SIG_BLOCK, &sigmask, NULL),
+ 0);
/* Sync up with other thread after sigmask updated. */
pthread_barrier_wait(&barrier);
@@ -2151,15 +2180,15 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
main_lwp = pl.pl_lwpid;
/* Continue the child ignoring the SIGSTOP and tracing system calls. */
- ATF_REQUIRE(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0), 0);
/*
* Continue until child is done with setup, which is indicated with
@@ -2167,44 +2196,44 @@
*/
for (;;) {
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
if (WSTOPSIG(status) == SIGTRAP) {
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl,
sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & (PL_FLAG_SCE | PL_FLAG_SCX));
} else {
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
break;
}
- ATF_REQUIRE(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0), 0);
}
/* Proceed, allowing main thread to hit syscall entry for getpid(). */
- ATF_REQUIRE(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0), 0);
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl,
sizeof(pl)) != -1);
- ATF_REQUIRE(pl.pl_lwpid == main_lwp);
+ REQUIRE_EQ_INT(pl.pl_lwpid, main_lwp);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCE);
/* Prevent the main thread from hitting its syscall exit for now. */
- ATF_REQUIRE(ptrace(PT_SUSPEND, main_lwp, 0, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_SUSPEND, main_lwp, 0, 0), 0);
/*
* Proceed, allowing second thread to hit syscall exit for
* pthread_barrier_wait().
*/
- ATF_REQUIRE(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0), 0);
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl,
sizeof(pl)) != -1);
@@ -2212,18 +2241,18 @@
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCX);
/* Send a signal that only the second thread can handle. */
- ATF_REQUIRE(kill(fpid, SIGUSR2) == 0);
+ REQUIRE_EQ_INT(kill(fpid, SIGUSR2), 0);
- ATF_REQUIRE(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0), 0);
/* The next wait() should report the SIGUSR2. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGUSR2);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGUSR2);
/* Allow the main thread to try to finish its system call. */
- ATF_REQUIRE(ptrace(PT_RESUME, main_lwp, 0, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_RESUME, main_lwp, 0, 0), 0);
/*
* At this point, the main thread is in the middle of a system call and
@@ -2235,24 +2264,24 @@
*/
/* Replace the SIGUSR2 with a kill. */
- ATF_REQUIRE(ptrace(PT_KILL, fpid, 0, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_KILL, fpid, 0, 0), 0);
/* The last wait() should report the SIGKILL (not a syscall exit). */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSIGNALED(status));
- ATF_REQUIRE(WTERMSIG(status) == SIGKILL);
+ REQUIRE_EQ_INT(WTERMSIG(status), SIGKILL);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
static void
sigusr1_handler(int sig)
{
- CHILD_REQUIRE(sig == SIGUSR1);
+ CHILD_REQUIRE_EQ_INT(sig, SIGUSR1);
_exit(2);
}
@@ -2279,9 +2308,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
len = sizeof(max_pending_per_proc);
ATF_REQUIRE(sysctlbyname("kern.sigqueue.max_pending_per_proc",
@@ -2289,20 +2318,20 @@
/* Fill the signal queue. */
for (i = 0; i < max_pending_per_proc; ++i)
- ATF_REQUIRE(kill(fpid, SIGUSR1) == 0);
+ REQUIRE_EQ_INT(kill(fpid, SIGUSR1), 0);
/* Kill the child process. */
- ATF_REQUIRE(ptrace(PT_KILL, fpid, 0, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_KILL, fpid, 0, 0), 0);
/* The last wait() should report the SIGKILL. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSIGNALED(status));
- ATF_REQUIRE(WTERMSIG(status) == SIGKILL);
+ REQUIRE_EQ_INT(WTERMSIG(status), SIGKILL);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -2328,24 +2357,24 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
/* Continue the child ignoring the SIGSTOP and tracing system calls. */
- ATF_REQUIRE(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0), 0);
/* The second wait() should report a system call entry for getpid(). */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCE);
/* Continue the child process with a signal. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1), 0);
for (;;) {
/*
@@ -2354,21 +2383,22 @@
* past any syscall stops.
*/
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
if (WIFSTOPPED(status) && WSTOPSIG(status) == SIGTRAP) {
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & (PL_FLAG_SCE | PL_FLAG_SCX));
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0),
+ 0);
} else {
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 2);
break;
}
}
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
static void
@@ -2376,7 +2406,7 @@
{
static int counter = 0;
- CHILD_REQUIRE(sig == SIGUSR1);
+ CHILD_REQUIRE_EQ_INT(sig, SIGUSR1);
counter++;
if (counter == 2)
_exit(2);
@@ -2405,36 +2435,36 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
/* Continue the child ignoring the SIGSTOP and tracing system calls. */
- ATF_REQUIRE(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0), 0);
/* The second wait() should report a system call entry for getpid(). */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCE);
/* Continue the child process with a signal. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1), 0);
/* The third wait() should report a system call exit for getpid(). */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCX);
/* Continue the child process with a signal. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1), 0);
for (;;) {
/*
@@ -2443,21 +2473,22 @@
* past any syscall stops.
*/
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
if (WIFSTOPPED(status) && WSTOPSIG(status) == SIGTRAP) {
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & (PL_FLAG_SCE | PL_FLAG_SCX));
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0),
+ 0);
} else {
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 2);
break;
}
}
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -2484,9 +2515,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
len = sizeof(max_pending_per_proc);
ATF_REQUIRE(sysctlbyname("kern.sigqueue.max_pending_per_proc",
@@ -2494,31 +2525,32 @@
/* Fill the signal queue. */
for (i = 0; i < max_pending_per_proc; ++i)
- ATF_REQUIRE(kill(fpid, SIGUSR2) == 0);
+ REQUIRE_EQ_INT(kill(fpid, SIGUSR2), 0);
/* Continue with signal. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1), 0);
for (;;) {
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
if (WIFSTOPPED(status)) {
- ATF_REQUIRE(WSTOPSIG(status) == SIGUSR2);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGUSR2);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0),
+ 0);
} else {
/*
* The last wait() should report normal _exit from the
* SIGUSR1 handler.
*/
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 2);
break;
}
}
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
static sem_t sigusr1_sem;
@@ -2529,7 +2561,7 @@
{
got_usr1++;
- CHILD_REQUIRE(sem_post(&sigusr1_sem) == 0);
+ CHILD_REQUIRE_EQ_INT(sem_post(&sigusr1_sem), 0);
}
/*
@@ -2549,35 +2581,36 @@
sigset_t sigmask;
ATF_REQUIRE(signal(SIGUSR2, handler) != SIG_ERR);
- ATF_REQUIRE(sem_init(&sigusr1_sem, 0, 0) == 0);
+ REQUIRE_EQ_INT(sem_init(&sigusr1_sem, 0, 0), 0);
ATF_REQUIRE(signal(SIGUSR1, sigusr1_sempost_handler) != SIG_ERR);
got_usr1 = 0;
ATF_REQUIRE((fpid = fork()) != -1);
if (fpid == 0) {
- CHILD_REQUIRE(sigemptyset(&sigmask) == 0);
- CHILD_REQUIRE(sigaddset(&sigmask, SIGUSR1) == 0);
- CHILD_REQUIRE(sigprocmask(SIG_BLOCK, &sigmask, NULL) == 0);
+ CHILD_REQUIRE_EQ_INT(sigemptyset(&sigmask), 0);
+ CHILD_REQUIRE_EQ_INT(sigaddset(&sigmask, SIGUSR1), 0);
+ CHILD_REQUIRE_EQ_INT(sigprocmask(SIG_BLOCK, &sigmask, NULL), 0);
trace_me();
- CHILD_REQUIRE(got_usr1 == 0);
+ CHILD_REQUIRE_EQ_INT(got_usr1, 0);
/* Allow the pending SIGUSR1 in now. */
- CHILD_REQUIRE(sigprocmask(SIG_UNBLOCK, &sigmask, NULL) == 0);
+ CHILD_REQUIRE_EQ_INT(sigprocmask(SIG_UNBLOCK, &sigmask, NULL),
+ 0);
/* Wait to receive the SIGUSR1. */
do {
err = sem_wait(&sigusr1_sem);
CHILD_REQUIRE(err == 0 || errno == EINTR);
} while (err != 0 && errno == EINTR);
- CHILD_REQUIRE(got_usr1 == 1);
+ CHILD_REQUIRE_EQ_INT(got_usr1, 1);
exit(1);
}
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
len = sizeof(max_pending_per_proc);
ATF_REQUIRE(sysctlbyname("kern.sigqueue.max_pending_per_proc",
@@ -2585,40 +2618,40 @@
/* Fill the signal queue. */
for (i = 0; i < max_pending_per_proc; ++i)
- ATF_REQUIRE(kill(fpid, SIGUSR2) == 0);
+ REQUIRE_EQ_INT(kill(fpid, SIGUSR2), 0);
/* Continue with signal. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1), 0);
/* Collect and ignore all of the SIGUSR2. */
for (i = 0; i < max_pending_per_proc; ++i) {
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGUSR2);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGUSR2);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
}
/* Now our PT_CONTINUE'd SIGUSR1 should cause a stop after unmask. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGUSR1);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGUSR1);
ATF_REQUIRE(ptrace(PT_LWPINFO, fpid, (caddr_t)&pl, sizeof(pl)) != -1);
- ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGUSR1);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_signo, SIGUSR1);
/* Continue the child, ignoring the SIGUSR1. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The last wait() should report exit after receiving SIGUSR1. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -2641,40 +2674,40 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* Send a signal without ptrace. */
- ATF_REQUIRE(kill(fpid, SIGINT) == 0);
+ REQUIRE_EQ_INT(kill(fpid, SIGINT), 0);
/* The second wait() should report a SIGINT was received. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGINT);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGINT);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SI);
- ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGINT);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_signo, SIGINT);
/* Continue the child process with a different signal. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGTERM) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGTERM), 0);
/*
* The last wait() should report having died due to the new
* signal, SIGTERM.
*/
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSIGNALED(status));
- ATF_REQUIRE(WTERMSIG(status) == SIGTERM);
+ REQUIRE_EQ_INT(WTERMSIG(status), SIGTERM);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -2695,31 +2728,31 @@
trace_me();
/* SIGTRAP expected to cause exit on syscall entry. */
rl.rlim_cur = rl.rlim_max = 0;
- ATF_REQUIRE(setrlimit(RLIMIT_CORE, &rl) == 0);
+ REQUIRE_EQ_INT(setrlimit(RLIMIT_CORE, &rl), 0);
getpid();
exit(1);
}
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
/* Continue the child ignoring the SIGSTOP and tracing system calls. */
- ATF_REQUIRE(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0), 0);
/* The second wait() should report a system call entry for getpid(). */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCE);
/* Continue the child process with a SIGTRAP. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGTRAP) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGTRAP), 0);
for (;;) {
/*
@@ -2727,22 +2760,22 @@
* meantime, catch and proceed past any syscall stops.
*/
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
if (WIFSTOPPED(status) && WSTOPSIG(status) == SIGTRAP) {
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & (PL_FLAG_SCE | PL_FLAG_SCX));
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0),
+ 0);
} else {
ATF_REQUIRE(WIFSIGNALED(status));
- ATF_REQUIRE(WTERMSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WTERMSIG(status), SIGTRAP);
break;
}
}
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
-
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -2766,52 +2799,52 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
/* Continue the child ignoring the SIGSTOP and tracing system calls. */
- ATF_REQUIRE(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0), 0);
/* The second wait() should report a system call entry for getpid(). */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCE);
/* Continue with the first SIGUSR1. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1), 0);
/* The next wait() should report a system call exit for getpid(). */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCX);
/* Send an ABRT without ptrace. */
- ATF_REQUIRE(kill(fpid, SIGABRT) == 0);
+ REQUIRE_EQ_INT(kill(fpid, SIGABRT), 0);
/* Continue normally. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The next wait() should report the SIGABRT. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGABRT);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGABRT);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SI);
- ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGABRT);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_signo, SIGABRT);
/* Continue, replacing the SIGABRT with another SIGUSR1. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1), 0);
for (;;) {
/*
@@ -2820,22 +2853,22 @@
* past any syscall stops.
*/
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
if (WIFSTOPPED(status) && WSTOPSIG(status) == SIGTRAP) {
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & (PL_FLAG_SCE | PL_FLAG_SCX));
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0),
+ 0);
} else {
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 2);
break;
}
}
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
-
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -2854,7 +2887,7 @@
if (fpid == 0) {
CHILD_REQUIRE((kq = kqueue()) > 0);
EV_SET(&kev, SIGUSR1, EVFILT_SIGNAL, EV_ADD, 0, 0, 0);
- CHILD_REQUIRE(kevent(kq, &kev, 1, NULL, 0, NULL) == 0);
+ CHILD_REQUIRE_EQ_INT(kevent(kq, &kev, 1, NULL, 0, NULL), 0);
trace_me();
@@ -2863,8 +2896,8 @@
if (nevents == -1 && errno == EINTR)
continue;
CHILD_REQUIRE(nevents > 0);
- CHILD_REQUIRE(kev.filter == EVFILT_SIGNAL);
- CHILD_REQUIRE(kev.ident == SIGUSR1);
+ CHILD_REQUIRE_EQ_INT(kev.filter, EVFILT_SIGNAL);
+ CHILD_REQUIRE_EQ_INT(kev.ident, SIGUSR1);
break;
}
@@ -2873,24 +2906,24 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
/* Continue with the SIGUSR1. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1), 0);
/*
* The last wait() should report normal exit with code 1.
*/
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
static void *
@@ -2914,9 +2947,9 @@
* Swap ignore duties; the next SIGUSR1 should go to the
* other thread.
*/
- CHILD_REQUIRE(sigemptyset(&sigmask) == 0);
- CHILD_REQUIRE(sigaddset(&sigmask, SIGUSR1) == 0);
- CHILD_REQUIRE(pthread_sigmask(SIG_BLOCK, &sigmask, NULL) == 0);
+ CHILD_REQUIRE_EQ_INT(sigemptyset(&sigmask), 0);
+ CHILD_REQUIRE_EQ_INT(sigaddset(&sigmask, SIGUSR1), 0);
+ CHILD_REQUIRE_EQ_INT(pthread_sigmask(SIG_BLOCK, &sigmask, NULL), 0);
/* Sync up threads after swapping signal masks. */
pthread_barrier_wait(pbarrier);
@@ -2939,64 +2972,65 @@
int status, err;
sigset_t sigmask;
- ATF_REQUIRE(sem_init(&sigusr1_sem, 0, 0) == 0);
+ REQUIRE_EQ_INT(sem_init(&sigusr1_sem, 0, 0), 0);
ATF_REQUIRE(signal(SIGUSR1, sigusr1_sempost_handler) != SIG_ERR);
got_usr1 = 0;
ATF_REQUIRE((fpid = fork()) != -1);
if (fpid == 0) {
- CHILD_REQUIRE(sigemptyset(&sigmask) == 0);
- CHILD_REQUIRE(sigaddset(&sigmask, SIGUSR1) == 0);
- CHILD_REQUIRE(sigprocmask(SIG_BLOCK, &sigmask, NULL) == 0);
+ CHILD_REQUIRE_EQ_INT(sigemptyset(&sigmask), 0);
+ CHILD_REQUIRE_EQ_INT(sigaddset(&sigmask, SIGUSR1), 0);
+ CHILD_REQUIRE_EQ_INT(sigprocmask(SIG_BLOCK, &sigmask, NULL), 0);
trace_me();
- CHILD_REQUIRE(got_usr1 == 0);
+ CHILD_REQUIRE_EQ_INT(got_usr1, 0);
/* Allow the pending SIGUSR1 in now. */
- CHILD_REQUIRE(sigprocmask(SIG_UNBLOCK, &sigmask, NULL) == 0);
+ CHILD_REQUIRE_EQ_INT(sigprocmask(SIG_UNBLOCK, &sigmask, NULL),
+ 0);
/* Wait to receive a SIGUSR1. */
do {
err = sem_wait(&sigusr1_sem);
CHILD_REQUIRE(err == 0 || errno == EINTR);
} while (err != 0 && errno == EINTR);
- CHILD_REQUIRE(got_usr1 == 1);
+ CHILD_REQUIRE_EQ_INT(got_usr1, 1);
exit(1);
}
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_LWPINFO, fpid, (caddr_t)&pl, sizeof(pl)) != -1);
- ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGSTOP);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_signo, SIGSTOP);
/* Send blocked SIGUSR1 which should cause a stop. */
- ATF_REQUIRE(kill(fpid, SIGUSR1) == 0);
+ REQUIRE_EQ_INT(kill(fpid, SIGUSR1), 0);
/* Continue the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The next wait() should report the kill(SIGUSR1) was received. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGUSR1);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGUSR1);
ATF_REQUIRE(ptrace(PT_LWPINFO, fpid, (caddr_t)&pl, sizeof(pl)) != -1);
- ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGUSR1);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_signo, SIGUSR1);
/* Continue the child, allowing in the SIGUSR1. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1), 0);
/* The last wait() should report normal exit with code 1. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -3011,62 +3045,63 @@
int status, err;
sigset_t sigmask;
- ATF_REQUIRE(sem_init(&sigusr1_sem, 0, 0) == 0);
+ REQUIRE_EQ_INT(sem_init(&sigusr1_sem, 0, 0), 0);
ATF_REQUIRE(signal(SIGUSR1, sigusr1_sempost_handler) != SIG_ERR);
got_usr1 = 0;
ATF_REQUIRE((fpid = fork()) != -1);
if (fpid == 0) {
- CHILD_REQUIRE(sigemptyset(&sigmask) == 0);
- CHILD_REQUIRE(sigaddset(&sigmask, SIGUSR1) == 0);
- CHILD_REQUIRE(sigprocmask(SIG_BLOCK, &sigmask, NULL) == 0);
+ CHILD_REQUIRE_EQ_INT(sigemptyset(&sigmask), 0);
+ CHILD_REQUIRE_EQ_INT(sigaddset(&sigmask, SIGUSR1), 0);
+ CHILD_REQUIRE_EQ_INT(sigprocmask(SIG_BLOCK, &sigmask, NULL), 0);
trace_me();
- CHILD_REQUIRE(got_usr1 == 0);
+ CHILD_REQUIRE_EQ_INT(got_usr1, 0);
/* Allow the pending SIGUSR1 in now. */
- CHILD_REQUIRE(sigprocmask(SIG_UNBLOCK, &sigmask, NULL) == 0);
+ CHILD_REQUIRE_EQ_INT(sigprocmask(SIG_UNBLOCK, &sigmask, NULL),
+ 0);
/* Wait to receive a SIGUSR1. */
do {
err = sem_wait(&sigusr1_sem);
CHILD_REQUIRE(err == 0 || errno == EINTR);
} while (err != 0 && errno == EINTR);
- CHILD_REQUIRE(got_usr1 == 1);
+ CHILD_REQUIRE_EQ_INT(got_usr1, 1);
exit(1);
}
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_LWPINFO, fpid, (caddr_t)&pl, sizeof(pl)) != -1);
- ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGSTOP);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_signo, SIGSTOP);
/* Continue the child replacing SIGSTOP with SIGUSR1. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1), 0);
/* The next wait() should report the SIGUSR1 was received. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGUSR1);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGUSR1);
ATF_REQUIRE(ptrace(PT_LWPINFO, fpid, (caddr_t)&pl, sizeof(pl)) != -1);
- ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGUSR1);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_signo, SIGUSR1);
/* Continue the child, ignoring the SIGUSR1. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The last wait() should report normal exit with code 1. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -3084,18 +3119,21 @@
sigset_t sigmask;
pthread_barrier_t barrier;
- ATF_REQUIRE(pthread_barrier_init(&barrier, NULL, 2) == 0);
- ATF_REQUIRE(sem_init(&sigusr1_sem, 0, 0) == 0);
+ REQUIRE_EQ_INT(pthread_barrier_init(&barrier, NULL, 2), 0);
+ REQUIRE_EQ_INT(sem_init(&sigusr1_sem, 0, 0), 0);
ATF_REQUIRE(signal(SIGUSR1, sigusr1_sempost_handler) != SIG_ERR);
ATF_REQUIRE((fpid = fork()) != -1);
if (fpid == 0) {
- CHILD_REQUIRE(pthread_create(&t, NULL, signal_thread, (void*)&barrier) == 0);
+ CHILD_REQUIRE_EQ_INT(pthread_create(&t, NULL, signal_thread,
+ (void *)&barrier),
+ 0);
/* The other thread should receive the first SIGUSR1. */
- CHILD_REQUIRE(sigemptyset(&sigmask) == 0);
- CHILD_REQUIRE(sigaddset(&sigmask, SIGUSR1) == 0);
- CHILD_REQUIRE(pthread_sigmask(SIG_BLOCK, &sigmask, NULL) == 0);
+ CHILD_REQUIRE_EQ_INT(sigemptyset(&sigmask), 0);
+ CHILD_REQUIRE_EQ_INT(sigaddset(&sigmask, SIGUSR1), 0);
+ CHILD_REQUIRE_EQ_INT(pthread_sigmask(SIG_BLOCK, &sigmask, NULL),
+ 0);
trace_me();
@@ -3106,7 +3144,9 @@
* Swap ignore duties; the next SIGUSR1 should go to this
* thread.
*/
- CHILD_REQUIRE(pthread_sigmask(SIG_UNBLOCK, &sigmask, NULL) == 0);
+ CHILD_REQUIRE_EQ_INT(pthread_sigmask(SIG_UNBLOCK, &sigmask,
+ NULL),
+ 0);
/* Sync up threads after swapping signal masks. */
pthread_barrier_wait(&barrier);
@@ -3126,64 +3166,64 @@
/* Free the other thread from the barrier. */
pthread_barrier_wait(&barrier);
- CHILD_REQUIRE(pthread_join(t, NULL) == 0);
+ CHILD_REQUIRE_EQ_INT(pthread_join(t, NULL), 0);
exit(1);
}
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
/* Continue the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/*
* Send a signal without ptrace that either thread will accept (USR2,
* in this case).
*/
- ATF_REQUIRE(kill(fpid, SIGUSR2) == 0);
-
+ REQUIRE_EQ_INT(kill(fpid, SIGUSR2), 0);
+
/* The second wait() should report a SIGUSR2 was received. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGUSR2);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGUSR2);
/* Continue the child, changing the signal to USR1. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1), 0);
/* The next wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
/* Continue the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
- ATF_REQUIRE(kill(fpid, SIGUSR2) == 0);
+ REQUIRE_EQ_INT(kill(fpid, SIGUSR2), 0);
/* The next wait() should report a SIGUSR2 was received. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGUSR2);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGUSR2);
/* Continue the child, changing the signal to USR1. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1), 0);
/* The last wait() should report normal exit with code 1. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
static void *
@@ -3215,7 +3255,7 @@
* Become the reaper for this process tree. We need to be able to check
* that both child and grandchild have died.
*/
- ATF_REQUIRE(procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL) == 0);
+ REQUIRE_EQ_INT(procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL), 0);
fpid = fork();
ATF_REQUIRE(fpid >= 0);
@@ -3228,7 +3268,7 @@
/* Pin to CPU 0 to serialize thread execution. */
CPU_ZERO(&setmask);
CPU_SET(0, &setmask);
- CHILD_REQUIRE(cpuset(&setid) == 0);
+ CHILD_REQUIRE_EQ_INT(cpuset(&setid), 0);
CHILD_REQUIRE(cpuset_setaffinity(CPU_LEVEL_CPUSET,
CPU_WHICH_CPUSET, setid,
sizeof(setmask), &setmask) == 0);
@@ -3259,17 +3299,18 @@
}
/* First stop is trace_me() immediately after fork. */
wpid = waitpid(fpid, &status, 0);
- CHILD_REQUIRE(wpid == fpid);
+ CHILD_REQUIRE_EQ_INT(wpid, fpid);
CHILD_REQUIRE(WIFSTOPPED(status));
- CHILD_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ CHILD_REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
- CHILD_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ CHILD_REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0),
+ 0);
/* Second stop is from the raise(SIGSTOP). */
wpid = waitpid(fpid, &status, 0);
- CHILD_REQUIRE(wpid == fpid);
+ CHILD_REQUIRE_EQ_INT(wpid, fpid);
CHILD_REQUIRE(WIFSTOPPED(status));
- CHILD_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ CHILD_REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
/*
* Terminate tracing process without detaching. Our child
@@ -3286,12 +3327,13 @@
*/
for (i = 0; i < 2; ++i) {
wpid = wait(&status);
- if (wpid == fpid)
- ATF_REQUIRE(WIFEXITED(status) &&
- WEXITSTATUS(status) == 0);
- else
- ATF_REQUIRE(WIFSIGNALED(status) &&
- WTERMSIG(status) == SIGKILL);
+ if (wpid == fpid) {
+ ATF_REQUIRE(WIFEXITED(status));
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 0);
+ } else {
+ ATF_REQUIRE(WIFSIGNALED(status));
+ REQUIRE_EQ_INT(WTERMSIG(status), SIGKILL);
+ }
}
}
@@ -3350,9 +3392,9 @@
/* The first wait() should report the stop from trace_me(). */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
/* Set several unobtrusive event bits. */
event_mask = PTRACE_EXEC | PTRACE_FORK | PTRACE_LWP;
@@ -3360,47 +3402,47 @@
sizeof(event_mask)) == 0);
/* Send a SIGKILL without using ptrace. */
- ATF_REQUIRE(kill(fpid, SIGKILL) == 0);
+ REQUIRE_EQ_INT(kill(fpid, SIGKILL), 0);
/* Continue the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The next stop should be due to the SIGKILL. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGKILL);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGKILL);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SI);
- ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGKILL);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_signo, SIGKILL);
/* Continue the child ignoring the SIGKILL. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The next wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
/* Check the current event mask. It should not have changed. */
new_event_mask = 0;
ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, wpid, (caddr_t)&new_event_mask,
sizeof(new_event_mask)) == 0);
- ATF_REQUIRE(event_mask == new_event_mask);
+ REQUIRE_EQ_INT(event_mask, new_event_mask);
/* Continue the child to let it exit. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The last event should be for the child process's exit. */
wpid = waitpid(fpid, &status, 0);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 0);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 0);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
static void *
@@ -3428,10 +3470,10 @@
pid_t child, wpid;
int error, fd, i, status;
- ATF_REQUIRE(pthread_barrierattr_init(&battr) == 0);
+ REQUIRE_EQ_INT(pthread_barrierattr_init(&battr), 0);
ATF_REQUIRE(pthread_barrierattr_setpshared(&battr,
PTHREAD_PROCESS_SHARED) == 0);
- ATF_REQUIRE(pthread_barrier_init(&barrier, &battr, 2) == 0);
+ REQUIRE_EQ_INT(pthread_barrier_init(&barrier, &battr, 2), 0);
(void)snprintf(tmpfile, sizeof(tmpfile), "./ptrace.XXXXXX");
fd = mkstemp(tmpfile);
@@ -3466,7 +3508,7 @@
_exit(0);
}
- ATF_REQUIRE(flock(fd, LOCK_EX) == 0);
+ REQUIRE_EQ_INT(flock(fd, LOCK_EX), 0);
error = pthread_barrier_wait(&barrier);
ATF_REQUIRE(error == 0 || error == PTHREAD_BARRIER_SERIAL_THREAD);
@@ -3479,7 +3521,7 @@
/*
* Attach and give the child 3 seconds to stop.
*/
- ATF_REQUIRE(ptrace(PT_ATTACH, child, NULL, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_ATTACH, child, NULL, 0), 0);
for (i = 0; i < 3; i++) {
wpid = waitpid(child, &status, WNOHANG);
if (wpid == child && WIFSTOPPED(status) &&
@@ -3489,18 +3531,18 @@
}
ATF_REQUIRE_MSG(i < 3, "failed to stop child process after PT_ATTACH");
- ATF_REQUIRE(ptrace(PT_DETACH, child, NULL, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_DETACH, child, NULL, 0), 0);
- ATF_REQUIRE(flock(fd, LOCK_UN) == 0);
- ATF_REQUIRE(unlink(tmpfile) == 0);
- ATF_REQUIRE(close(fd) == 0);
+ REQUIRE_EQ_INT(flock(fd, LOCK_UN), 0);
+ REQUIRE_EQ_INT(unlink(tmpfile), 0);
+ REQUIRE_EQ_INT(close(fd), 0);
}
static void
sigusr1_step_handler(int sig)
{
- CHILD_REQUIRE(sig == SIGUSR1);
+ CHILD_REQUIRE_EQ_INT(sig, SIGUSR1);
raise(SIGABRT);
}
@@ -3526,60 +3568,60 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The next stop should report the SIGABRT in the child body. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGABRT);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGABRT);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SI);
- ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGABRT);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_signo, SIGABRT);
/* Step the child process inserting SIGUSR1. */
- ATF_REQUIRE(ptrace(PT_STEP, fpid, (caddr_t)1, SIGUSR1) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_STEP, fpid, (caddr_t)1, SIGUSR1), 0);
/* The next stop should report the SIGABRT in the signal handler. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGABRT);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGABRT);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SI);
- ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGABRT);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_signo, SIGABRT);
/* Continue the child process discarding the signal. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The next stop should report a trace trap from PT_STEP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SI);
- ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGTRAP);
- ATF_REQUIRE(pl.pl_siginfo.si_code == TRAP_TRACE);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_signo, SIGTRAP);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_code, TRAP_TRACE);
/* Continue the child to let it exit. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The last event should be for the child process's exit. */
wpid = waitpid(fpid, &status, 0);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
#ifdef HAVE_BREAKPOINT
@@ -3603,36 +3645,36 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
/* Continue the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The second wait() should report hitting the breakpoint. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE((pl.pl_flags & PL_FLAG_SI) != 0);
- ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGTRAP);
- ATF_REQUIRE(pl.pl_siginfo.si_code == TRAP_BRKPT);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_signo, SIGTRAP);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_code, TRAP_BRKPT);
/* Kill the child process. */
- ATF_REQUIRE(ptrace(PT_KILL, fpid, 0, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_KILL, fpid, 0, 0), 0);
/* The last wait() should report the SIGKILL. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSIGNALED(status));
- ATF_REQUIRE(WTERMSIG(status) == SIGKILL);
+ REQUIRE_EQ_INT(WTERMSIG(status), SIGKILL);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
#endif /* HAVE_BREAKPOINT */
@@ -3655,35 +3697,35 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
/* Step the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_STEP, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_STEP, fpid, (caddr_t)1, 0), 0);
/* The second wait() should report a single-step trap. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE((pl.pl_flags & PL_FLAG_SI) != 0);
- ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGTRAP);
- ATF_REQUIRE(pl.pl_siginfo.si_code == TRAP_TRACE);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_signo, SIGTRAP);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_code, TRAP_TRACE);
/* Continue the child process. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The last event should be for the child process's exit. */
wpid = waitpid(fpid, &status, 0);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
#if defined(HAVE_BREAKPOINT) && defined(SKIP_BREAK)
@@ -3703,8 +3745,8 @@
NULL) == 0);
CHILD_REQUIRE(pthread_create(&threads[1], NULL, continue_thread,
NULL) == 0);
- CHILD_REQUIRE(pthread_join(threads[0], NULL) == 0);
- CHILD_REQUIRE(pthread_join(threads[1], NULL) == 0);
+ CHILD_REQUIRE_EQ_INT(pthread_join(threads[0], NULL), 0);
+ CHILD_REQUIRE_EQ_INT(pthread_join(threads[1], NULL), 0);
exit(1);
}
@@ -3731,26 +3773,26 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl,
sizeof(pl)) != -1);
- ATF_REQUIRE(ptrace(PT_LWP_EVENTS, wpid, NULL, 1) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_LWP_EVENTS, wpid, NULL, 1), 0);
/* Continue the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* One of the new threads should report it's birth. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
- ATF_REQUIRE((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)) ==
+ REQUIRE_EQ_INT((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)),
(PL_FLAG_BORN | PL_FLAG_SCX));
lwps[0] = pl.pl_lwpid;
@@ -3760,16 +3802,16 @@
*/
ATF_REQUIRE(ptrace(PT_SUSPEND, lwps[0], NULL, 0) != -1);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* Second thread should report it's birth. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
- ATF_REQUIRE((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)) ==
+ REQUIRE_EQ_INT((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)),
(PL_FLAG_BORN | PL_FLAG_SCX));
ATF_REQUIRE(pl.pl_lwpid != lwps[0]);
lwps[1] = pl.pl_lwpid;
@@ -3777,18 +3819,18 @@
/* Resume both threads waiting for breakpoint events. */
hit_break[0] = hit_break[1] = false;
ATF_REQUIRE(ptrace(PT_RESUME, lwps[0], NULL, 0) != -1);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* One thread should report a breakpoint. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE((pl.pl_flags & PL_FLAG_SI) != 0);
- ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGTRAP &&
- pl.pl_siginfo.si_code == TRAP_BRKPT);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_signo, SIGTRAP);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_code, TRAP_BRKPT);
if (pl.pl_lwpid == lwps[0])
i = 0;
else
@@ -3802,7 +3844,7 @@
* Resume both threads but pass the other thread's LWPID to
* PT_CONTINUE.
*/
- ATF_REQUIRE(ptrace(PT_CONTINUE, lwps[i ^ 1], (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, lwps[i ^ 1], (caddr_t)1, 0), 0);
/*
* Will now get two thread exit events and one more breakpoint
@@ -3810,9 +3852,9 @@
*/
for (j = 0; j < 3; j++) {
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl,
sizeof(pl)) != -1);
@@ -3829,8 +3871,8 @@
lwps[i] = 0;
} else {
ATF_REQUIRE((pl.pl_flags & PL_FLAG_SI) != 0);
- ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGTRAP &&
- pl.pl_siginfo.si_code == TRAP_BRKPT);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_signo, SIGTRAP);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_code, TRAP_BRKPT);
ATF_REQUIRE_MSG(!hit_break[i],
"double breakpoint event");
hit_break[i] = true;
@@ -3841,21 +3883,21 @@
0) != -1);
}
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
}
/* Both threads should have exited. */
- ATF_REQUIRE(lwps[0] == 0);
- ATF_REQUIRE(lwps[1] == 0);
+ REQUIRE_EQ_INT(lwps[0], 0);
+ REQUIRE_EQ_INT(lwps[1], 0);
/* The last event should be for the child process's exit. */
wpid = waitpid(fpid, &status, 0);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
#endif
@@ -3878,40 +3920,40 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The next stop should report the SIGABRT in the child body. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGABRT);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGABRT);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SI);
- ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGABRT);
+ REQUIRE_EQ_INT(pl.pl_siginfo.si_signo, SIGABRT);
/*
* Continue the process ignoring the signal, but enabling
* syscall traps.
*/
- ATF_REQUIRE(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0), 0);
/*
* The next stop should report a system call entry from
* exit(). PL_FLAGS_SI should not be set.
*/
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCE);
- ATF_REQUIRE((pl.pl_flags & PL_FLAG_SI) == 0);
+ REQUIRE_EQ_INT((pl.pl_flags & PL_FLAG_SI), 0);
/* Disable syscall tracing and continue the child to let it exit. */
ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, fpid, (caddr_t)&events,
@@ -3919,16 +3961,16 @@
events &= ~PTRACE_SYSCALL;
ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, fpid, (caddr_t)&events,
sizeof(events)) == 0);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The last event should be for the child process's exit. */
wpid = waitpid(fpid, &status, 0);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -3953,121 +3995,121 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
/*
* Continue the process ignoring the signal, but enabling
* syscall traps.
*/
- ATF_REQUIRE(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0), 0);
/*
* The next stop should be the syscall entry from getpid().
*/
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCE);
- ATF_REQUIRE(pl.pl_syscall_code == SYS_getpid);
+ REQUIRE_EQ_INT(pl.pl_syscall_code, SYS_getpid);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/*
* The next stop should be the syscall exit from getpid().
*/
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCX);
- ATF_REQUIRE(pl.pl_syscall_code == SYS_getpid);
+ REQUIRE_EQ_INT(pl.pl_syscall_code, SYS_getpid);
ATF_REQUIRE(ptrace(PT_GET_SC_RET, wpid, (caddr_t)&psr,
sizeof(psr)) != -1);
- ATF_REQUIRE(psr.sr_error == 0);
- ATF_REQUIRE(psr.sr_retval[0] == wpid);
+ REQUIRE_EQ_INT(psr.sr_error, 0);
+ REQUIRE_EQ_INT(psr.sr_retval[0], wpid);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/*
* The next stop should be the syscall entry from kill().
*/
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCE);
- ATF_REQUIRE(pl.pl_syscall_code == SYS_kill);
- ATF_REQUIRE(pl.pl_syscall_narg == 2);
+ REQUIRE_EQ_INT(pl.pl_syscall_code, SYS_kill);
+ REQUIRE_EQ_INT(pl.pl_syscall_narg, 2);
ATF_REQUIRE(ptrace(PT_GET_SC_ARGS, wpid, (caddr_t)args,
sizeof(args)) != -1);
- ATF_REQUIRE(args[0] == wpid);
- ATF_REQUIRE(args[1] == 0);
+ REQUIRE_EQ_INT(args[0], wpid);
+ REQUIRE_EQ_INT(args[1], 0);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/*
* The next stop should be the syscall exit from kill().
*/
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCX);
- ATF_REQUIRE(pl.pl_syscall_code == SYS_kill);
+ REQUIRE_EQ_INT(pl.pl_syscall_code, SYS_kill);
ATF_REQUIRE(ptrace(PT_GET_SC_RET, wpid, (caddr_t)&psr,
sizeof(psr)) != -1);
- ATF_REQUIRE(psr.sr_error == 0);
+ REQUIRE_EQ_INT(psr.sr_error, 0);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/*
* The next stop should be the syscall entry from close().
*/
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCE);
- ATF_REQUIRE(pl.pl_syscall_code == SYS_close);
- ATF_REQUIRE(pl.pl_syscall_narg == 1);
+ REQUIRE_EQ_INT(pl.pl_syscall_code, SYS_close);
+ REQUIRE_EQ_INT(pl.pl_syscall_narg, 1);
ATF_REQUIRE(ptrace(PT_GET_SC_ARGS, wpid, (caddr_t)args,
sizeof(args)) != -1);
- ATF_REQUIRE(args[0] == 3);
+ REQUIRE_EQ_INT(args[0], 3);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/*
* The next stop should be the syscall exit from close().
*/
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ_INT(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCX);
- ATF_REQUIRE(pl.pl_syscall_code == SYS_close);
+ REQUIRE_EQ_INT(pl.pl_syscall_code, SYS_close);
ATF_REQUIRE(ptrace(PT_GET_SC_RET, wpid, (caddr_t)&psr,
sizeof(psr)) != -1);
- ATF_REQUIRE(psr.sr_error == EBADF);
+ REQUIRE_EQ_INT(psr.sr_error, EBADF);
/* Disable syscall tracing and continue the child to let it exit. */
ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, fpid, (caddr_t)&events,
@@ -4075,16 +4117,16 @@
events &= ~PTRACE_SYSCALL;
ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, fpid, (caddr_t)&events,
sizeof(events)) == 0);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* The last event should be for the child process's exit. */
wpid = waitpid(fpid, &status, 0);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -4114,31 +4156,31 @@
ATF_REQUIRE(debuger >= 0);
if (debuger == 0) {
/* The traced process is reparented to debuger. */
- ATF_REQUIRE(ptrace(PT_ATTACH, traced, 0, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_ATTACH, traced, 0, 0), 0);
wpid = waitpid(traced, &status, 0);
- ATF_REQUIRE(wpid == traced);
+ REQUIRE_EQ_INT(wpid, traced);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
- ATF_REQUIRE(close(pd) == 0);
- ATF_REQUIRE(ptrace(PT_DETACH, traced, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
+ REQUIRE_EQ_INT(close(pd), 0);
+ REQUIRE_EQ_INT(ptrace(PT_DETACH, traced, (caddr_t)1, 0), 0);
/* We closed pd so we should not have any child. */
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
exit(0);
}
- ATF_REQUIRE(close(pd) == 0);
+ REQUIRE_EQ_INT(close(pd), 0);
wpid = waitpid(debuger, &status, 0);
- ATF_REQUIRE(wpid == debuger);
- ATF_REQUIRE(WEXITSTATUS(status) == 0);
+ REQUIRE_EQ_INT(wpid, debuger);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 0);
/* Check if we still have any child. */
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
}
/*
@@ -4161,16 +4203,16 @@
}
wpid = waitpid(child, &status, 0);
- ATF_REQUIRE(wpid == child);
+ REQUIRE_EQ_INT(wpid, child);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_CONTINUE, child, (caddr_t)1, 0) != -1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == child);
+ REQUIRE_EQ_INT(wpid, child);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_CONTINUE, child, (caddr_t)1, 0) != -1);
@@ -4179,8 +4221,8 @@
* be collected through process descriptor.
*/
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
ATF_REQUIRE(close(pd) != -1);
}
@@ -4210,37 +4252,37 @@
ATF_REQUIRE(debuger >= 0);
if (debuger == 0) {
/* The traced process is reparented to debuger. */
- ATF_REQUIRE(ptrace(PT_ATTACH, traced, 0, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_ATTACH, traced, 0, 0), 0);
wpid = waitpid(traced, &status, 0);
- ATF_REQUIRE(wpid == traced);
+ REQUIRE_EQ_INT(wpid, traced);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP);
/* Allow process to die. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, traced, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ_INT(ptrace(PT_CONTINUE, traced, (caddr_t)1, 0), 0);
wpid = waitpid(traced, &status, 0);
- ATF_REQUIRE(wpid == traced);
+ REQUIRE_EQ_INT(wpid, traced);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 0);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 0);
/* Reparent back to the orginal process. */
- ATF_REQUIRE(close(pd) == 0);
+ REQUIRE_EQ_INT(close(pd), 0);
exit(0);
}
wpid = waitpid(debuger, &status, 0);
- ATF_REQUIRE(wpid == debuger);
- ATF_REQUIRE(WEXITSTATUS(status) == 0);
+ REQUIRE_EQ_INT(wpid, debuger);
+ REQUIRE_EQ_INT(WEXITSTATUS(status), 0);
/*
* We have a child but it has a process descriptori
* so we should not be able to collect it process.
*/
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ_INT(wpid, -1);
+ REQUIRE_EQ_INT(errno, ECHILD);
- ATF_REQUIRE(close(pd) == 0);
+ REQUIRE_EQ_INT(close(pd), 0);
}
ATF_TP_ADD_TCS(tp)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 26, 12:52 AM (2 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27985320
Default Alt Text
D28887.id84561.diff (114 KB)
Attached To
Mode
D28887: ptrace_test: Add more debug output on test failures
Attached
Detach File
Event Timeline
Log In to Comment