Lines Matching +full:reg +full:- +full:spacing
1 // SPDX-License-Identifier: GPL-2.0
33 if (fd == -1) in trace_bytes()
34 return -1; in trace_bytes()
39 if (got == -1) in trace_bytes()
40 return -1; in trace_bytes()
69 return -1; in skip_until_empty_line()
78 return -1; in get_print_fmt()
103 return -1; in get_print_fmt()
113 if (fd == -1) in wait_for_delete()
134 if (fd == -1) in clear()
135 return -1; in clear()
137 if (ioctl(fd, DIAG_IOCSUNREG, &unreg) == -1) in clear()
141 if (ioctl(fd, DIAG_IOCSDEL, "__test_event") == -1) { in clear()
155 return -1; in clear()
160 struct user_reg reg = {0}; in check_print_fmt() local
173 if (fd == -1) in check_print_fmt()
176 reg.size = sizeof(reg); in check_print_fmt()
177 reg.name_args = (__u64)event; in check_print_fmt()
178 reg.enable_bit = 31; in check_print_fmt()
179 reg.enable_addr = (__u64)check; in check_print_fmt()
180 reg.enable_size = sizeof(*check); in check_print_fmt()
183 ret = ioctl(fd, DIAG_IOCSREG, ®); in check_print_fmt()
187 printf("Reg failed in fmt\n"); in check_print_fmt()
211 USER_EVENT_FIXTURE_SETUP(return, self->umount); in FIXTURE_SETUP()
213 self->status_fd = open(status_file, O_RDONLY); in FIXTURE_SETUP()
214 ASSERT_NE(-1, self->status_fd); in FIXTURE_SETUP()
216 self->data_fd = open(data_file, O_RDWR); in FIXTURE_SETUP()
217 ASSERT_NE(-1, self->data_fd); in FIXTURE_SETUP()
219 self->enable_fd = -1; in FIXTURE_SETUP()
223 USER_EVENT_FIXTURE_TEARDOWN(self->umount); in FIXTURE_TEARDOWN()
225 close(self->status_fd); in FIXTURE_TEARDOWN()
226 close(self->data_fd); in FIXTURE_TEARDOWN()
228 if (self->enable_fd != -1) { in FIXTURE_TEARDOWN()
229 write(self->enable_fd, "0", sizeof("0")); in FIXTURE_TEARDOWN()
230 close(self->enable_fd); in FIXTURE_TEARDOWN()
233 if (clear(&self->check) != 0) in FIXTURE_TEARDOWN()
238 struct user_reg reg = {0}; in TEST_F() local
241 reg.size = sizeof(reg); in TEST_F()
242 reg.name_args = (__u64)"__test_event u32 field1; u32 field2"; in TEST_F()
243 reg.enable_bit = 31; in TEST_F()
244 reg.enable_addr = (__u64)&self->check; in TEST_F()
245 reg.enable_size = sizeof(self->check); in TEST_F()
249 unreg.disable_addr = (__u64)&self->check; in TEST_F()
252 ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSREG, ®)); in TEST_F()
253 ASSERT_EQ(0, reg.write_index); in TEST_F()
256 ASSERT_EQ(-1, ioctl(self->data_fd, DIAG_IOCSREG, ®)); in TEST_F()
260 reg.enable_bit = 30; in TEST_F()
261 ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSREG, ®)); in TEST_F()
262 ASSERT_EQ(0, reg.write_index); in TEST_F()
264 /* Register without separator spacing should still match */ in TEST_F()
265 reg.enable_bit = 29; in TEST_F()
266 reg.name_args = (__u64)"__test_event u32 field1;u32 field2"; in TEST_F()
267 ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSREG, ®)); in TEST_F()
268 ASSERT_EQ(0, reg.write_index); in TEST_F()
271 reg.enable_bit = 29; in TEST_F()
272 reg.name_args = (__u64)"__test_event u32 field1;"; in TEST_F()
273 ASSERT_EQ(-1, ioctl(self->data_fd, DIAG_IOCSREG, ®)); in TEST_F()
277 self->enable_fd = open(enable_file, O_RDWR); in TEST_F()
278 ASSERT_NE(-1, self->enable_fd); in TEST_F()
279 ASSERT_NE(-1, write(self->enable_fd, "0", sizeof("0"))) in TEST_F()
282 ASSERT_NE(-1, write(self->enable_fd, "1", sizeof("1"))) in TEST_F()
283 ASSERT_EQ(1 << reg.enable_bit, self->check); in TEST_F()
286 ASSERT_NE(-1, write(self->enable_fd, "0", sizeof("0"))) in TEST_F()
287 ASSERT_EQ(0, self->check); in TEST_F()
289 /* File still open should return -EBUSY for delete */ in TEST_F()
290 ASSERT_EQ(-1, ioctl(self->data_fd, DIAG_IOCSDEL, "__test_event")); in TEST_F()
294 ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSUNREG, &unreg)); in TEST_F()
296 ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSUNREG, &unreg)); in TEST_F()
298 ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSUNREG, &unreg)); in TEST_F()
300 /* Delete should have been auto-done after close and unregister */ in TEST_F()
301 close(self->data_fd); in TEST_F()
307 struct user_reg reg = {0}; in TEST_F() local
312 reg.size = sizeof(reg); in TEST_F()
313 reg.name_args = (__u64)"__test_event u32 field1; u32 field2"; in TEST_F()
314 reg.enable_bit = 31; in TEST_F()
315 reg.enable_addr = (__u64)&self->check; in TEST_F()
316 reg.enable_size = sizeof(self->check); in TEST_F()
321 io[0].iov_base = ®.write_index; in TEST_F()
322 io[0].iov_len = sizeof(reg.write_index); in TEST_F()
329 ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSREG, ®)); in TEST_F()
330 ASSERT_EQ(0, reg.write_index); in TEST_F()
331 ASSERT_EQ(0, self->check); in TEST_F()
336 ASSERT_EQ(-1, writev(self->data_fd, (const struct iovec *)io, 3)); in TEST_F()
338 io[0].iov_base = ®.write_index; in TEST_F()
339 io[0].iov_len = sizeof(reg.write_index); in TEST_F()
341 /* Write should return -EBADF when event is not enabled */ in TEST_F()
342 ASSERT_EQ(-1, writev(self->data_fd, (const struct iovec *)io, 3)); in TEST_F()
346 self->enable_fd = open(enable_file, O_RDWR); in TEST_F()
347 ASSERT_NE(-1, write(self->enable_fd, "1", sizeof("1"))) in TEST_F()
350 ASSERT_NE(1 << reg.enable_bit, self->check); in TEST_F()
354 ASSERT_NE(-1, writev(self->data_fd, (const struct iovec *)io, 3)); in TEST_F()
359 reg.write_index = -1; in TEST_F()
360 ASSERT_EQ(-1, writev(self->data_fd, (const struct iovec *)io, 3)); in TEST_F()
365 struct user_reg reg = {0}; in TEST_F() local
369 reg.size = sizeof(reg); in TEST_F()
370 reg.name_args = (__u64)"__test_event"; in TEST_F()
371 reg.enable_bit = 31; in TEST_F()
372 reg.enable_addr = (__u64)&self->check; in TEST_F()
373 reg.enable_size = sizeof(self->check); in TEST_F()
375 io[0].iov_base = ®.write_index; in TEST_F()
376 io[0].iov_len = sizeof(reg.write_index); in TEST_F()
379 ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSREG, ®)); in TEST_F()
380 ASSERT_EQ(0, reg.write_index); in TEST_F()
381 ASSERT_EQ(0, self->check); in TEST_F()
384 self->enable_fd = open(enable_file, O_RDWR); in TEST_F()
385 ASSERT_NE(-1, write(self->enable_fd, "1", sizeof("1"))) in TEST_F()
388 ASSERT_EQ(1 << reg.enable_bit, self->check); in TEST_F()
392 ASSERT_NE(-1, writev(self->data_fd, (const struct iovec *)io, 1)); in TEST_F()
398 struct user_reg reg = {0}; in TEST_F() local
403 reg.size = sizeof(reg); in TEST_F()
404 reg.name_args = (__u64)"__test_event u64 anon"; in TEST_F()
405 reg.enable_bit = 31; in TEST_F()
406 reg.enable_addr = (__u64)&self->check; in TEST_F()
407 reg.enable_size = sizeof(self->check); in TEST_F()
409 anon = mmap(NULL, l, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); in TEST_F()
412 io[0].iov_base = ®.write_index; in TEST_F()
413 io[0].iov_len = sizeof(reg.write_index); in TEST_F()
418 ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSREG, ®)); in TEST_F()
419 ASSERT_EQ(0, reg.write_index); in TEST_F()
422 self->enable_fd = open(enable_file, O_RDWR); in TEST_F()
423 ASSERT_NE(-1, write(self->enable_fd, "1", sizeof("1"))) in TEST_F()
426 ASSERT_NE(-1, writev(self->data_fd, (const struct iovec *)io, 2)); in TEST_F()
430 ASSERT_NE(-1, writev(self->data_fd, (const struct iovec *)io, 2)); in TEST_F()
435 struct user_reg reg = {0}; in TEST_F() local
441 reg.size = sizeof(reg); in TEST_F()
442 reg.name_args = (__u64)"__test_event __rel_loc char[] data"; in TEST_F()
443 reg.enable_bit = 31; in TEST_F()
444 reg.enable_addr = (__u64)&self->check; in TEST_F()
445 reg.enable_size = sizeof(self->check); in TEST_F()
448 ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSREG, ®)); in TEST_F()
449 ASSERT_EQ(0, reg.write_index); in TEST_F()
450 ASSERT_EQ(0, self->check); in TEST_F()
452 io[0].iov_base = ®.write_index; in TEST_F()
453 io[0].iov_len = sizeof(reg.write_index); in TEST_F()
461 ASSERT_EQ(-1, writev(self->data_fd, (const struct iovec *)io, 1)); in TEST_F()
465 self->enable_fd = open(enable_file, O_RDWR); in TEST_F()
466 ASSERT_NE(-1, write(self->enable_fd, "1", sizeof("1"))) in TEST_F()
469 ASSERT_EQ(1 << reg.enable_bit, self->check); in TEST_F()
471 /* Full in-bounds write should work */ in TEST_F()
474 ASSERT_NE(-1, writev(self->data_fd, (const struct iovec *)io, 3)); in TEST_F()
480 ASSERT_EQ(-1, writev(self->data_fd, (const struct iovec *)io, 3)); in TEST_F()
485 ASSERT_EQ(-1, writev(self->data_fd, (const struct iovec *)io, 3)); in TEST_F()
490 ASSERT_EQ(-1, writev(self->data_fd, (const struct iovec *)io, 3)); in TEST_F()
495 ASSERT_EQ(-1, writev(self->data_fd, (const struct iovec *)io, 3)); in TEST_F()
498 /* Non-Null should fault */ in TEST_F()
501 ASSERT_EQ(-1, writev(self->data_fd, (const struct iovec *)io, 3)); in TEST_F()
510 &self->check); in TEST_F()
515 &self->check); in TEST_F()
519 "print fmt: \"data=%lld\", REC->data", in TEST_F()
520 &self->check); in TEST_F()
524 "print fmt: \"data=%llu\", REC->data", in TEST_F()
525 &self->check); in TEST_F()
529 "print fmt: \"data=%d\", REC->data", in TEST_F()
530 &self->check); in TEST_F()
534 "print fmt: \"data=%u\", REC->data", in TEST_F()
535 &self->check); in TEST_F()
539 "print fmt: \"data=%d\", REC->data", in TEST_F()
540 &self->check); in TEST_F()
544 "print fmt: \"data=%u\", REC->data", in TEST_F()
545 &self->check); in TEST_F()
549 "print fmt: \"data=%d\", REC->data", in TEST_F()
550 &self->check); in TEST_F()
554 "print fmt: \"data=%u\", REC->data", in TEST_F()
555 &self->check); in TEST_F()
559 "print fmt: \"data=%d\", REC->data", in TEST_F()
560 &self->check); in TEST_F()
564 "print fmt: \"data=%u\", REC->data", in TEST_F()
565 &self->check); in TEST_F()
569 "print fmt: \"data=%d\", REC->data", in TEST_F()
570 &self->check); in TEST_F()
574 "print fmt: \"data=%u\", REC->data", in TEST_F()
575 &self->check); in TEST_F()
579 "print fmt: \"data=%d\", REC->data", in TEST_F()
580 &self->check); in TEST_F()
584 "print fmt: \"data=%u\", REC->data", in TEST_F()
585 &self->check); in TEST_F()
589 "print fmt: \"data=%s\", REC->data", in TEST_F()
590 &self->check); in TEST_F()