Skip to content

Commit 769e637

Browse files
beaubelgraverostedt
authored andcommitted
selftests/user_events: Test struct size match cases
The self tests for user_events currently does not ensure that the edge case for struct types work properly with size differences. Add cases for mis-matching struct names and sizes to ensure they work properly. Link: https://lkml.kernel.org/r/[email protected] Cc: Shuah Khan <[email protected]> Cc: [email protected] Signed-off-by: Beau Belgrave <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent d0a3022 commit 769e637

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tools/testing/selftests/user_events/dyn_test.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,18 @@ TEST_F(user, matching) {
217217
/* Types don't match */
218218
TEST_NMATCH("__test_event u64 a; u64 b",
219219
"__test_event u32 a; u32 b");
220+
221+
/* Struct name and size matches */
222+
TEST_MATCH("__test_event struct my_struct a 20",
223+
"__test_event struct my_struct a 20");
224+
225+
/* Struct name don't match */
226+
TEST_NMATCH("__test_event struct my_struct a 20",
227+
"__test_event struct my_struct b 20");
228+
229+
/* Struct size don't match */
230+
TEST_NMATCH("__test_event struct my_struct a 20",
231+
"__test_event struct my_struct a 21");
220232
}
221233

222234
int main(int argc, char **argv)

0 commit comments

Comments
 (0)