|
Lines 1-4
Link Here
|
| 1 |
--- tests/test-runner.c.orig 2017-08-08 18:20:52 UTC |
1 |
--- tests/test-runner.c.orig 2018-08-24 18:04:36 UTC |
| 2 |
+++ tests/test-runner.c |
2 |
+++ tests/test-runner.c |
| 3 |
@@ -25,6 +25,12 @@ |
3 |
@@ -25,6 +25,12 @@ |
| 4 |
|
4 |
|
|
Lines 17-23
Link Here
|
| 17 |
#include <errno.h> |
17 |
#include <errno.h> |
| 18 |
#include <limits.h> |
18 |
#include <limits.h> |
| 19 |
#include <sys/ptrace.h> |
19 |
#include <sys/ptrace.h> |
| 20 |
+#ifdef __linux__ |
20 |
+#ifdef HAVE_SYS_PRCTL_H |
| 21 |
#include <sys/prctl.h> |
21 |
#include <sys/prctl.h> |
| 22 |
+#endif |
22 |
+#endif |
| 23 |
#ifndef PR_SET_PTRACER |
23 |
#ifndef PR_SET_PTRACER |
|
Lines 84-90
Link Here
|
| 84 |
pid = fork(); |
84 |
pid = fork(); |
| 85 |
if (pid == -1) { |
85 |
if (pid == -1) { |
| 86 |
perror("fork"); |
86 |
perror("fork"); |
| 87 |
@@ -312,7 +339,7 @@ is_debugger_attached(void) |
87 |
@@ -312,13 +339,14 @@ is_debugger_attached(void) |
| 88 |
_exit(1); |
88 |
_exit(1); |
| 89 |
if (!waitpid(-1, NULL, 0)) |
89 |
if (!waitpid(-1, NULL, 0)) |
| 90 |
_exit(1); |
90 |
_exit(1); |
|
Lines 93-99
Link Here
|
| 93 |
ptrace(PTRACE_DETACH, ppid, NULL, NULL); |
93 |
ptrace(PTRACE_DETACH, ppid, NULL, NULL); |
| 94 |
_exit(0); |
94 |
_exit(0); |
| 95 |
} else { |
95 |
} else { |
| 96 |
@@ -346,17 +373,19 @@ int main(int argc, char *argv[]) |
96 |
close(pipefd[0]); |
|
|
97 |
|
| 98 |
/* Enable child to ptrace the parent process */ |
| 99 |
+#if defined(HAVE_PRCTL) |
| 100 |
rc = prctl(PR_SET_PTRACER, pid); |
| 101 |
if (rc != 0 && errno != EINVAL) { |
| 102 |
/* An error prevents us from telling if a debugger is attached. |
| 103 |
@@ -328,7 +356,9 @@ is_debugger_attached(void) |
| 104 |
*/ |
| 105 |
perror("prctl"); |
| 106 |
write(pipefd[1], "-", 1); |
| 107 |
- } else { |
| 108 |
+ } else |
| 109 |
+#endif |
| 110 |
+ { |
| 111 |
/* Signal to client that parent is ready by passing '+' */ |
| 112 |
write(pipefd[1], "+", 1); |
| 113 |
} |
| 114 |
@@ -346,17 +376,19 @@ int main(int argc, char *argv[]) |
| 97 |
const struct test *t; |
115 |
const struct test *t; |
| 98 |
pid_t pid; |
116 |
pid_t pid; |
| 99 |
int total, pass; |
117 |
int total, pass; |
|
Lines 116-122
Link Here
|
| 116 |
if (is_debugger_attached()) { |
134 |
if (is_debugger_attached()) { |
| 117 |
leak_check_enabled = 0; |
135 |
leak_check_enabled = 0; |
| 118 |
timeouts_enabled = 0; |
136 |
timeouts_enabled = 0; |
| 119 |
@@ -364,7 +393,17 @@ int main(int argc, char *argv[]) |
137 |
@@ -364,7 +396,17 @@ int main(int argc, char *argv[]) |
| 120 |
leak_check_enabled = !getenv("WAYLAND_TEST_NO_LEAK_CHECK"); |
138 |
leak_check_enabled = !getenv("WAYLAND_TEST_NO_LEAK_CHECK"); |
| 121 |
timeouts_enabled = !getenv("WAYLAND_TEST_NO_TIMEOUTS"); |
139 |
timeouts_enabled = !getenv("WAYLAND_TEST_NO_TIMEOUTS"); |
| 122 |
} |
140 |
} |
|
Lines 134-140
Link Here
|
| 134 |
if (argc == 2 && strcmp(argv[1], "--help") == 0) |
152 |
if (argc == 2 && strcmp(argv[1], "--help") == 0) |
| 135 |
usage(argv[0], EXIT_SUCCESS); |
153 |
usage(argv[0], EXIT_SUCCESS); |
| 136 |
|
154 |
|
| 137 |
@@ -395,7 +434,8 @@ int main(int argc, char *argv[]) |
155 |
@@ -395,7 +437,8 @@ int main(int argc, char *argv[]) |
| 138 |
if (pid == 0) |
156 |
if (pid == 0) |
| 139 |
run_test(t); /* never returns */ |
157 |
run_test(t); /* never returns */ |
| 140 |
|
158 |
|
|
Lines 144-150
Link Here
|
| 144 |
stderr_set_color(RED); |
162 |
stderr_set_color(RED); |
| 145 |
fprintf(stderr, "waitid failed: %m\n"); |
163 |
fprintf(stderr, "waitid failed: %m\n"); |
| 146 |
stderr_reset_color(); |
164 |
stderr_reset_color(); |
| 147 |
@@ -426,6 +466,25 @@ int main(int argc, char *argv[]) |
165 |
@@ -426,6 +469,25 @@ int main(int argc, char *argv[]) |
| 148 |
|
166 |
|
| 149 |
break; |
167 |
break; |
| 150 |
} |
168 |
} |