Skip to content

Commit d34a271

Browse files
sunlimingrostedt
authored andcommitted
selftests/user_events: Add test cases when event is disabled
When user_events are disabled, it's write operation should return -EBADF. Add this test cases. Link: https://lkml.kernel.org/r/[email protected] Acked-by: Beau Belgrave <[email protected]> Signed-off-by: sunliming <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent c27b40c commit d34a271

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tools/testing/selftests/user_events/ftrace_test.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,10 @@ TEST_F(user, write_events) {
324324
io[0].iov_base = &reg.write_index;
325325
io[0].iov_len = sizeof(reg.write_index);
326326

327+
/* Write should return -EBADF when event is not enabled */
328+
ASSERT_EQ(-1, writev(self->data_fd, (const struct iovec *)io, 3));
329+
ASSERT_EQ(EBADF, errno);
330+
327331
/* Enable event */
328332
self->enable_fd = open(enable_file, O_RDWR);
329333
ASSERT_NE(-1, write(self->enable_fd, "1", sizeof("1")))

0 commit comments

Comments
 (0)