aboutsummaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorGravatar Beau Belgrave <beaub@linux.microsoft.com> 2023-06-29 23:50:49 +0000
committerGravatar Steven Rostedt (Google) <rostedt@goodmis.org> 2023-07-12 12:04:47 -0400
commit769e637276c294c2254f698e6a57eda771deb3f7 (patch)
tree21ec668929dddb46e21d87558d36f493f9b7b7d1 /tools/testing
parenttracing/user_events: Fix struct arg size match check (diff)
downloadlinux-769e637276c294c2254f698e6a57eda771deb3f7.tar.gz
linux-769e637276c294c2254f698e6a57eda771deb3f7.tar.bz2
linux-769e637276c294c2254f698e6a57eda771deb3f7.zip
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/20230629235049.581-3-beaub@linux.microsoft.com Cc: Shuah Khan <skhan@linuxfoundation.org> Cc: linux-kselftest@vger.kernel.org Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/user_events/dyn_test.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/testing/selftests/user_events/dyn_test.c b/tools/testing/selftests/user_events/dyn_test.c
index d6979a48478f..91a4444ad42b 100644
--- a/tools/testing/selftests/user_events/dyn_test.c
+++ b/tools/testing/selftests/user_events/dyn_test.c
@@ -217,6 +217,18 @@ TEST_F(user, matching) {
/* Types don't match */
TEST_NMATCH("__test_event u64 a; u64 b",
"__test_event u32 a; u32 b");
+
+ /* Struct name and size matches */
+ TEST_MATCH("__test_event struct my_struct a 20",
+ "__test_event struct my_struct a 20");
+
+ /* Struct name don't match */
+ TEST_NMATCH("__test_event struct my_struct a 20",
+ "__test_event struct my_struct b 20");
+
+ /* Struct size don't match */
+ TEST_NMATCH("__test_event struct my_struct a 20",
+ "__test_event struct my_struct a 21");
}
int main(int argc, char **argv)