[for-linus][PATCH 2/3] selftests/user_events: Enable the event before write_fault test in ftrace self-test

From: Steven Rostedt
Date: Thu Jun 22 2023 - 21:33:53 EST


From: sunliming <sunliming@xxxxxxxxxx>

The user_event has not been enabled in write_fault test in ftrace
self-test, Just enable it.

Link: https://lkml.kernel.org/r/20230621063438.154271-1-sunliming@xxxxxxxxxx

Signed-off-by: sunliming <sunliming@xxxxxxxxxx>
Acked-by: Beau Belgrave <beaub@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
---
tools/testing/selftests/user_events/ftrace_test.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/user_events/ftrace_test.c b/tools/testing/selftests/user_events/ftrace_test.c
index eb6904d89f14..88898749e5b7 100644
--- a/tools/testing/selftests/user_events/ftrace_test.c
+++ b/tools/testing/selftests/user_events/ftrace_test.c
@@ -400,6 +400,10 @@ TEST_F(user, write_fault) {
ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSREG, &reg));
ASSERT_EQ(0, reg.write_index);

+ /* Enable event */
+ self->enable_fd = open(enable_file, O_RDWR);
+ ASSERT_NE(-1, write(self->enable_fd, "1", sizeof("1")))
+
/* Write should work normally */
ASSERT_NE(-1, writev(self->data_fd, (const struct iovec *)io, 2));

--
2.39.2