Skip to contentSkip to conversation

Rewrite input testing suite

PATCH Applied Andrea Cervesato 4 participants 12 messages Dec 2, 2024 – Dec 3, 2024

lore
Share & tools
lore
#0 lore raw

v2 cover Rewrite input testing suite

Cleanup of the input testing suite, using new LTP API and changing the way we are obtaining information from input devices. Usage of the tst_uinput.h utilities, rewritten input helper and simplified the source code.

---
Changes in v2:
- use checkpoint in input03
- move check_ui_get_sysname_ioctl() in tst_uinput.h
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Andrea Cervesato (7):
Refactor input01 test
Refactor input02 test
Refactor input03 test
Refactor input04 test
Refactor input05 test
Refactor input06 test
Delete depreacted input test suite helper

 libs/uinput/tst_uinput.c              |  26 ++-
 testcases/kernel/input/Makefile       |   6 +-
 testcases/kernel/input/input01.c      | 205 +++++-----------------
 testcases/kernel/input/input02.c      | 132 ++++++--------
 testcases/kernel/input/input03.c      | 176 ++++++++-----------
 testcases/kernel/input/input04.c      | 113 ++++--------
 testcases/kernel/input/input05.c      | 119 ++++---------
 testcases/kernel/input/input06.c      | 190 +++++++++------------
 testcases/kernel/input/input_common.h |  97 +++++++++++
 testcases/kernel/input/input_helper.c | 313 ----------------------------------
 testcases/kernel/input/input_helper.h |  36 ----
 11 files changed, 443 insertions(+), 970 deletions(-)

---
base-commit: ec4161186e51b55d4faaa394dc4607200cb30f68
change-id: 20241113-input_refactoring-16aea13ed7b8

Best regards,

Signature · 5 lines
Andrea Cervesato <[email protected]>


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

PATCH v2 1/7 Refactor input01 test

From: Andrea Cervesato <[email protected]>

---
 libs/uinput/tst_uinput.c              |  26 ++++-
 testcases/kernel/input/Makefile       |   5 +-
 testcases/kernel/input/input01.c      | 205 ++++++++--------------------------
 testcases/kernel/input/input_common.h |  97 ++++++++++++++++
 4 files changed, 173 insertions(+), 160 deletions(-)
libs/uinput/tst_uinput.c +25 -1
index 6dc8a7d4ec41f1c53eb675c894cdcd059ee1198a..36f3d5e2759bc13c5ae989799741bbd288a2c234 100644
@@ -13,6 +13,7 @@
 #include "tst_test.h"
 
 #include "tst_uinput.h"
+#include "tst_safe_stdio.h"
 
 #define VIRTUAL_DEVICE "virtual-device-ltp"
 
@@ -127,6 +128,27 @@ void destroy_input_device(int fd)
 	SAFE_CLOSE(fd);
 }
 
+static void check_ui_get_sysname_ioctl(int fd)
+{
+	char sys_name[256];
+	char dev_name[256];
+	char *path;
+
+	SAFE_IOCTL(fd, UI_GET_SYSNAME(sizeof(sys_name)), sys_name, NULL);
+	SAFE_ASPRINTF(&path, "/sys/devices/virtual/input/%s/name", sys_name);
+
+	if (FILE_SCANF(path, "%s", dev_name)) {
+		tst_brk(TBROK|TERRNO, "Failed to read '%s'", path);
+		free(path);
+		return;
+	}
+
+	if (strcmp(VIRTUAL_DEVICE, dev_name))
+		tst_brk(TBROK, "ioctl UI_GET_SYSNAME returned wrong name");
+
+	free(path);
+}
+
 void create_input_device(int fd)
 {
 	int nb;
@@ -144,8 +166,10 @@ void create_input_device(int fd)
 	SAFE_IOCTL(fd, UI_DEV_CREATE, NULL);
 
 	for (nb = 100; nb > 0; nb--) {
-		if (check_device())
+		if (check_device()) {
+			check_ui_get_sysname_ioctl(fd);
 			return;
+		}
 		usleep(10000);
 	}
 
testcases/kernel/input/Makefile +4 -1
index 032254444e1a1e5d53e3299dfe5d7e4cba6a5162..e686005c69da8b83d954da754b2e5db93ae89da7 100644
@@ -3,10 +3,13 @@
 
 top_srcdir			?= ../../..
 
+LTPLIBS = uinput
+
 include $(top_srcdir)/include/mk/testcases.mk
 
 FILTER_OUT_MAKE_TARGETS		:= input_helper
+input01: LDLIBS += -lltpuinput
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: input_helper.o
+input02 input03 input04 input05 input06: %: input_helper.o
testcases/kernel/input/input01.c +47 -158

234 lines not on this page · raw message

testcases/kernel/input/input_common.h new file +97 -0

97 lines not on this page · raw message

Signature · 5 lines
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v2 1/7
#2 lore raw

Re: [LTP] [PATCH v2 1/7] Refactor input01 test

Hi Andrea,

I would mention adding a check of the device name in /sys/devices create_input_device(), because that modifies also a different test (../uevents/uevent03.c).

Quoted 6 lines
---
 libs/uinput/tst_uinput.c              |  26 ++++-
 testcases/kernel/input/Makefile       |   5 +-
 testcases/kernel/input/input01.c      | 205 ++++++++--------------------------
 testcases/kernel/input/input_common.h |  97 ++++++++++++++++
 4 files changed, 173 insertions(+), 160 deletions(-)

...

libs/uinput/tst_uinput.c void destroy_input_device(int fd) · line 142

Quoted 12 lines
libs/uinput/tst_uinput.c +12 -0
+static void check_ui_get_sysname_ioctl(int fd)
+{
+	char sys_name[256];
+	char dev_name[256];
+	char *path;
+
+	SAFE_IOCTL(fd, UI_GET_SYSNAME(sizeof(sys_name)), sys_name, NULL);
+	SAFE_ASPRINTF(&path, "/sys/devices/virtual/input/%s/name", sys_name);
+
+	if (FILE_SCANF(path, "%s", dev_name)) {
+		tst_brk(TBROK|TERRNO, "Failed to read '%s'", path);
+		free(path);

I guess free(path) here is not needed due exit() via tst_brk() right? And if it's needed, you meant to first free and then tst_brk().

libs/uinput/tst_uinput.c void destroy_input_device(int fd) · line 146

Quoted 4 lines
libs/uinput/tst_uinput.c +4 -0
+		return;
+	}
+
+	if (strcmp(VIRTUAL_DEVICE, dev_name))

And if I'm wrong, then free(path) should be also here.

libs/uinput/tst_uinput.c void destroy_input_device(int fd) · line 147

Quoted 1 line
libs/uinput/tst_uinput.c +1 -0
+		tst_brk(TBROK, "ioctl UI_GET_SYSNAME returned wrong name");

The rest LGTM, nice cleanup (free can be fixed before merge).

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

PATCH v2 2/7 Refactor input02 test

In reply to Andrea Cervesato

From: Andrea Cervesato <[email protected]>

---
 testcases/kernel/input/Makefile  |   4 +-
 testcases/kernel/input/input02.c | 132 +++++++++++++++------------------------
 2 files changed, 54 insertions(+), 82 deletions(-)
testcases/kernel/input/Makefile +2 -2
index e686005c69da8b83d954da754b2e5db93ae89da7..5bc729802d1e302d7d52d71be0b6b22a20efb852 100644
@@ -8,8 +8,8 @@ LTPLIBS = uinput
 include $(top_srcdir)/include/mk/testcases.mk
 
 FILTER_OUT_MAKE_TARGETS		:= input_helper
-input01: LDLIBS += -lltpuinput
+input01 input02: LDLIBS += -lltpuinput
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-input02 input03 input04 input05 input06: %: input_helper.o
+input03 input04 input05 input06: %: input_helper.o
testcases/kernel/input/input02.c +52 -80

158 lines not on this page · raw message

Signature · 5 lines
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

PATCH v2 3/7 Refactor input03 test

In reply to Andrea Cervesato

From: Andrea Cervesato <[email protected]>

---
 testcases/kernel/input/Makefile  |   4 +-
 testcases/kernel/input/input03.c | 176 ++++++++++++++++-----------------------
 2 files changed, 73 insertions(+), 107 deletions(-)
testcases/kernel/input/Makefile +2 -2
index 5bc729802d1e302d7d52d71be0b6b22a20efb852..8c302dbc8c75cf4fd42bc162b4bb8a9882237164 100644
@@ -8,8 +8,8 @@ LTPLIBS = uinput
 include $(top_srcdir)/include/mk/testcases.mk
 
 FILTER_OUT_MAKE_TARGETS		:= input_helper
-input01 input02: LDLIBS += -lltpuinput
+input01 input02 input03: LDLIBS += -lltpuinput
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-input03 input04 input05 input06: %: input_helper.o
+input04 input05 input06: %: input_helper.o
testcases/kernel/input/input03.c +71 -105

216 lines not on this page · raw message

Signature · 5 lines
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw

PATCH v2 4/7 Refactor input04 test

In reply to Andrea Cervesato

From: Andrea Cervesato <[email protected]>

---
 testcases/kernel/input/Makefile  |   4 +-
 testcases/kernel/input/input04.c | 113 ++++++++++++---------------------------
 2 files changed, 35 insertions(+), 82 deletions(-)
testcases/kernel/input/Makefile +2 -2
index 8c302dbc8c75cf4fd42bc162b4bb8a9882237164..cf35e1bfc150a6c1556ef796d4858c0df9020131 100644
@@ -8,8 +8,8 @@ LTPLIBS = uinput
 include $(top_srcdir)/include/mk/testcases.mk
 
 FILTER_OUT_MAKE_TARGETS		:= input_helper
-input01 input02 input03: LDLIBS += -lltpuinput
+input01 input02 input03 input04: LDLIBS += -lltpuinput
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-input04 input05 input06: %: input_helper.o
+input05 input06: %: input_helper.o
testcases/kernel/input/input04.c +33 -80

136 lines not on this page · raw message

Signature · 5 lines
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw

PATCH v2 5/7 Refactor input05 test

In reply to Andrea Cervesato

From: Andrea Cervesato <[email protected]>

---
 testcases/kernel/input/Makefile  |   6 +-
 testcases/kernel/input/input05.c | 119 ++++++++++++---------------------------
 2 files changed, 40 insertions(+), 85 deletions(-)
testcases/kernel/input/Makefile +3 -3
index cf35e1bfc150a6c1556ef796d4858c0df9020131..a37aa28fc27688901e0555a0338395a681b45b39 100644
@@ -8,8 +8,8 @@ LTPLIBS = uinput
 include $(top_srcdir)/include/mk/testcases.mk
 
 FILTER_OUT_MAKE_TARGETS		:= input_helper
-input01 input02 input03 input04: LDLIBS += -lltpuinput
+input01 input02 input03 input04 input05: LDLIBS += -lltpuinput
 
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
+input06: %: input_helper.o
 
-input05 input06: %: input_helper.o
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/input/input05.c +37 -82

144 lines not on this page · raw message

Signature · 5 lines
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#7 lore raw

PATCH v2 6/7 Refactor input06 test

In reply to Andrea Cervesato

From: Andrea Cervesato <[email protected]>

---
 testcases/kernel/input/Makefile  |   5 +-
 testcases/kernel/input/input06.c | 190 ++++++++++++++++-----------------------
 2 files changed, 79 insertions(+), 116 deletions(-)
testcases/kernel/input/Makefile +1 -4
index a37aa28fc27688901e0555a0338395a681b45b39..945299a13bfcecc3eeae029931ef5ae44781b7ad 100644
@@ -7,9 +7,6 @@ LTPLIBS = uinput
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-FILTER_OUT_MAKE_TARGETS		:= input_helper
-input01 input02 input03 input04 input05: LDLIBS += -lltpuinput
-
-input06: %: input_helper.o
+LDLIBS += -lltpuinput
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/input/input06.c +78 -112

274 lines not on this page · raw message

Signature · 5 lines
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#8 lore raw

Re: [LTP] [PATCH v2 6/7] Refactor input06 test

Hi!

testcases/kernel/input/input06.c line 11

Quoted 9 lines

- /*

testcases/kernel/input/input06.c +5 -3
-  *  Create a virtual device, activate auto-repeat and
-  *  and check that auto repeat is working
-  */
+/*\
+ * [Description]
+ *
+ * Verify that auto-repeat is working on a virtual device, that in our case
+ * it's a mouse.

This is wrong, the device is a keyboard with a single key, at least that is what is being constructed in the test setup. The original description was at least correct...

The rest of the conversion looks good.

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#9 lore raw

Re: [LTP] [PATCH v2 6/7] Refactor input06 test

Hi Cyril,

Quoted 10 lines · Cyril Hrubis

Hi!

testcases/kernel/input/input06.c line 11

Quoted 9 lines

- /*

testcases/kernel/input/input06.c +5 -3
-  *  Create a virtual device, activate auto-repeat and
-  *  and check that auto repeat is working
-  */
+/*\
+ * [Description]
+ *
+ * Verify that auto-repeat is working on a virtual device, that in our case
+ * it's a mouse.
Quoted 7 lines

This is wrong, the device is a keyboard with a single key, at least that is what is being constructed in the test setup. The original description was at least correct...

The rest of the conversion looks good.

You are right, my bad. I'm gonna fix it and merge the testing suite.

Regards,
Andrea

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#10 lore raw

PATCH v2 7/7 Delete depreacted input test suite helper

In reply to Andrea Cervesato

From: Andrea Cervesato <[email protected]>

---
 testcases/kernel/input/input_helper.c | 313 ----------------------------------
 testcases/kernel/input/input_helper.h |  36 ----
 2 files changed, 349 deletions(-)
testcases/kernel/input/input_helper.c deleted +0 -313
deleted file mode 100644
index c929de6bab64df49cd48ac6c73b44d26e8f04e96..0000000000000000000000000000000000000000
@@ -1,313 +0,0 @@
-/*
- * Copyright (c) 2015 Cedric Hnyda <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#include <linux/input.h>
-#include <linux/uinput.h>
-#include <fnmatch.h>
-#include <errno.h>
-#include <poll.h>
-
-#include "test.h"
-#include "safe_macros.h"
-#include "input_helper.h"
-#include "lapi/uinput.h"
-
-#define VIRTUAL_DEVICE "virtual-device-ltp"
-
-#define VIRTUAL_DEVICE_REGEX "*virtual-device-ltp*"
-
-static int uinput_loaded;
-static int check_device(void);
-
-static int try_open_device(void)
-{
-	char path[256];
-	char name[256];
-	int ret, fd = -1;
-	unsigned int i;
-
-	for (i = 0; i < 100; i++) {
-		snprintf(path, sizeof(path), "/dev/input/event%i", i);
-
-		fd = open(path, O_RDONLY);
-
-		if (fd < 0 && errno == ENOENT)
-			continue;
-
-		if (fd < 0) {
-			tst_resm(TINFO | TERRNO, "failed to open %s", path);
-			break;
-		}
-
-		ret = ioctl(fd, EVIOCGNAME(sizeof(name)), name);
-		if (ret < 0) {
-			tst_resm(TINFO | TERRNO,
-				"ioctl(%s, EVIOCGNAME(256), ...) failed",
-				path);
-			break;
-		}
-
-		if (strcmp(name, VIRTUAL_DEVICE) == 0)
-			return fd;
-		close(fd);
-	}
-
-	return -1;
-}
-
-int open_device(void)
-{
-	int fd;
-	int retries = 10;
-
-	while (retries--) {
-		fd = try_open_device();
-		if (fd > 0)
-			return fd;
-		tst_resm(TINFO, "Device not found, retrying...");
-		usleep(10000);
-	}
-
-	tst_brkm(TBROK, NULL, "Unable to find the input device");
-}
-
-static int try_load_uinput(void)
-{
-	const char *argv[] = {"modprobe", "uinput", NULL};
-	int ret;
-
-	tst_resm(TINFO, "Trying to load uinput kernel module");
-
-	ret = tst_cmd(NULL, argv, NULL, NULL, TST_CMD_PASS_RETVAL);
-	if (ret) {
-		tst_resm(TINFO, "Failed to load the uinput module");
-		return 0;
-	}
-
-	return 1;
-}
-
-static void unload_uinput(void)
-{
-	const char *argv[] = {"modprobe", "-r", "uinput", NULL};
-	int ret;
-
-	tst_resm(TINFO, "Unloading uinput kernel module");
-
-	ret = tst_cmd(NULL, argv, NULL, NULL, TST_CMD_PASS_RETVAL);
-	if (ret)
-		tst_resm(TWARN, "Failed to unload uinput module");
-}
-
-static const char *uinput_paths[] = {
-	"/dev/input/uinput",
-	"/dev/uinput",
-};
-
-static int try_open_uinput(void)
-{
-	unsigned int i;
-	int fd;
-
-	for (i = 0; i < ARRAY_SIZE(uinput_paths); i++) {
-		fd = open(uinput_paths[i], O_WRONLY | O_NONBLOCK);
-
-		if (fd > 0) {
-			tst_resm(TINFO, "Found uinput dev at %s",
-			         uinput_paths[i]);
-			return fd;
-		}
-
-		if (fd < 0 && errno != ENOENT) {
-			tst_brkm(TBROK | TERRNO, NULL,
-			         "open(%s)", uinput_paths[i]);
-		}
-	}
-
-	return -1;
-}
-
-int open_uinput(void)
-{
-	int fd;
-	int retries = 10;
-
-	fd = try_open_uinput();
-	if (fd > 0)
-		return fd;
-
-	if (try_load_uinput()) {
-		while (retries--) {
-			fd = try_open_uinput();
-			if (fd > 0) {
-				uinput_loaded = 1;
-				return fd;
-			}
-			tst_resm(TINFO, "Uinput dev not found, retrying...");
-			usleep(10000);
-		}
-
-		unload_uinput();
-	}
-
-	tst_brkm(TCONF, NULL, "Unable to find and open uinput");
-}
-
-void send_event(int fd, int event, int code, int value)
-{
-	struct input_event ev = {
-		.type = event,
-		.code = code,
-		.value = value,
-	};
-
-	SAFE_WRITE(NULL, SAFE_WRITE_ALL, fd, &ev, sizeof(ev));
-}
-
-void send_rel_move(int fd, int x, int y)
-{
-	send_event(fd, EV_REL, REL_X, x);
-	send_event(fd, EV_REL, REL_Y, y);
-	send_event(fd, EV_SYN, 0, 0);
-}
-
-static void check_ui_get_sysname_ioctl(int fd)
-{
-	char sys_name[256];
-	char dev_name[256];
-	char *path;
-
-	SAFE_IOCTL(NULL, fd, UI_GET_SYSNAME(sizeof(sys_name)), sys_name, NULL);
-	SAFE_ASPRINTF(NULL, &path, "/sys/devices/virtual/input/%s/name", sys_name);
-
-	if (FILE_SCANF(path, "%s", dev_name)) {
-		tst_resm(TFAIL|TERRNO, "Failed to read '%s'", path);
-		free(path);
-		return;
-	}
-
-	if (!strcmp(VIRTUAL_DEVICE, dev_name))
-		tst_resm(TPASS, "ioctl UI_GET_SYSNAME returned correct name");
-	else
-		tst_resm(TFAIL, "ioctl UI_GET_SYSNAME returned wrong name");
-
-	free(path);
-}
-
-void create_device(int fd)
-{
-	int nb;
-	struct uinput_user_dev uidev = {
-		.name = VIRTUAL_DEVICE,
-		.id = {
-			.bustype = BUS_USB,
-			.vendor = 0x1,
-			.product = 0x1,
-			.version = 1,
-		}
-	};
-
-	SAFE_WRITE(NULL, SAFE_WRITE_ALL, fd, &uidev, sizeof(uidev));
-	SAFE_IOCTL(NULL, fd, UI_DEV_CREATE, NULL);
-
-	for (nb = 100; nb > 0; nb--) {
-		if (check_device()) {
-			check_ui_get_sysname_ioctl(fd);
-			return;
-		}
-		usleep(10000);
-	}
-
-	destroy_device(fd);
-	tst_brkm(TBROK, NULL, "Failed to create device");
-}
-
-void setup_mouse_events(int fd)
-{
-	SAFE_IOCTL(NULL, fd, UI_SET_EVBIT, EV_KEY);
-	SAFE_IOCTL(NULL, fd, UI_SET_KEYBIT, BTN_LEFT);
-	SAFE_IOCTL(NULL, fd, UI_SET_EVBIT, EV_REL);
-	SAFE_IOCTL(NULL, fd, UI_SET_RELBIT, REL_X);
-	SAFE_IOCTL(NULL, fd, UI_SET_RELBIT, REL_Y);
-}
-
-void destroy_device(int fd)
-{
-	SAFE_IOCTL(NULL, fd, UI_DEV_DESTROY, NULL);
-	SAFE_CLOSE(NULL, fd);
-
-	if (uinput_loaded)
-		unload_uinput();
-}
-
-int check_event_code(struct input_event *iev, int event, int code)
-{
-	return iev->type == event && iev->code == code;
-}
-
-int check_sync_event(struct input_event *iev)
-{
-	return check_event_code(iev, EV_SYN, SYN_REPORT);
-}
-
-/*
- * the value of stray_sync_event:
- * 0: EV_SYN/SYN_REPORT events should not be received in /dev/input/eventX
- * 1: EV_SYN/SYN_REPORT events may be received in /dev/input/eventX
- * On an old kernel(before v3.7.0), EV_SYN/SYN_REPORT events are always
- * received even though we send empty moves.
- */
-int no_events_queued(int fd, int stray_sync_event)
-{
-	struct pollfd fds = {.fd = fd, .events = POLLIN};
-	int ret, res;
-	struct input_event ev;
-
-	ret = poll(&fds, 1, 30);
-
-	if (ret > 0) {
-		res = read(fd, &ev, sizeof(ev));
-
-		if (res == sizeof(ev)) {
-			tst_resm(TINFO,
-				"Unexpected ev type=%i code=%i value=%i",
-				ev.type, ev.code, ev.value);
-		}
-	}
-
-	return ret == 0;
-}
-
-static int check_device(void)
-{
-	FILE *file;
-	char line[256];
-
-	file = fopen("/proc/bus/input/devices", "r");
-	if (!file)
-		return 0;
-
-	while (fgets(line, 256, file)) {
-		if (fnmatch(VIRTUAL_DEVICE_REGEX, line, 0) == 0)
-			return 1;
-	}
-
-	fclose(file);
-
-	return 0;
-}
testcases/kernel/input/input_helper.h deleted +0 -36
deleted file mode 100644
index 7f61be1e9a4a647ff0887aa14a89a48bd2e882a9..0000000000000000000000000000000000000000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2015 Cedric Hnyda <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#ifndef INPUT_HELPER_H
-#define INPUT_HELPER_H
-
-#include <sys/types.h>
-#include <dirent.h>
-
-int open_device(void);
-void send_rel_move(int fd, int x, int y);
-void send_event(int fd, int event, int code, int value);
-int open_uinput(void);
-void create_device(int fd);
-void setup_mouse_events(int fd);
-void destroy_device(int fd);
-int check_event_code(struct input_event *iev, int event, int code);
-int check_sync_event(struct input_event *iev);
-int no_events_queued(int fd, int stray_sync_event);
-
-#endif /* INPUT_HELPER_H */
Signature · 5 lines
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#11 lore raw
In reply to Andrea Cervesato

Hi,

merged, thanks for the reviews!

Andrea

Quoted 39 lines · Andrea Cervesato

Cleanup of the input testing suite, using new LTP API and changing the way we are obtaining information from input devices. Usage of the tst_uinput.h utilities, rewritten input helper and simplified the source code.

---
Changes in v2:
- use checkpoint in input03
- move check_ui_get_sysname_ioctl() in tst_uinput.h
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Andrea Cervesato (7):
Refactor input01 test
Refactor input02 test
Refactor input03 test
Refactor input04 test
Refactor input05 test
Refactor input06 test
Delete depreacted input test suite helper

  libs/uinput/tst_uinput.c              |  26 ++-
  testcases/kernel/input/Makefile       |   6 +-
  testcases/kernel/input/input01.c      | 205 +++++-----------------
  testcases/kernel/input/input02.c      | 132 ++++++--------
  testcases/kernel/input/input03.c      | 176 ++++++++-----------
  testcases/kernel/input/input04.c      | 113 ++++--------
  testcases/kernel/input/input05.c      | 119 ++++---------
  testcases/kernel/input/input06.c      | 190 +++++++++------------
  testcases/kernel/input/input_common.h |  97 +++++++++++
  testcases/kernel/input/input_helper.c | 313 ----------------------------------
  testcases/kernel/input/input_helper.h |  36 ----
  11 files changed, 443 insertions(+), 970 deletions(-)

---
base-commit: ec4161186e51b55d4faaa394dc4607200cb30f68
change-id: 20241113-input_refactoring-16aea13ed7b8

Best regards,

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp