Skip to content

Commit

Permalink
iX: Test exit status of child to make sure child completed successfully
Browse files Browse the repository at this point in the history
If the child crashes or exits with a non-zero exit code the test would
otherwise get marked as passing.
  • Loading branch information
xdje42 committed Dec 18, 2023
1 parent 6d1912f commit 8ac7dca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion suite/tests/linux/clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,13 @@ delete_thread(pid_t pid, void *stack)
{
pid_t result;
/* do not print out pids to make diff easy */
result = waitpid(pid, NULL, 0);
int wait_status;
result = waitpid(pid, &wait_status, 0);
print("Child has exited\n");
if (result == -1 || result != pid)
perror("delete_thread waitpid");
else if (!WIFEXITED(wait_status) || WEXITSTATUS(wait_status) != 0)
print("delete_thread bad wait_status: 0x%x\n", wait_status);
stack_free(stack, THREAD_STACK_SIZE);
}

Expand Down

0 comments on commit 8ac7dca

Please sign in to comment.