summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/seccomp
diff options
context:
space:
mode:
authorTycho Andersen <tycho@tycho.ws>2019-01-19 01:12:12 +0100
committerShuah Khan <shuah@kernel.org>2019-02-13 16:34:16 +0100
commitfb024a07c69f81e97f3fd252b9102f5816066884 (patch)
treeaf1ac0dceeae819bcbd0a0572f86fa1d77945d7a /tools/testing/selftests/seccomp
parentLinux 5.0-rc6 (diff)
downloadlinux-fb024a07c69f81e97f3fd252b9102f5816066884.tar.xz
linux-fb024a07c69f81e97f3fd252b9102f5816066884.zip
selftests: don't kill child immediately in get_metadata() test
This this test forks a child, and then the parent waits for a write() to a pipe signalling the child is ready to be attached to. If something in the child ASSERTs before it does this write, the test will hang waiting for it. Instead, let's EXPECT, so that execution continues until we do the write. Any failure after that is fine and can ASSERT. Signed-off-by: Tycho Andersen <tycho@tycho.ws> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Shuah Khan <shuah@kernel.org>
Diffstat (limited to 'tools/testing/selftests/seccomp')
-rw-r--r--tools/testing/selftests/seccomp/seccomp_bpf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 7e632b465ab4..e67395f08cd9 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -2985,11 +2985,11 @@ TEST(get_metadata)
};
/* one with log, one without */
- ASSERT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER,
+ EXPECT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER,
SECCOMP_FILTER_FLAG_LOG, &prog));
- ASSERT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER, 0, &prog));
+ EXPECT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER, 0, &prog));
- ASSERT_EQ(0, close(pipefd[0]));
+ EXPECT_EQ(0, close(pipefd[0]));
ASSERT_EQ(1, write(pipefd[1], "1", 1));
ASSERT_EQ(0, close(pipefd[1]));