Skip to content

Commit 78490b7

Browse files
beaubelgraverostedt
authored andcommitted
selftests/user_events: Add non-spacing separator check
The ABI documentation indicates that field separators do not need a space between them, only a ';'. When no spacing is used, the register must work. Any subsequent register, with or without spaces, must match and not return -EADDRINUSE. Add a non-spacing separator case to our self-test register case to ensure it works going forward. Link: https://lore.kernel.org/linux-trace-kernel/20240423162338.292-3-beaub@linux.microsoft.com Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent bd125a0 commit 78490b7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tools/testing/selftests/user_events/ftrace_test.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,12 @@ TEST_F(user, register_events) {
261261
ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSREG, &reg));
262262
ASSERT_EQ(0, reg.write_index);
263263

264+
/* Register without separator spacing should still match */
265+
reg.enable_bit = 29;
266+
reg.name_args = (__u64)"__test_event u32 field1;u32 field2";
267+
ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSREG, &reg));
268+
ASSERT_EQ(0, reg.write_index);
269+
264270
/* Multiple registers to same name but different args should fail */
265271
reg.enable_bit = 29;
266272
reg.name_args = (__u64)"__test_event u32 field1;";
@@ -288,6 +294,8 @@ TEST_F(user, register_events) {
288294
ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSUNREG, &unreg));
289295
unreg.disable_bit = 30;
290296
ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSUNREG, &unreg));
297+
unreg.disable_bit = 29;
298+
ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSUNREG, &unreg));
291299

292300
/* Delete should have been auto-done after close and unregister */
293301
close(self->data_fd);

0 commit comments

Comments
 (0)