Skip to content

Commit

Permalink
selftests/clone3: report a correct number of fails
Browse files Browse the repository at this point in the history
In clone3_set_tid, a few test cases are running in a child process.  And
right now, if one of these test cases fails, the whole test will exit
with the success status.

Fixes: 41585bb ("selftests: add tests for clone3() with *set_tid")
Signed-off-by: Andrei Vagin <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Christian Brauner <[email protected]>
  • Loading branch information
avagin authored and Christian Brauner committed Nov 18, 2019
1 parent 4f5c289 commit 28df751
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions tools/testing/selftests/clone3/clone3_set_tid.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ int main(int argc, char *argv[])
*/
test_clone3_set_tid(set_tid, 3, CLONE_NEWPID, 0, 42, true);

child_exit(ksft_cnt.ksft_pass);
child_exit(ksft_cnt.ksft_fail);
}

close(pipe_1[1]);
Expand Down Expand Up @@ -366,12 +366,8 @@ int main(int argc, char *argv[])
if (!WIFEXITED(status))
ksft_test_result_fail("Child error\n");

if (WEXITSTATUS(status))
/*
* Update the number of total tests with the tests from the
* child processes.
*/
ksft_cnt.ksft_pass = WEXITSTATUS(status);
ksft_cnt.ksft_pass += 4 - (ksft_cnt.ksft_fail - WEXITSTATUS(status));
ksft_cnt.ksft_fail = WEXITSTATUS(status);

if (ns3 == pid && ns2 == 42 && ns1 == 1)
ksft_test_result_pass(
Expand Down

0 comments on commit 28df751

Please sign in to comment.