Skip to content

Commit c4cc023

Browse files
committed
Let test pass if the child dies before we manage to ptrace it
1 parent e215872 commit c4cc023

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/test/early_error.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ int main(int argc, char *argv[]) {
4646
ret = dup2(fd_pair[1], 2);
4747
test_assert(ret >= 0);
4848

49-
// We want to probe the regular rr error path, not the test monitor path,
50-
// but we should still pass through things like LD_LIBRARY_PATH in case
51-
// they're required for rr running properly.
49+
/* We want to probe the regular rr error path, not the test monitor path,
50+
but we should still pass through things like LD_LIBRARY_PATH in case
51+
they're required for rr running properly. */
5252
unsetenv("RUNNING_UNDER_TEST_MONITOR");
5353
execve(argv[1], &argv[1], environ); // Should not return
5454
test_assert(0);
@@ -63,7 +63,15 @@ int main(int argc, char *argv[]) {
6363
memset(buf, 0, sizeof(buf));
6464
ssize_t nread = read(fd_pair[0], buf, sizeof(buf)-1);
6565
test_assert(nread >= 0);
66-
if (NULL == strstr(buf, "Unexpected stop")) {
66+
/* Three possibilities:
67+
1) The child gets SIGSYS and exits before we PTRACE_SEIZE it
68+
2) The child gets SIGSYS before we PTRACE_SEIZE it, but we still
69+
see the PTRACE_EVENT_EXIT
70+
3) We PTRACE_SEIZE it in time to see the SIGSYS
71+
*/
72+
if (!strstr(buf, "child probably died before reaching SIGSTOP") &&
73+
!strstr(buf, "Tracee died before reaching SIGSTOP") &&
74+
!strstr(buf, "Unexpected stop")) {
6775
write(2, buf, nread);
6876
test_assert(0);
6977
}

0 commit comments

Comments
 (0)