Page MenuHomeFreeBSD

D28887.id84712.diff
No OneTemporary

D28887.id84712.diff

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,45 @@
* 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(actual, expected) do { \
+ __typeof__(expected) _e = expected; \
+ __typeof__(actual) _a = actual; \
+ if (_e != _a) \
+ child_fail_require(__FILE__, __LINE__, #actual \
+ " (%jd) == " #expected " (%jd) not met\n", \
+ (intmax_t)_a, (intmax_t)_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;
+ char buf[1024];
+
+ /* Use write() not fprintf() to avoid possible duplicate output. */
+ snprintf(buf, sizeof(buf), "%s:%d: ", file, line);
+ write(STDERR_FILENO, buf, strlen(buf));
+ va_start(ap, fmt);
+ vsnprintf(buf, sizeof(buf), fmt, ap);
+ write(STDERR_FILENO, buf, strlen(buf));
+ va_end(ap);
- snprintf(buf, sizeof(buf), "%s:%d: %s\n", file, line, str);
- write(2, buf, strlen(buf));
_exit(32);
}
+#define REQUIRE_EQ(actual, expected) do { \
+ __typeof__(expected) _e = expected; \
+ __typeof__(actual) _a = actual; \
+ ATF_REQUIRE_MSG(_e == _a, #actual " (%jd) == " \
+ #expected " (%jd) not met", (intmax_t)_a, (intmax_t)_e); \
+} while (0)
+
static void
trace_me(void)
{
@@ -121,12 +145,12 @@
pid_t wpid;
int status;
- ATF_REQUIRE(ptrace(PT_ATTACH, pid, NULL, 0) == 0);
+ REQUIRE_EQ(ptrace(PT_ATTACH, pid, NULL, 0), 0);
wpid = waitpid(pid, &status, 0);
- ATF_REQUIRE(wpid == pid);
+ REQUIRE_EQ(wpid, pid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
}
static void
@@ -152,7 +176,7 @@
mib[3] = pid;
len = sizeof(kp);
if (sysctl(mib, nitems(mib), &kp, &len, NULL, 0) == -1) {
- ATF_REQUIRE(errno == ESRCH);
+ REQUIRE_EQ(errno, ESRCH);
break;
}
if (kp.ki_stat == SZOMB)
@@ -183,23 +207,23 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(child, &status, 0);
- ATF_REQUIRE(wpid == child);
+ REQUIRE_EQ(wpid, child);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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(wpid, child);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ(WEXITSTATUS(status), 1);
/* The child should no longer exist. */
wpid = waitpid(child, &status, 0);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -216,14 +240,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(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(0, read(cpipe[1], &c, sizeof(c)));
_exit(1);
}
@@ -242,14 +266,14 @@
/* The second wait() should report the exit status. */
wpid = waitpid(child, &status, 0);
- ATF_REQUIRE(wpid == child);
+ REQUIRE_EQ(wpid, child);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ(WEXITSTATUS(status), 1);
/* The child should no longer exist. */
wpid = waitpid(child, &status, 0);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -266,7 +290,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(pipe(cpipe), 0);
ATF_REQUIRE((child = fork()) != -1);
if (child == 0) {
@@ -274,13 +298,13 @@
close(cpipe[0]);
/* Wait for parent to be ready. */
- CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == sizeof(c));
+ CHILD_REQUIRE_EQ(read(cpipe[1], &c, sizeof(c)), sizeof(c));
_exit(1);
}
close(cpipe[1]);
- ATF_REQUIRE(pipe(dpipe) == 0);
+ REQUIRE_EQ(pipe(dpipe), 0);
ATF_REQUIRE((debugger = fork()) != -1);
if (debugger == 0) {
@@ -290,22 +314,22 @@
CHILD_REQUIRE(ptrace(PT_ATTACH, child, NULL, 0) != -1);
wpid = waitpid(child, &status, 0);
- CHILD_REQUIRE(wpid == child);
+ CHILD_REQUIRE_EQ(wpid, child);
CHILD_REQUIRE(WIFSTOPPED(status));
- CHILD_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ CHILD_REQUIRE_EQ(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(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(read(dpipe[1], &c, sizeof(c)), 0);
wpid = waitpid(child, &status, 0);
- CHILD_REQUIRE(wpid == child);
+ CHILD_REQUIRE_EQ(wpid, child);
CHILD_REQUIRE(WIFEXITED(status));
- CHILD_REQUIRE(WEXITSTATUS(status) == 1);
+ CHILD_REQUIRE_EQ(WEXITSTATUS(status), 1);
_exit(0);
}
@@ -314,11 +338,11 @@
/* Parent process. */
/* Wait for the debugger to attach to the child. */
- ATF_REQUIRE(read(dpipe[0], &c, sizeof(c)) == sizeof(c));
+ REQUIRE_EQ(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(write(cpipe[0], &c, sizeof(c)), sizeof(c));
+ REQUIRE_EQ(read(cpipe[0], &c, sizeof(c)), 0);
close(cpipe[0]);
wait_for_zombie(child);
@@ -329,22 +353,22 @@
* until the debugger sees the exit.
*/
wpid = waitpid(child, &status, WNOHANG);
- ATF_REQUIRE(wpid == 0);
+ REQUIRE_EQ(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(wpid, debugger);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 0);
+ REQUIRE_EQ(WEXITSTATUS(status), 0);
/* The child process should now be ready. */
wpid = waitpid(child, &status, WNOHANG);
- ATF_REQUIRE(wpid == child);
+ REQUIRE_EQ(wpid, child);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ(WEXITSTATUS(status), 1);
}
/*
@@ -360,7 +384,7 @@
int cpipe[2], dpipe[2], status;
char c;
- ATF_REQUIRE(pipe(cpipe) == 0);
+ REQUIRE_EQ(pipe(cpipe), 0);
ATF_REQUIRE((child = fork()) != -1);
if (child == 0) {
@@ -368,13 +392,13 @@
close(cpipe[0]);
/* Wait for parent to be ready. */
- CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == sizeof(c));
+ CHILD_REQUIRE_EQ(read(cpipe[1], &c, sizeof(c)), sizeof(c));
_exit(1);
}
close(cpipe[1]);
- ATF_REQUIRE(pipe(dpipe) == 0);
+ REQUIRE_EQ(pipe(dpipe), 0);
ATF_REQUIRE((debugger = fork()) != -1);
if (debugger == 0) {
@@ -394,22 +418,22 @@
CHILD_REQUIRE(ptrace(PT_ATTACH, child, NULL, 0) != -1);
wpid = waitpid(child, &status, 0);
- CHILD_REQUIRE(wpid == child);
+ CHILD_REQUIRE_EQ(wpid, child);
CHILD_REQUIRE(WIFSTOPPED(status));
- CHILD_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ CHILD_REQUIRE_EQ(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(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(read(dpipe[1], &c, sizeof(c)), sizeof(c));
wpid = waitpid(child, &status, 0);
- CHILD_REQUIRE(wpid == child);
+ CHILD_REQUIRE_EQ(wpid, child);
CHILD_REQUIRE(WIFEXITED(status));
- CHILD_REQUIRE(WEXITSTATUS(status) == 1);
+ CHILD_REQUIRE_EQ(WEXITSTATUS(status), 1);
_exit(0);
}
@@ -419,20 +443,20 @@
/* Wait for the debugger parent process to exit. */
wpid = waitpid(debugger, &status, 0);
- ATF_REQUIRE(wpid == debugger);
+ REQUIRE_EQ(wpid, debugger);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ(WEXITSTATUS(status), 2);
/* A WNOHANG wait here should see the non-exited child. */
wpid = waitpid(child, &status, WNOHANG);
- ATF_REQUIRE(wpid == 0);
+ REQUIRE_EQ(wpid, 0);
/* Wait for the debugger to attach to the child. */
- ATF_REQUIRE(read(dpipe[0], &c, sizeof(c)) == sizeof(c));
+ REQUIRE_EQ(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(write(cpipe[0], &c, sizeof(c)), sizeof(c));
+ REQUIRE_EQ(read(cpipe[0], &c, sizeof(c)), 0);
close(cpipe[0]);
wait_for_zombie(child);
@@ -443,20 +467,20 @@
* until the debugger sees the exit.
*/
wpid = waitpid(child, &status, WNOHANG);
- ATF_REQUIRE(wpid == 0);
+ REQUIRE_EQ(wpid, 0);
/* Signal the debugger to wait for the child. */
- ATF_REQUIRE(write(dpipe[0], &c, sizeof(c)) == sizeof(c));
+ REQUIRE_EQ(write(dpipe[0], &c, sizeof(c)), sizeof(c));
/* Wait for the debugger. */
- ATF_REQUIRE(read(dpipe[0], &c, sizeof(c)) == 0);
+ REQUIRE_EQ(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(wpid, child);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ(WEXITSTATUS(status), 1);
}
/*
@@ -472,11 +496,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(pipe(cpipe1), 0);
+ REQUIRE_EQ(pipe(cpipe2), 0);
+ REQUIRE_EQ(pipe(gcpipe), 0);
- ATF_REQUIRE(procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL) == 0);
+ REQUIRE_EQ(procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL), 0);
ATF_REQUIRE((child = fork()) != -1);
if (child == 0) {
@@ -496,31 +520,31 @@
_exit(status);
}
- ATF_REQUIRE(read(cpipe1[0], &gchild, sizeof(gchild)) == sizeof(gchild));
+ REQUIRE_EQ(read(cpipe1[0], &gchild, sizeof(gchild)), sizeof(gchild));
- ATF_REQUIRE(ptrace(PT_ATTACH, gchild, NULL, 0) == 0);
+ REQUIRE_EQ(ptrace(PT_ATTACH, gchild, NULL, 0), 0);
status = 0;
- ATF_REQUIRE(write(cpipe2[1], &status, sizeof(status)) ==
- sizeof(status));
- ATF_REQUIRE(waitpid(child, &status, 0) == child);
- ATF_REQUIRE(WIFEXITED(status) && WEXITSTATUS(status) == 0);
+ REQUIRE_EQ(write(cpipe2[1], &status, sizeof(status)), sizeof(status));
+ REQUIRE_EQ(waitpid(child, &status, 0), child);
+ ATF_REQUIRE(WIFEXITED(status));
+ REQUIRE_EQ(WEXITSTATUS(status), 0);
status = 0;
- ATF_REQUIRE(write(gcpipe[1], &status, sizeof(status)) ==
- sizeof(status));
- ATF_REQUIRE(waitpid(gchild, &status, 0) == gchild);
+ REQUIRE_EQ(write(gcpipe[1], &status, sizeof(status)), sizeof(status));
+ REQUIRE_EQ(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(ptrace(PT_DETACH, gchild, (caddr_t)1, 0), 0);
+ REQUIRE_EQ(waitpid(gchild, &status, 0), gchild);
+ ATF_REQUIRE(WIFEXITED(status));
+ REQUIRE_EQ(WEXITSTATUS(status), 0);
+
+ REQUIRE_EQ(close(cpipe1[0]), 0);
+ REQUIRE_EQ(close(cpipe1[1]), 0);
+ REQUIRE_EQ(close(cpipe2[0]), 0);
+ REQUIRE_EQ(close(cpipe2[1]), 0);
+ REQUIRE_EQ(close(gcpipe[0]), 0);
+ REQUIRE_EQ(close(gcpipe[1]), 0);
}
/*
@@ -543,9 +567,9 @@
_exit(2);
wpid = waitpid(fpid, &status, 0);
- CHILD_REQUIRE(wpid == fpid);
+ CHILD_REQUIRE_EQ(wpid, fpid);
CHILD_REQUIRE(WIFEXITED(status));
- CHILD_REQUIRE(WEXITSTATUS(status) == 2);
+ CHILD_REQUIRE_EQ(WEXITSTATUS(status), 2);
_exit(1);
}
@@ -585,23 +609,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(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(!fork_reported[1]);
if (child == -1)
child = wpid;
else
- ATF_REQUIRE(child == wpid);
+ REQUIRE_EQ(child, wpid);
if (ppl != NULL)
ppl[1] = pl;
fork_reported[1] = true;
} else {
- ATF_REQUIRE(wpid == parent);
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(wpid, parent);
+ REQUIRE_EQ(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(child, pl.pl_child_pid);
if (ppl != NULL)
ppl[0] = pl;
fork_reported[0] = true;
@@ -633,9 +657,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(children[0], &status, 0);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ(wpid, children[0]);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, children[0], NULL, 1) != -1);
@@ -653,18 +677,18 @@
* grandchild should report its exit first to the debugger.
*/
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[1]);
+ REQUIRE_EQ(wpid, children[1]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ(WEXITSTATUS(status), 2);
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ(wpid, children[0]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -689,9 +713,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(children[0], &status, 0);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ(wpid, children[0]);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, children[0], NULL, 1) != -1);
@@ -709,13 +733,13 @@
* child.
*/
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ(wpid, children[0]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -740,9 +764,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(children[0], &status, 0);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ(wpid, children[0]);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, children[0], NULL, 1) != -1);
@@ -764,18 +788,18 @@
* after the grandchild.
*/
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[1]);
+ REQUIRE_EQ(wpid, children[1]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ(WEXITSTATUS(status), 2);
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ(wpid, children[0]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
static void
@@ -792,10 +816,10 @@
/* 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(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(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(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(wpid, fpid);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 3);
+ REQUIRE_EQ(WEXITSTATUS(status), 3);
/* Read the pid of the fork parent. */
- ATF_REQUIRE(read(cpipe[0], &children[0], sizeof(children[0])) ==
+ REQUIRE_EQ(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(wpid, children[1]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ(WEXITSTATUS(status), 2);
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ(wpid, children[0]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(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(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(wpid, fpid);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 3);
+ REQUIRE_EQ(WEXITSTATUS(status), 3);
/* Read the pid of the fork parent. */
- ATF_REQUIRE(read(cpipe[0], &children[0], sizeof(children[0])) ==
+ REQUIRE_EQ(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(wpid, children[0]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(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(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(wpid, fpid);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 3);
+ REQUIRE_EQ(WEXITSTATUS(status), 3);
/* Read the pid of the fork parent. */
- ATF_REQUIRE(read(cpipe[0], &children[0], sizeof(children[0])) ==
+ REQUIRE_EQ(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(wpid, children[1]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ(WEXITSTATUS(status), 2);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(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(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(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(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(wpid, child);
CHILD_REQUIRE(WIFSTOPPED(status));
- CHILD_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ CHILD_REQUIRE_EQ(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(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(wpid, child);
CHILD_REQUIRE(WIFEXITED(status));
- CHILD_REQUIRE(WEXITSTATUS(status) == 1);
+ CHILD_REQUIRE_EQ(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(read(dpipe[0], &c, sizeof(c)), sizeof(c));
/* Release the child. */
- ATF_REQUIRE(write(cpipe[0], &c, sizeof(c)) == sizeof(c));
+ REQUIRE_EQ(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(read(cpipe[0], &ppid, sizeof(ppid)), sizeof(ppid));
close(cpipe[0]);
- ATF_REQUIRE(ppid == getpid());
+ REQUIRE_EQ(ppid, getpid());
/* Wait for the debugger. */
wpid = waitpid(debugger, &status, 0);
- ATF_REQUIRE(wpid == debugger);
+ REQUIRE_EQ(wpid, debugger);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 0);
+ REQUIRE_EQ(WEXITSTATUS(status), 0);
/* The child process should now be ready. */
wpid = waitpid(child, &status, WNOHANG);
- ATF_REQUIRE(wpid == child);
+ REQUIRE_EQ(wpid, child);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ(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(wpid, children[0]);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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(pl[0].pl_syscall_code, SYS_fork);
+ REQUIRE_EQ(pl[0].pl_syscall_code, pl[1].pl_syscall_code);
+ REQUIRE_EQ(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(wpid, children[1]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ(WEXITSTATUS(status), 2);
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ(wpid, children[0]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(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(wpid, children[0]);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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(pl[0].pl_syscall_code, SYS_vfork);
+ REQUIRE_EQ(pl[0].pl_syscall_code, pl[1].pl_syscall_code);
+ REQUIRE_EQ(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(wpid, children[1]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ(WEXITSTATUS(status), 2);
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ(wpid, children[0]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
static void *
@@ -1229,8 +1252,8 @@
{
pthread_t thread;
- CHILD_REQUIRE(pthread_create(&thread, NULL, simple_thread, NULL) == 0);
- CHILD_REQUIRE(pthread_join(thread, NULL) == 0);
+ CHILD_REQUIRE_EQ(pthread_create(&thread, NULL, simple_thread, NULL), 0);
+ CHILD_REQUIRE_EQ(pthread_join(thread, NULL), 0);
exit(1);
}
@@ -1254,9 +1277,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl,
sizeof(pl)) != -1);
@@ -1277,10 +1300,10 @@
*/
for (;;) {
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
-
+ REQUIRE_EQ(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 +1312,27 @@
/* New thread seen. */
break;
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
for (;;) {
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(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(WSTOPSIG(status), SIGTRAP);
+ REQUIRE_EQ(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
}
-
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+
+ REQUIRE_EQ(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -1331,54 +1354,54 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
-
+ REQUIRE_EQ(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((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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
-
+ REQUIRE_EQ(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((pl.pl_flags & (PL_FLAG_EXITED | PL_FLAG_SCE)),
(PL_FLAG_EXITED | PL_FLAG_SCE));
- ATF_REQUIRE(pl.pl_lwpid == lwps[1]);
+ REQUIRE_EQ(pl.pl_lwpid, lwps[1]);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
static void *
@@ -1394,7 +1417,7 @@
{
pthread_t thread;
- CHILD_REQUIRE(pthread_create(&thread, NULL, exec_thread, NULL) == 0);
+ CHILD_REQUIRE_EQ(pthread_create(&thread, NULL, exec_thread, NULL), 0);
for (;;)
sleep(60);
exit(1);
@@ -1420,69 +1443,69 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
-
+ REQUIRE_EQ(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((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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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((pl.pl_flags & (PL_FLAG_EXITED | PL_FLAG_SCE)),
(PL_FLAG_EXITED));
- ATF_REQUIRE(pl.pl_lwpid == lwps[0]);
+ REQUIRE_EQ(pl.pl_lwpid, lwps[0]);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(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((pl.pl_flags & (PL_FLAG_EXEC | PL_FLAG_SCX)),
(PL_FLAG_EXEC | PL_FLAG_SCX));
- ATF_REQUIRE(pl.pl_lwpid == lwps[1]);
+ REQUIRE_EQ(pl.pl_lwpid, lwps[1]);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(WEXITSTATUS(status), 0);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
static void
@@ -1517,33 +1540,33 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(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(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(pl.pl_siginfo.si_code, SI_LWP);
+ REQUIRE_EQ(pl.pl_siginfo.si_pid, wpid);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(WEXITSTATUS(status), 0);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -1563,24 +1586,24 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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(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(WEXITSTATUS(status), 0);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
ATF_TC_WITHOUT_HEAD(ptrace__ptrace_exec_enable);
@@ -1598,35 +1621,35 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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(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(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((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(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(WEXITSTATUS(status), 0);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
ATF_TC_WITHOUT_HEAD(ptrace__event_mask);
@@ -1643,9 +1666,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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 +1690,16 @@
sizeof(events)) == 0);
ATF_REQUIRE(!(events & PTRACE_LWP));
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(WEXITSTATUS(status), 0);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -1697,9 +1720,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, fpid, (caddr_t)&events,
sizeof(events)) == 0);
@@ -1712,22 +1735,22 @@
/* The next event should report the end of the vfork. */
wpid = wait(&status);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
ATF_TC_WITHOUT_HEAD(ptrace__ptrace_vfork_follow);
@@ -1748,9 +1771,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(children[0], &status, 0);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ(wpid, children[0]);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, children[0], (caddr_t)&events,
sizeof(events)) == 0);
@@ -1775,18 +1798,18 @@
* grandchild should report its exit first to the debugger.
*/
wpid = waitpid(children[1], &status, 0);
- ATF_REQUIRE(wpid == children[1]);
+ REQUIRE_EQ(wpid, children[1]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ(WEXITSTATUS(status), 2);
/*
* The child should report it's vfork() completion before it
* exits.
*/
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ(wpid, children[0]);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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 +1817,13 @@
ATF_REQUIRE(ptrace(PT_CONTINUE, children[0], (caddr_t)1, 0) != -1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == children[0]);
+ REQUIRE_EQ(wpid, children[0]);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
#ifdef HAVE_BREAKPOINT
@@ -1823,31 +1846,31 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
/* Continue the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGTRAP);
/* Kill the child process. */
- ATF_REQUIRE(ptrace(PT_KILL, fpid, 0, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSIGNALED(status));
- ATF_REQUIRE(WTERMSIG(status) == SIGKILL);
+ REQUIRE_EQ(WTERMSIG(status), SIGKILL);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
#endif /* HAVE_BREAKPOINT */
@@ -1871,34 +1894,34 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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(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(wpid, fpid);
ATF_REQUIRE(WIFSIGNALED(status));
- ATF_REQUIRE(WTERMSIG(status) == SIGKILL);
+ REQUIRE_EQ(WTERMSIG(status), SIGKILL);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -1921,42 +1944,42 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
-
+ REQUIRE_EQ(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((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(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(wpid, fpid);
ATF_REQUIRE(WIFSIGNALED(status));
- ATF_REQUIRE(WTERMSIG(status) == SIGKILL);
+ REQUIRE_EQ(WTERMSIG(status), SIGKILL);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
static void *
@@ -1969,7 +1992,7 @@
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGUSR1);
- CHILD_REQUIRE(pthread_sigmask(SIG_BLOCK, &sigmask, NULL) == 0);
+ CHILD_REQUIRE_EQ(pthread_sigmask(SIG_BLOCK, &sigmask, NULL), 0);
/* Sync up with other thread after sigmask updated. */
pthread_barrier_wait(pbarrier);
@@ -2005,11 +2028,11 @@
CPU_ZERO(&setmask);
CPU_SET(0, &setmask);
cpusetid_t setid;
- CHILD_REQUIRE(cpuset(&setid) == 0);
+ CHILD_REQUIRE_EQ(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(pthread_barrier_init(&barrier, NULL, 2), 0);
CHILD_REQUIRE(pthread_create(&t, NULL, mask_usr1_thread,
(void*)&barrier) == 0);
@@ -2031,7 +2054,7 @@
sigset_t sigmask;
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGUSR2);
- CHILD_REQUIRE(pthread_sigmask(SIG_BLOCK, &sigmask, NULL) == 0);
+ CHILD_REQUIRE_EQ(pthread_sigmask(SIG_BLOCK, &sigmask, NULL), 0);
/* Sync up with other thread after sigmask updated. */
pthread_barrier_wait(&barrier);
@@ -2046,37 +2069,37 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
/* Continue the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(kill(fpid, SIGUSR2), 0);
/* The second wait() should report the SIGUSR2. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGUSR2);
+ REQUIRE_EQ(WSTOPSIG(status), SIGUSR2);
/* Send a signal that only the first thread can handle. */
- ATF_REQUIRE(kill(fpid, SIGUSR1) == 0);
+ REQUIRE_EQ(kill(fpid, SIGUSR1), 0);
/* Replace the SIGUSR2 with a kill. */
- ATF_REQUIRE(ptrace(PT_KILL, fpid, 0, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSIGNALED(status));
- ATF_REQUIRE(WTERMSIG(status) == SIGKILL);
+ REQUIRE_EQ(WTERMSIG(status), SIGKILL);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -2111,11 +2134,11 @@
CPU_ZERO(&setmask);
CPU_SET(0, &setmask);
cpusetid_t setid;
- CHILD_REQUIRE(cpuset(&setid) == 0);
+ CHILD_REQUIRE_EQ(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(pthread_barrier_init(&barrier, NULL, 2), 0);
CHILD_REQUIRE(pthread_create(&t, NULL, mask_usr1_thread,
(void*)&barrier) == 0);
@@ -2137,7 +2160,7 @@
sigset_t sigmask;
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGUSR2);
- CHILD_REQUIRE(pthread_sigmask(SIG_BLOCK, &sigmask, NULL) == 0);
+ CHILD_REQUIRE_EQ(pthread_sigmask(SIG_BLOCK, &sigmask, NULL), 0);
/* Sync up with other thread after sigmask updated. */
pthread_barrier_wait(&barrier);
@@ -2151,15 +2174,15 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0), 0);
/*
* Continue until child is done with setup, which is indicated with
@@ -2167,44 +2190,44 @@
*/
for (;;) {
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(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(WSTOPSIG(status), SIGSTOP);
break;
}
- ATF_REQUIRE(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0), 0);
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl,
sizeof(pl)) != -1);
- ATF_REQUIRE(pl.pl_lwpid == main_lwp);
+ REQUIRE_EQ(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(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(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0), 0);
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl,
sizeof(pl)) != -1);
@@ -2212,18 +2235,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(kill(fpid, SIGUSR2), 0);
- ATF_REQUIRE(ptrace(PT_SYSCALL, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGUSR2);
+ REQUIRE_EQ(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(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 +2258,24 @@
*/
/* Replace the SIGUSR2 with a kill. */
- ATF_REQUIRE(ptrace(PT_KILL, fpid, 0, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSIGNALED(status));
- ATF_REQUIRE(WTERMSIG(status) == SIGKILL);
+ REQUIRE_EQ(WTERMSIG(status), SIGKILL);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
static void
sigusr1_handler(int sig)
{
- CHILD_REQUIRE(sig == SIGUSR1);
+ CHILD_REQUIRE_EQ(sig, SIGUSR1);
_exit(2);
}
@@ -2279,9 +2302,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
len = sizeof(max_pending_per_proc);
ATF_REQUIRE(sysctlbyname("kern.sigqueue.max_pending_per_proc",
@@ -2289,20 +2312,20 @@
/* Fill the signal queue. */
for (i = 0; i < max_pending_per_proc; ++i)
- ATF_REQUIRE(kill(fpid, SIGUSR1) == 0);
+ REQUIRE_EQ(kill(fpid, SIGUSR1), 0);
/* Kill the child process. */
- ATF_REQUIRE(ptrace(PT_KILL, fpid, 0, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSIGNALED(status));
- ATF_REQUIRE(WTERMSIG(status) == SIGKILL);
+ REQUIRE_EQ(WTERMSIG(status), SIGKILL);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -2328,24 +2351,24 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1), 0);
for (;;) {
/*
@@ -2354,21 +2377,21 @@
* past any syscall stops.
*/
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(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(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
} else {
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ(WEXITSTATUS(status), 2);
break;
}
}
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
static void
@@ -2376,7 +2399,7 @@
{
static int counter = 0;
- CHILD_REQUIRE(sig == SIGUSR1);
+ CHILD_REQUIRE_EQ(sig, SIGUSR1);
counter++;
if (counter == 2)
_exit(2);
@@ -2405,36 +2428,36 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1), 0);
for (;;) {
/*
@@ -2443,21 +2466,21 @@
* past any syscall stops.
*/
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(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(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
} else {
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ(WEXITSTATUS(status), 2);
break;
}
}
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -2484,9 +2507,9 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
len = sizeof(max_pending_per_proc);
ATF_REQUIRE(sysctlbyname("kern.sigqueue.max_pending_per_proc",
@@ -2494,31 +2517,31 @@
/* Fill the signal queue. */
for (i = 0; i < max_pending_per_proc; ++i)
- ATF_REQUIRE(kill(fpid, SIGUSR2) == 0);
+ REQUIRE_EQ(kill(fpid, SIGUSR2), 0);
/* Continue with signal. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1) == 0);
+ REQUIRE_EQ(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1), 0);
for (;;) {
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
if (WIFSTOPPED(status)) {
- ATF_REQUIRE(WSTOPSIG(status) == SIGUSR2);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(WSTOPSIG(status), SIGUSR2);
+ REQUIRE_EQ(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(WEXITSTATUS(status), 2);
break;
}
}
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
static sem_t sigusr1_sem;
@@ -2529,7 +2552,7 @@
{
got_usr1++;
- CHILD_REQUIRE(sem_post(&sigusr1_sem) == 0);
+ CHILD_REQUIRE_EQ(sem_post(&sigusr1_sem), 0);
}
/*
@@ -2549,35 +2572,35 @@
sigset_t sigmask;
ATF_REQUIRE(signal(SIGUSR2, handler) != SIG_ERR);
- ATF_REQUIRE(sem_init(&sigusr1_sem, 0, 0) == 0);
+ REQUIRE_EQ(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(sigemptyset(&sigmask), 0);
+ CHILD_REQUIRE_EQ(sigaddset(&sigmask, SIGUSR1), 0);
+ CHILD_REQUIRE_EQ(sigprocmask(SIG_BLOCK, &sigmask, NULL), 0);
trace_me();
- CHILD_REQUIRE(got_usr1 == 0);
+ CHILD_REQUIRE_EQ(got_usr1, 0);
/* Allow the pending SIGUSR1 in now. */
- CHILD_REQUIRE(sigprocmask(SIG_UNBLOCK, &sigmask, NULL) == 0);
+ CHILD_REQUIRE_EQ(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
len = sizeof(max_pending_per_proc);
ATF_REQUIRE(sysctlbyname("kern.sigqueue.max_pending_per_proc",
@@ -2585,40 +2608,40 @@
/* Fill the signal queue. */
for (i = 0; i < max_pending_per_proc; ++i)
- ATF_REQUIRE(kill(fpid, SIGUSR2) == 0);
+ REQUIRE_EQ(kill(fpid, SIGUSR2), 0);
/* Continue with signal. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGUSR2);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(WSTOPSIG(status), SIGUSR2);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGUSR1);
+ REQUIRE_EQ(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(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(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(wpid, fpid);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -2641,40 +2664,40 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
/* Send a signal without ptrace. */
- ATF_REQUIRE(kill(fpid, SIGINT) == 0);
+ REQUIRE_EQ(kill(fpid, SIGINT), 0);
/* The second wait() should report a SIGINT was received. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGINT);
+ REQUIRE_EQ(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(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(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(wpid, fpid);
ATF_REQUIRE(WIFSIGNALED(status));
- ATF_REQUIRE(WTERMSIG(status) == SIGTERM);
+ REQUIRE_EQ(WTERMSIG(status), SIGTERM);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -2695,31 +2718,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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGTRAP), 0);
for (;;) {
/*
@@ -2727,22 +2750,21 @@
* meantime, catch and proceed past any syscall stops.
*/
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(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(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
} else {
ATF_REQUIRE(WIFSIGNALED(status));
- ATF_REQUIRE(WTERMSIG(status) == SIGTRAP);
+ REQUIRE_EQ(WTERMSIG(status), SIGTRAP);
break;
}
}
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
-
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -2766,52 +2788,52 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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(kill(fpid, SIGABRT), 0);
/* Continue normally. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGABRT);
+ REQUIRE_EQ(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(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(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1), 0);
for (;;) {
/*
@@ -2820,22 +2842,21 @@
* past any syscall stops.
*/
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(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(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
} else {
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 2);
+ REQUIRE_EQ(WEXITSTATUS(status), 2);
break;
}
}
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
-
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -2854,7 +2875,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(kevent(kq, &kev, 1, NULL, 0, NULL), 0);
trace_me();
@@ -2863,8 +2884,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(kev.filter, EVFILT_SIGNAL);
+ CHILD_REQUIRE_EQ(kev.ident, SIGUSR1);
break;
}
@@ -2873,24 +2894,24 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
/* Continue with the SIGUSR1. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
static void *
@@ -2914,9 +2935,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(sigemptyset(&sigmask), 0);
+ CHILD_REQUIRE_EQ(sigaddset(&sigmask, SIGUSR1), 0);
+ CHILD_REQUIRE_EQ(pthread_sigmask(SIG_BLOCK, &sigmask, NULL), 0);
/* Sync up threads after swapping signal masks. */
pthread_barrier_wait(pbarrier);
@@ -2939,64 +2960,64 @@
int status, err;
sigset_t sigmask;
- ATF_REQUIRE(sem_init(&sigusr1_sem, 0, 0) == 0);
+ REQUIRE_EQ(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(sigemptyset(&sigmask), 0);
+ CHILD_REQUIRE_EQ(sigaddset(&sigmask, SIGUSR1), 0);
+ CHILD_REQUIRE_EQ(sigprocmask(SIG_BLOCK, &sigmask, NULL), 0);
trace_me();
- CHILD_REQUIRE(got_usr1 == 0);
+ CHILD_REQUIRE_EQ(got_usr1, 0);
/* Allow the pending SIGUSR1 in now. */
- CHILD_REQUIRE(sigprocmask(SIG_UNBLOCK, &sigmask, NULL) == 0);
+ CHILD_REQUIRE_EQ(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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(pl.pl_siginfo.si_signo, SIGSTOP);
/* Send blocked SIGUSR1 which should cause a stop. */
- ATF_REQUIRE(kill(fpid, SIGUSR1) == 0);
+ REQUIRE_EQ(kill(fpid, SIGUSR1), 0);
/* Continue the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGUSR1);
+ REQUIRE_EQ(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(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(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(wpid, fpid);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -3011,62 +3032,62 @@
int status, err;
sigset_t sigmask;
- ATF_REQUIRE(sem_init(&sigusr1_sem, 0, 0) == 0);
+ REQUIRE_EQ(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(sigemptyset(&sigmask), 0);
+ CHILD_REQUIRE_EQ(sigaddset(&sigmask, SIGUSR1), 0);
+ CHILD_REQUIRE_EQ(sigprocmask(SIG_BLOCK, &sigmask, NULL), 0);
trace_me();
- CHILD_REQUIRE(got_usr1 == 0);
+ CHILD_REQUIRE_EQ(got_usr1, 0);
/* Allow the pending SIGUSR1 in now. */
- CHILD_REQUIRE(sigprocmask(SIG_UNBLOCK, &sigmask, NULL) == 0);
+ CHILD_REQUIRE_EQ(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGUSR1);
+ REQUIRE_EQ(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(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(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(wpid, fpid);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -3084,18 +3105,19 @@
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(pthread_barrier_init(&barrier, NULL, 2), 0);
+ REQUIRE_EQ(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(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(sigemptyset(&sigmask), 0);
+ CHILD_REQUIRE_EQ(sigaddset(&sigmask, SIGUSR1), 0);
+ CHILD_REQUIRE_EQ(pthread_sigmask(SIG_BLOCK, &sigmask, NULL), 0);
trace_me();
@@ -3106,7 +3128,8 @@
* Swap ignore duties; the next SIGUSR1 should go to this
* thread.
*/
- CHILD_REQUIRE(pthread_sigmask(SIG_UNBLOCK, &sigmask, NULL) == 0);
+ CHILD_REQUIRE_EQ(pthread_sigmask(SIG_UNBLOCK, &sigmask, NULL),
+ 0);
/* Sync up threads after swapping signal masks. */
pthread_barrier_wait(&barrier);
@@ -3126,64 +3149,64 @@
/* Free the other thread from the barrier. */
pthread_barrier_wait(&barrier);
- CHILD_REQUIRE(pthread_join(t, NULL) == 0);
+ CHILD_REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
/* Continue the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(kill(fpid, SIGUSR2), 0);
+
/* The second wait() should report a SIGUSR2 was received. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGUSR2);
+ REQUIRE_EQ(WSTOPSIG(status), SIGUSR2);
/* Continue the child, changing the signal to USR1. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
/* Continue the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0);
- ATF_REQUIRE(kill(fpid, SIGUSR2) == 0);
+ REQUIRE_EQ(kill(fpid, SIGUSR2), 0);
/* The next wait() should report a SIGUSR2 was received. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGUSR2);
+ REQUIRE_EQ(WSTOPSIG(status), SIGUSR2);
/* Continue the child, changing the signal to USR1. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, SIGUSR1) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 1);
+ REQUIRE_EQ(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
static void *
@@ -3215,7 +3238,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(procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL), 0);
fpid = fork();
ATF_REQUIRE(fpid >= 0);
@@ -3228,7 +3251,7 @@
/* Pin to CPU 0 to serialize thread execution. */
CPU_ZERO(&setmask);
CPU_SET(0, &setmask);
- CHILD_REQUIRE(cpuset(&setid) == 0);
+ CHILD_REQUIRE_EQ(cpuset(&setid), 0);
CHILD_REQUIRE(cpuset_setaffinity(CPU_LEVEL_CPUSET,
CPU_WHICH_CPUSET, setid,
sizeof(setmask), &setmask) == 0);
@@ -3259,17 +3282,17 @@
}
/* First stop is trace_me() immediately after fork. */
wpid = waitpid(fpid, &status, 0);
- CHILD_REQUIRE(wpid == fpid);
+ CHILD_REQUIRE_EQ(wpid, fpid);
CHILD_REQUIRE(WIFSTOPPED(status));
- CHILD_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ CHILD_REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
- CHILD_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ CHILD_REQUIRE_EQ(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(wpid, fpid);
CHILD_REQUIRE(WIFSTOPPED(status));
- CHILD_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ CHILD_REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
/*
* Terminate tracing process without detaching. Our child
@@ -3286,12 +3309,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(WEXITSTATUS(status), 0);
+ } else {
+ ATF_REQUIRE(WIFSIGNALED(status));
+ REQUIRE_EQ(WTERMSIG(status), SIGKILL);
+ }
}
}
@@ -3350,9 +3374,9 @@
/* The first wait() should report the stop from trace_me(). */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
/* Set several unobtrusive event bits. */
event_mask = PTRACE_EXEC | PTRACE_FORK | PTRACE_LWP;
@@ -3360,47 +3384,47 @@
sizeof(event_mask)) == 0);
/* Send a SIGKILL without using ptrace. */
- ATF_REQUIRE(kill(fpid, SIGKILL) == 0);
+ REQUIRE_EQ(kill(fpid, SIGKILL), 0);
/* Continue the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGKILL);
+ REQUIRE_EQ(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(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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(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(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(WEXITSTATUS(status), 0);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
static void *
@@ -3428,10 +3452,10 @@
pid_t child, wpid;
int error, fd, i, status;
- ATF_REQUIRE(pthread_barrierattr_init(&battr) == 0);
+ REQUIRE_EQ(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(pthread_barrier_init(&barrier, &battr, 2), 0);
(void)snprintf(tmpfile, sizeof(tmpfile), "./ptrace.XXXXXX");
fd = mkstemp(tmpfile);
@@ -3466,7 +3490,7 @@
_exit(0);
}
- ATF_REQUIRE(flock(fd, LOCK_EX) == 0);
+ REQUIRE_EQ(flock(fd, LOCK_EX), 0);
error = pthread_barrier_wait(&barrier);
ATF_REQUIRE(error == 0 || error == PTHREAD_BARRIER_SERIAL_THREAD);
@@ -3479,7 +3503,7 @@
/*
* Attach and give the child 3 seconds to stop.
*/
- ATF_REQUIRE(ptrace(PT_ATTACH, child, NULL, 0) == 0);
+ REQUIRE_EQ(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 +3513,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(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(flock(fd, LOCK_UN), 0);
+ REQUIRE_EQ(unlink(tmpfile), 0);
+ REQUIRE_EQ(close(fd), 0);
}
static void
sigusr1_step_handler(int sig)
{
- CHILD_REQUIRE(sig == SIGUSR1);
+ CHILD_REQUIRE_EQ(sig, SIGUSR1);
raise(SIGABRT);
}
@@ -3526,60 +3550,60 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGABRT);
+ REQUIRE_EQ(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(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGABRT);
+ REQUIRE_EQ(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(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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(pl.pl_siginfo.si_signo, SIGTRAP);
+ REQUIRE_EQ(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(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(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
#ifdef HAVE_BREAKPOINT
@@ -3603,36 +3627,36 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
/* Continue the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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(pl.pl_siginfo.si_signo, SIGTRAP);
+ REQUIRE_EQ(pl.pl_siginfo.si_code, TRAP_BRKPT);
/* Kill the child process. */
- ATF_REQUIRE(ptrace(PT_KILL, fpid, 0, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSIGNALED(status));
- ATF_REQUIRE(WTERMSIG(status) == SIGKILL);
+ REQUIRE_EQ(WTERMSIG(status), SIGKILL);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
#endif /* HAVE_BREAKPOINT */
@@ -3655,35 +3679,35 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
/* Step the child ignoring the SIGSTOP. */
- ATF_REQUIRE(ptrace(PT_STEP, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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(pl.pl_siginfo.si_signo, SIGTRAP);
+ REQUIRE_EQ(pl.pl_siginfo.si_code, TRAP_TRACE);
/* Continue the child process. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
#if defined(HAVE_BREAKPOINT) && defined(SKIP_BREAK)
@@ -3703,8 +3727,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(pthread_join(threads[0], NULL), 0);
+ CHILD_REQUIRE_EQ(pthread_join(threads[1], NULL), 0);
exit(1);
}
@@ -3731,26 +3755,26 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)),
(PL_FLAG_BORN | PL_FLAG_SCX));
lwps[0] = pl.pl_lwpid;
@@ -3760,16 +3784,16 @@
*/
ATF_REQUIRE(ptrace(PT_SUSPEND, lwps[0], NULL, 0) != -1);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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((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 +3801,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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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(pl.pl_siginfo.si_signo, SIGTRAP);
+ REQUIRE_EQ(pl.pl_siginfo.si_code, TRAP_BRKPT);
if (pl.pl_lwpid == lwps[0])
i = 0;
else
@@ -3802,7 +3826,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(ptrace(PT_CONTINUE, lwps[i ^ 1], (caddr_t)1, 0), 0);
/*
* Will now get two thread exit events and one more breakpoint
@@ -3810,9 +3834,9 @@
*/
for (j = 0; j < 3; j++) {
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGTRAP);
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl,
sizeof(pl)) != -1);
@@ -3829,8 +3853,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(pl.pl_siginfo.si_signo, SIGTRAP);
+ REQUIRE_EQ(pl.pl_siginfo.si_code, TRAP_BRKPT);
ATF_REQUIRE_MSG(!hit_break[i],
"double breakpoint event");
hit_break[i] = true;
@@ -3841,21 +3865,21 @@
0) != -1);
}
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(lwps[0], 0);
+ REQUIRE_EQ(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(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
#endif
@@ -3878,40 +3902,40 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGABRT);
+ REQUIRE_EQ(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(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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((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 +3943,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(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(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -3953,121 +3977,121 @@
/* The first wait() should report the stop from SIGSTOP. */
wpid = waitpid(fpid, &status, 0);
- ATF_REQUIRE(wpid == fpid);
+ REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(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(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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(pl.pl_syscall_code, SYS_getpid);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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(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(psr.sr_error, 0);
+ REQUIRE_EQ(psr.sr_retval[0], wpid);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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(pl.pl_syscall_code, SYS_kill);
+ REQUIRE_EQ(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(args[0], wpid);
+ REQUIRE_EQ(args[1], 0);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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(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(psr.sr_error, 0);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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(pl.pl_syscall_code, SYS_close);
+ REQUIRE_EQ(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(args[0], 3);
- ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(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(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+ REQUIRE_EQ(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(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(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 +4099,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(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(WEXITSTATUS(status), 1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -4114,31 +4138,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(ptrace(PT_ATTACH, traced, 0, 0), 0);
wpid = waitpid(traced, &status, 0);
- ATF_REQUIRE(wpid == traced);
+ REQUIRE_EQ(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(WSTOPSIG(status), SIGSTOP);
+ REQUIRE_EQ(close(pd), 0);
+ REQUIRE_EQ(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(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
exit(0);
}
- ATF_REQUIRE(close(pd) == 0);
+ REQUIRE_EQ(close(pd), 0);
wpid = waitpid(debuger, &status, 0);
- ATF_REQUIRE(wpid == debuger);
- ATF_REQUIRE(WEXITSTATUS(status) == 0);
+ REQUIRE_EQ(wpid, debuger);
+ REQUIRE_EQ(WEXITSTATUS(status), 0);
/* Check if we still have any child. */
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
}
/*
@@ -4161,16 +4185,16 @@
}
wpid = waitpid(child, &status, 0);
- ATF_REQUIRE(wpid == child);
+ REQUIRE_EQ(wpid, child);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_CONTINUE, child, (caddr_t)1, 0) != -1);
wpid = wait(&status);
- ATF_REQUIRE(wpid == child);
+ REQUIRE_EQ(wpid, child);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
ATF_REQUIRE(ptrace(PT_CONTINUE, child, (caddr_t)1, 0) != -1);
@@ -4179,8 +4203,8 @@
* be collected through process descriptor.
*/
wpid = wait(&status);
- ATF_REQUIRE(wpid == -1);
- ATF_REQUIRE(errno == ECHILD);
+ REQUIRE_EQ(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
ATF_REQUIRE(close(pd) != -1);
}
@@ -4210,37 +4234,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(ptrace(PT_ATTACH, traced, 0, 0), 0);
wpid = waitpid(traced, &status, 0);
- ATF_REQUIRE(wpid == traced);
+ REQUIRE_EQ(wpid, traced);
ATF_REQUIRE(WIFSTOPPED(status));
- ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+ REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
/* Allow process to die. */
- ATF_REQUIRE(ptrace(PT_CONTINUE, traced, (caddr_t)1, 0) == 0);
+ REQUIRE_EQ(ptrace(PT_CONTINUE, traced, (caddr_t)1, 0), 0);
wpid = waitpid(traced, &status, 0);
- ATF_REQUIRE(wpid == traced);
+ REQUIRE_EQ(wpid, traced);
ATF_REQUIRE(WIFEXITED(status));
- ATF_REQUIRE(WEXITSTATUS(status) == 0);
+ REQUIRE_EQ(WEXITSTATUS(status), 0);
/* Reparent back to the orginal process. */
- ATF_REQUIRE(close(pd) == 0);
+ REQUIRE_EQ(close(pd), 0);
exit(0);
}
wpid = waitpid(debuger, &status, 0);
- ATF_REQUIRE(wpid == debuger);
- ATF_REQUIRE(WEXITSTATUS(status) == 0);
+ REQUIRE_EQ(wpid, debuger);
+ REQUIRE_EQ(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(wpid, -1);
+ REQUIRE_EQ(errno, ECHILD);
- ATF_REQUIRE(close(pd) == 0);
+ REQUIRE_EQ(close(pd), 0);
}
ATF_TP_ADD_TCS(tp)

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 26, 5:05 AM (7 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28001764
Default Alt Text
D28887.id84712.diff (111 KB)

Event Timeline