aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/test_progs.c
diff options
context:
space:
mode:
authorHou Tao <houtao1@huawei.com>2021-10-04 17:48:57 +0800
committerAndrii Nakryiko <andrii@kernel.org>2021-10-08 13:22:57 -0700
commitfa7f17d066bd0996b930b664aa0ed1f213fc1828 (patch)
treee2abd0f4d04594fc4204db299cb5b74be0d222f8 /tools/testing/selftests/bpf/test_progs.c
parentlibbpf: Support detecting and attaching of writable tracepoint program (diff)
downloadlinux-dev-fa7f17d066bd0996b930b664aa0ed1f213fc1828.tar.xz
linux-dev-fa7f17d066bd0996b930b664aa0ed1f213fc1828.zip
bpf/selftests: Add test for writable bare tracepoint
Add a writable bare tracepoint in bpf_testmod module, and trigger its calling when reading /sys/kernel/bpf_testmod with a specific buffer length. The reading will return the value in writable context if the early return flag is enabled in writable context. Signed-off-by: Hou Tao <houtao1@huawei.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20211004094857.30868-4-hotforest@gmail.com
Diffstat (limited to 'tools/testing/selftests/bpf/test_progs.c')
-rw-r--r--tools/testing/selftests/bpf/test_progs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index 2ed01f615d20..007b4ff85fea 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -747,7 +747,7 @@ int trigger_module_test_read(int read_sz)
{
int fd, err;
- fd = open("/sys/kernel/bpf_testmod", O_RDONLY);
+ fd = open(BPF_TESTMOD_TEST_FILE, O_RDONLY);
err = -errno;
if (!ASSERT_GE(fd, 0, "testmod_file_open"))
return err;
@@ -769,7 +769,7 @@ int trigger_module_test_write(int write_sz)
memset(buf, 'a', write_sz);
buf[write_sz-1] = '\0';
- fd = open("/sys/kernel/bpf_testmod", O_WRONLY);
+ fd = open(BPF_TESTMOD_TEST_FILE, O_WRONLY);
err = -errno;
if (!ASSERT_GE(fd, 0, "testmod_file_open")) {
free(buf);