diff --git a/test/zdtm/static/ptrace_sig.c b/test/zdtm/static/ptrace_sig.c index a8e1dc5019..299605de8c 100644 --- a/test/zdtm/static/ptrace_sig.c +++ b/test/zdtm/static/ptrace_sig.c @@ -25,11 +25,6 @@ void sig_handler(int signo, siginfo_t *siginfo, void *data) child_exit = 1; } -void sig_chld_handler(int signo) -{ - test_msg("Receive signal %d\n", signo); -} - int child(int fd) { int ret = 0; @@ -64,7 +59,6 @@ int main(int argc, char ** argv) { int ret, status = 0; pid_t pid, spid, cpid; - sighandler_t sh; int signal_pipe[2]; int child_pipe[2]; @@ -113,12 +107,6 @@ int main(int argc, char ** argv) } close(signal_pipe[0]); - sh = signal(SIGCHLD, sig_chld_handler); - if (sh == SIG_ERR) { - pr_perror("signal failed"); - return 1; - } - test_msg("wait while child initialized"); ret = read(child_pipe[0], &status, sizeof(status)); if (ret != sizeof(status)) { @@ -166,24 +154,23 @@ int main(int argc, char ** argv) return 1; } - if (spid != siginfo.si_pid) + if (spid != siginfo.si_pid) { fail("%d!=%d", cpid, siginfo.si_pid); - else if (status == siginfo.si_pid) - pass(); - else { + return 1; + } else if (status != siginfo.si_pid) { fail("%d!=%d", status, siginfo.si_pid); return 1; } - } - if (WIFEXITED(status)) { + } else if (WIFEXITED(status)) { test_msg("pid = %d status = %d\n", pid, WEXITSTATUS(status)); if (WEXITSTATUS(status)) return 1; - } - if (WIFSTOPPED(status)) { + } else if (WIFSIGNALED(status)) { test_msg("pid = %d signal = %d\n", pid, WTERMSIG(status)); return 1; } } + + pass(); return 0; } diff --git a/test/zdtm/static/ptrace_sig.desc b/test/zdtm/static/ptrace_sig.desc index 95c58b4018..ded89879a9 100644 --- a/test/zdtm/static/ptrace_sig.desc +++ b/test/zdtm/static/ptrace_sig.desc @@ -1 +1 @@ -{'flags': 'noauto'} +{'flags': 'crfail'}