scoped_vs_unscoped.unix_scoping starts a child process and a
grandchild process.  Add the missing check for the grandchild's exit
status and propagate it upwards.

Assisted-by: LLM
Signed-off-by: Günther Noack <[email protected]>
---
 tools/testing/selftests/landlock/scoped_abstract_unix_test.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/landlock/scoped_abstract_unix_test.c 
b/tools/testing/selftests/landlock/scoped_abstract_unix_test.c
index 5dc0debacb2a..e006dba61652 100644
--- a/tools/testing/selftests/landlock/scoped_abstract_unix_test.c
+++ b/tools/testing/selftests/landlock/scoped_abstract_unix_test.c
@@ -608,6 +608,11 @@ TEST_F(scoped_vs_unscoped, unix_scoping)
                ASSERT_EQ(grand_child, waitpid(grand_child, &status, 0));
                EXPECT_EQ(0, close(stream_server_child));
                EXPECT_EQ(0, close(dgram_server_child));
+
+               if (WIFSIGNALED(status) || !WIFEXITED(status) ||
+                   WEXITSTATUS(status) != EXIT_SUCCESS)
+                       _metadata->exit_code = KSFT_FAIL;
+               _exit(_metadata->exit_code);
                return;
        }
        EXPECT_EQ(0, close(pipe_parent[0]));
-- 
2.56.0


Reply via email to