Adding 2 more tests for fentry probe test,
to show/test ftrace probe.

Signed-off-by: Jiri Olsa <jo...@kernel.org>
---
 .../selftests/bpf/prog_tests/fentry_test.c       |  5 ++++-
 tools/testing/selftests/bpf/progs/fentry_test.c  | 16 ++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/fentry_test.c 
b/tools/testing/selftests/bpf/prog_tests/fentry_test.c
index 04ebbf1cb390..70f414cb3bfd 100644
--- a/tools/testing/selftests/bpf/prog_tests/fentry_test.c
+++ b/tools/testing/selftests/bpf/prog_tests/fentry_test.c
@@ -26,12 +26,15 @@ void test_fentry_test(void)
              err, errno, retval, duration);
 
        result = (__u64 *)fentry_skel->bss;
-       for (i = 0; i < 6; i++) {
+       for (i = 0; i < 8; i++) {
                if (CHECK(result[i] != 1, "result",
                          "fentry_test%d failed err %lld\n", i + 1, result[i]))
                        goto cleanup;
        }
 
+       ASSERT_EQ(result[8], 8, "result");
+       ASSERT_EQ(result[9], 2, "result");
+
 cleanup:
        fentry_test__destroy(fentry_skel);
 }
diff --git a/tools/testing/selftests/bpf/progs/fentry_test.c 
b/tools/testing/selftests/bpf/progs/fentry_test.c
index 52a550d281d9..b32b589923a4 100644
--- a/tools/testing/selftests/bpf/progs/fentry_test.c
+++ b/tools/testing/selftests/bpf/progs/fentry_test.c
@@ -77,3 +77,19 @@ int BPF_PROG(test8, struct bpf_fentry_test_t *arg)
                test8_result = 1;
        return 0;
 }
+
+__u64 test9_result = 0;
+SEC("fentry.ftrace/bpf_fentry_test*")
+int BPF_PROG(test9)
+{
+       test9_result++;
+       return 0;
+}
+
+__u64 test10_result = 0;
+SEC("fentry.ftrace/bpf_fentry_test1|bpf_fentry_test2")
+int BPF_PROG(test10)
+{
+       test10_result++;
+       return 0;
+}
-- 
2.30.2

Reply via email to