mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-09 08:18:02 +02:00
test: use a litest helper instead of return code comparison
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
This commit is contained in:
parent
d010c6a170
commit
fb4c5dd7c6
1 changed files with 6 additions and 6 deletions
|
|
@ -363,7 +363,7 @@ grab_device(struct litest_device *device, bool mode)
|
||||||
list_for_each(p, &ctx->paths, link) {
|
list_for_each(p, &ctx->paths, link) {
|
||||||
if (streq(p->path, devnode)) {
|
if (streq(p->path, devnode)) {
|
||||||
int rc = ioctl(p->fd, EVIOCGRAB, (void*)mode ? 1 : 0);
|
int rc = ioctl(p->fd, EVIOCGRAB, (void*)mode ? 1 : 0);
|
||||||
litest_assert_int_gt(rc, -1);
|
litest_assert_errno_success(rc);
|
||||||
udev_device_unref(udev_device);
|
udev_device_unref(udev_device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1435,7 +1435,7 @@ litest_copy_file(const char *dest, const char *src, const char *header, bool is_
|
||||||
litest_abort_msg("Failed to write to file %s (%s)",
|
litest_abort_msg("Failed to write to file %s (%s)",
|
||||||
file->path,
|
file->path,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
litest_assert_int_ne(chmod(file->path, 0644), -1);
|
litest_assert_errno_success(chmod(file->path, 0644));
|
||||||
|
|
||||||
if (header) {
|
if (header) {
|
||||||
length = strlen(header);
|
length = strlen(header);
|
||||||
|
|
@ -1518,7 +1518,7 @@ litest_init_device_quirk_file(const char *data_dir,
|
||||||
++count,
|
++count,
|
||||||
dev->shortname);
|
dev->shortname);
|
||||||
fd = open(path, O_CREAT|O_WRONLY, 0644);
|
fd = open(path, O_CREAT|O_WRONLY, 0644);
|
||||||
litest_assert_int_ne(fd, -1);
|
litest_assert_errno_success(fd);
|
||||||
f = fdopen(fd, "w");
|
f = fdopen(fd, "w");
|
||||||
litest_assert_notnull(f);
|
litest_assert_notnull(f);
|
||||||
litest_assert_int_ge(fputs(dev->quirk_file, f), 0);
|
litest_assert_int_ge(fputs(dev->quirk_file, f), 0);
|
||||||
|
|
@ -1603,7 +1603,7 @@ litest_setup_quirks(struct list *created_files_list,
|
||||||
break;
|
break;
|
||||||
case QUIRKS_SETUP_FULL:
|
case QUIRKS_SETUP_FULL:
|
||||||
litest_assert_notnull(mkdtemp(tmpdir));
|
litest_assert_notnull(mkdtemp(tmpdir));
|
||||||
litest_assert_int_ne(chmod(tmpdir, 0755), -1);
|
litest_assert_errno_success(chmod(tmpdir, 0755));
|
||||||
file = zalloc(sizeof *file);
|
file = zalloc(sizeof *file);
|
||||||
file->path = safe_strdup(tmpdir);
|
file->path = safe_strdup(tmpdir);
|
||||||
dirname = tmpdir;
|
dirname = tmpdir;
|
||||||
|
|
@ -1716,7 +1716,7 @@ litest_create(enum litest_device_type which,
|
||||||
path = libevdev_uinput_get_devnode(d->uinput);
|
path = libevdev_uinput_get_devnode(d->uinput);
|
||||||
litest_assert_ptr_notnull(path);
|
litest_assert_ptr_notnull(path);
|
||||||
fd = open(path, O_RDWR|O_NONBLOCK);
|
fd = open(path, O_RDWR|O_NONBLOCK);
|
||||||
litest_assert_int_ne(fd, -1);
|
litest_assert_errno_success(fd);
|
||||||
|
|
||||||
rc = libevdev_new_from_fd(fd, &d->evdev);
|
rc = libevdev_new_from_fd(fd, &d->evdev);
|
||||||
litest_assert_neg_errno_success(rc);
|
litest_assert_neg_errno_success(rc);
|
||||||
|
|
@ -1902,7 +1902,7 @@ udev_setup_monitor(void)
|
||||||
|
|
||||||
/* remove O_NONBLOCK */
|
/* remove O_NONBLOCK */
|
||||||
rc = fcntl(udev_monitor_get_fd(udev_monitor), F_SETFL, 0);
|
rc = fcntl(udev_monitor_get_fd(udev_monitor), F_SETFL, 0);
|
||||||
litest_assert_int_ne(rc, -1);
|
litest_assert_errno_success(rc);
|
||||||
litest_assert_int_eq(udev_monitor_enable_receiving(udev_monitor),
|
litest_assert_int_eq(udev_monitor_enable_receiving(udev_monitor),
|
||||||
0);
|
0);
|
||||||
udev_unref(udev);
|
udev_unref(udev);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue