File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
tools/testing/selftests/user_events Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,32 @@ static int get_offset(void)
81
81
return offset ;
82
82
}
83
83
84
+ static int clear (int * check )
85
+ {
86
+ struct user_unreg unreg = {0 };
87
+
88
+ unreg .size = sizeof (unreg );
89
+ unreg .disable_bit = 31 ;
90
+ unreg .disable_addr = (__u64 )check ;
91
+
92
+ int fd = open (data_file , O_RDWR );
93
+
94
+ if (fd == -1 )
95
+ return -1 ;
96
+
97
+ if (ioctl (fd , DIAG_IOCSUNREG , & unreg ) == -1 )
98
+ if (errno != ENOENT )
99
+ return -1 ;
100
+
101
+ if (ioctl (fd , DIAG_IOCSDEL , "__test_event" ) == -1 )
102
+ if (errno != ENOENT )
103
+ return -1 ;
104
+
105
+ close (fd );
106
+
107
+ return 0 ;
108
+ }
109
+
84
110
FIXTURE (user ) {
85
111
int data_fd ;
86
112
int check ;
@@ -93,6 +119,9 @@ FIXTURE_SETUP(user) {
93
119
94
120
FIXTURE_TEARDOWN (user ) {
95
121
close (self -> data_fd );
122
+
123
+ if (clear (& self -> check ) != 0 )
124
+ printf ("WARNING: Clear didn't work!\n" );
96
125
}
97
126
98
127
TEST_F (user , perf_write ) {
You can’t perform that action at this time.
0 commit comments