If children and parents aren't isolated properly (ie. failtest is
buggy) we really want to run gdb on a failing child. This hack allows that.
unsigned int failtest_timeout_ms = 20000;
const char *failpath;
unsigned int failtest_timeout_ms = 20000;
const char *failpath;
+ /* Attach debugger if they asked for it. */
+ if (debugpath && history_num == strlen(debugpath)) {
+ unsigned int i;
+
+ for (i = 0; i < history_num; i++) {
+ char c = info_to_arg[history[i].type];
+ if (history[i].fail)
+ c = toupper(c);
+ if (c != debugpath[i])
+ break;
+ }
+ if (i == history_num) {
+ char str[80];
+
+ /* Don't timeout. */
+ signal(SIGUSR1, SIG_IGN);
+ sprintf(str, "xterm -e gdb /proc/%d/exe %d &",
+ getpid(), getpid());
+ system(str);
+ sleep(5);
+ }
+ }
+
if (!failtest_hook(history, history_num)) {
call->fail = false;
return false;
if (!failtest_hook(history, history_num)) {
call->fail = false;
return false;
} else if (strcmp(argv[i], "--tracepath") == 0) {
tracefd = dup(STDERR_FILENO);
failtest_timeout_ms = -1;
} else if (strcmp(argv[i], "--tracepath") == 0) {
tracefd = dup(STDERR_FILENO);
failtest_timeout_ms = -1;
+ } else if (!strncmp(argv[i], "--debugpath=",
+ strlen("--debugpath="))) {
+ debugpath = argv[i] + strlen("--debugpath=");
}
}
gettimeofday(&start, NULL);
}
}
gettimeofday(&start, NULL);