Skip to content

Commit 28df751

Browse files
avaginChristian Brauner
authored andcommitted
selftests/clone3: report a correct number of fails
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 <avagin@gmail.com> Link: https://lore.kernel.org/r/20191118064750.408003-2-avagin@gmail.com Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
1 parent 4f5c289 commit 28df751

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

tools/testing/selftests/clone3/clone3_set_tid.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ int main(int argc, char *argv[])
316316
*/
317317
test_clone3_set_tid(set_tid, 3, CLONE_NEWPID, 0, 42, true);
318318

319-
child_exit(ksft_cnt.ksft_pass);
319+
child_exit(ksft_cnt.ksft_fail);
320320
}
321321

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

369-
if (WEXITSTATUS(status))
370-
/*
371-
* Update the number of total tests with the tests from the
372-
* child processes.
373-
*/
374-
ksft_cnt.ksft_pass = WEXITSTATUS(status);
369+
ksft_cnt.ksft_pass += 4 - (ksft_cnt.ksft_fail - WEXITSTATUS(status));
370+
ksft_cnt.ksft_fail = WEXITSTATUS(status);
375371

376372
if (ns3 == pid && ns2 == 42 && ns1 == 1)
377373
ksft_test_result_pass(

0 commit comments

Comments
 (0)