* [LTP] [PATCH v1] Add test for UI_GET_NAME ioctl @ 2023-10-12 11:13 Wei Gao via ltp 2023-10-12 11:25 ` [LTP] [PATCH v2] " Wei Gao via ltp 0 siblings, 1 reply; 12+ messages in thread From: Wei Gao via ltp @ 2023-10-12 11:13 UTC (permalink / raw) To: ltp Fix:#573 Signed-off-by: Wei Gao <wegao@suse.com> --- testcases/kernel/input/input_helper.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/testcases/kernel/input/input_helper.c b/testcases/kernel/input/input_helper.c index 09530fb4d..a5e7bb109 100644 --- a/testcases/kernel/input/input_helper.c +++ b/testcases/kernel/input/input_helper.c @@ -32,6 +32,7 @@ static int uinput_loaded; static int check_device(void); +static int check_ui_get_sysname_ioctl(int fd); static int try_open_device(void) { @@ -185,6 +186,27 @@ void send_rel_move(int fd, int x, int y) send_event(fd, EV_SYN, 0, 0); } +static int check_ui_get_sysname_ioctl(int fd) +{ + char name[256]; + SAFE_IOCTL(NULL, fd, UI_GET_SYSNAME(sizeof(name)), name, NULL); + + DIR *test_dir; + struct dirent *ent; + + test_dir = SAFE_OPENDIR(NULL, "/sys/devices/virtual/input/"); + + while ((ent = SAFE_READDIR(NULL, test_dir))) { + if (!strcmp(ent->d_name, name)) { + return 1; + } + else + continue; + } + + return 0; +} + void create_device(int fd) { int nb; @@ -202,7 +224,7 @@ void create_device(int fd) SAFE_IOCTL(NULL, 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); } -- 2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [LTP] [PATCH v2] Add test for UI_GET_NAME ioctl 2023-10-12 11:13 [LTP] [PATCH v1] Add test for UI_GET_NAME ioctl Wei Gao via ltp @ 2023-10-12 11:25 ` Wei Gao via ltp 2023-10-12 14:05 ` Cyril Hrubis 2023-10-14 3:31 ` [LTP] [PATCH v3] " Wei Gao via ltp 0 siblings, 2 replies; 12+ messages in thread From: Wei Gao via ltp @ 2023-10-12 11:25 UTC (permalink / raw) To: ltp Fix:#573 Signed-off-by: Wei Gao <wegao@suse.com> --- testcases/kernel/input/input_helper.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/testcases/kernel/input/input_helper.c b/testcases/kernel/input/input_helper.c index 09530fb4d..8f7d6b523 100644 --- a/testcases/kernel/input/input_helper.c +++ b/testcases/kernel/input/input_helper.c @@ -32,6 +32,7 @@ static int uinput_loaded; static int check_device(void); +static int check_ui_get_sysname_ioctl(int fd); static int try_open_device(void) { @@ -185,6 +186,28 @@ void send_rel_move(int fd, int x, int y) send_event(fd, EV_SYN, 0, 0); } +static int check_ui_get_sysname_ioctl(int fd) +{ + char name[256]; + + SAFE_IOCTL(NULL, fd, UI_GET_SYSNAME(sizeof(name)), name, NULL); + + DIR *test_dir; + + struct dirent *ent; + + test_dir = SAFE_OPENDIR(NULL, "/sys/devices/virtual/input/"); + + while ((ent = SAFE_READDIR(NULL, test_dir))) { + if (!strcmp(ent->d_name, name)) + return 1; + else + continue; + } + + return 0; +} + void create_device(int fd) { int nb; @@ -202,7 +225,7 @@ void create_device(int fd) SAFE_IOCTL(NULL, 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); } -- 2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v2] Add test for UI_GET_NAME ioctl 2023-10-12 11:25 ` [LTP] [PATCH v2] " Wei Gao via ltp @ 2023-10-12 14:05 ` Cyril Hrubis 2023-10-14 3:36 ` Wei Gao via ltp 2023-10-14 3:31 ` [LTP] [PATCH v3] " Wei Gao via ltp 1 sibling, 1 reply; 12+ messages in thread From: Cyril Hrubis @ 2023-10-12 14:05 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi! > +static int check_ui_get_sysname_ioctl(int fd) > +{ > + char name[256]; > + > + SAFE_IOCTL(NULL, fd, UI_GET_SYSNAME(sizeof(name)), name, NULL); > + > + DIR *test_dir; > + > + struct dirent *ent; > + > + test_dir = SAFE_OPENDIR(NULL, "/sys/devices/virtual/input/"); > + > + while ((ent = SAFE_READDIR(NULL, test_dir))) { > + if (!strcmp(ent->d_name, name)) > + return 1; > + else > + continue; > + } Why do we loop over the directory here? Can't we just directly check that the path /sys/devices/virtual/input/$name/ exists? I guess that we can as well read the /sys/devices/virtual/input/$name/dev and match that against fstat() on the fd. > + return 0; > +} > + > void create_device(int fd) > { > int nb; > @@ -202,7 +225,7 @@ void create_device(int fd) > SAFE_IOCTL(NULL, fd, UI_DEV_CREATE, NULL); > > for (nb = 100; nb > 0; nb--) { > - if (check_device()) > + if (check_device() && check_ui_get_sysname_ioctl(fd)) Maybe it would be a bit more readable if we did: if (check_device() { check_ui_get_sysname_ioctl(fd); return; } > return; > usleep(10000); > } > -- > 2.35.3 > > > -- > Mailing list info: https://lists.linux.it/listinfo/ltp -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v2] Add test for UI_GET_NAME ioctl 2023-10-12 14:05 ` Cyril Hrubis @ 2023-10-14 3:36 ` Wei Gao via ltp 2023-10-16 15:49 ` Cyril Hrubis 0 siblings, 1 reply; 12+ messages in thread From: Wei Gao via ltp @ 2023-10-14 3:36 UTC (permalink / raw) To: Cyril Hrubis; +Cc: ltp On Thu, Oct 12, 2023 at 04:05:21PM +0200, Cyril Hrubis wrote: > Hi! > > +static int check_ui_get_sysname_ioctl(int fd) > > +{ > > + char name[256]; > > + > > + SAFE_IOCTL(NULL, fd, UI_GET_SYSNAME(sizeof(name)), name, NULL); > > + > > + DIR *test_dir; > > + > > + struct dirent *ent; > > + > > + test_dir = SAFE_OPENDIR(NULL, "/sys/devices/virtual/input/"); > > + > > + while ((ent = SAFE_READDIR(NULL, test_dir))) { > > + if (!strcmp(ent->d_name, name)) > > + return 1; > > + else > > + continue; > > + } > > Why do we loop over the directory here? Can't we just directly check > that the path /sys/devices/virtual/input/$name/ exists? > > I guess that we can as well read the > /sys/devices/virtual/input/$name/dev and match that against fstat() on > the fd. Seems no dev node can be found under /sys/devices/virtual/input/$name/. ll /sys/devices/virtual/input/input13/ total 0 drwxr-xr-x 2 root root 0 Oct 13 21:32 capabilities drwxr-xr-x 3 root root 0 Oct 13 21:32 event8 drwxr-xr-x 2 root root 0 Oct 13 21:32 id -rw-r--r-- 1 root root 4.0K Oct 13 21:33 inhibited -r--r--r-- 1 root root 4.0K Oct 13 21:33 modalias drwxr-xr-x 3 root root 0 Oct 13 21:32 mouse3 -r--r--r-- 1 root root 4.0K Oct 13 21:32 name -r--r--r-- 1 root root 4.0K Oct 13 21:32 phys drwxr-xr-x 2 root root 0 Oct 13 21:33 power -r--r--r-- 1 root root 4.0K Oct 13 21:32 properties lrwxrwxrwx 1 root root 0 Oct 13 21:32 subsystem -> ../../../../class/input -rw-r--r-- 1 root root 4.0K Oct 13 21:32 uevent -r--r--r-- 1 root root 4.0K Oct 13 21:33 uniq > > > + return 0; > > +} > > + > > void create_device(int fd) > > { > > int nb; > > @@ -202,7 +225,7 @@ void create_device(int fd) > > SAFE_IOCTL(NULL, fd, UI_DEV_CREATE, NULL); > > > > for (nb = 100; nb > 0; nb--) { > > - if (check_device()) > > + if (check_device() && check_ui_get_sysname_ioctl(fd)) > > Maybe it would be a bit more readable if we did: > > if (check_device() { > check_ui_get_sysname_ioctl(fd); > return; > } > > > return; > > usleep(10000); > > } > > -- > > 2.35.3 > > > > > > -- > > Mailing list info: https://lists.linux.it/listinfo/ltp > > -- > Cyril Hrubis > chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v2] Add test for UI_GET_NAME ioctl 2023-10-14 3:36 ` Wei Gao via ltp @ 2023-10-16 15:49 ` Cyril Hrubis 2023-10-16 23:52 ` Wei Gao via ltp 0 siblings, 1 reply; 12+ messages in thread From: Cyril Hrubis @ 2023-10-16 15:49 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi! > > > +static int check_ui_get_sysname_ioctl(int fd) > > > +{ > > > + char name[256]; > > > + > > > + SAFE_IOCTL(NULL, fd, UI_GET_SYSNAME(sizeof(name)), name, NULL); > > > + > > > + DIR *test_dir; > > > + > > > + struct dirent *ent; > > > + > > > + test_dir = SAFE_OPENDIR(NULL, "/sys/devices/virtual/input/"); > > > + > > > + while ((ent = SAFE_READDIR(NULL, test_dir))) { > > > + if (!strcmp(ent->d_name, name)) > > > + return 1; > > > + else > > > + continue; > > > + } > > > > Why do we loop over the directory here? Can't we just directly check > > that the path /sys/devices/virtual/input/$name/ exists? > > > > I guess that we can as well read the > > /sys/devices/virtual/input/$name/dev and match that against fstat() on > > the fd. > Seems no dev node can be found under /sys/devices/virtual/input/$name/. > > ll /sys/devices/virtual/input/input13/ > total 0 > drwxr-xr-x 2 root root 0 Oct 13 21:32 capabilities > drwxr-xr-x 3 root root 0 Oct 13 21:32 event8 > drwxr-xr-x 2 root root 0 Oct 13 21:32 id > -rw-r--r-- 1 root root 4.0K Oct 13 21:33 inhibited > -r--r--r-- 1 root root 4.0K Oct 13 21:33 modalias > drwxr-xr-x 3 root root 0 Oct 13 21:32 mouse3 > -r--r--r-- 1 root root 4.0K Oct 13 21:32 name > -r--r--r-- 1 root root 4.0K Oct 13 21:32 phys > drwxr-xr-x 2 root root 0 Oct 13 21:33 power > -r--r--r-- 1 root root 4.0K Oct 13 21:32 properties > lrwxrwxrwx 1 root root 0 Oct 13 21:32 subsystem -> ../../../../class/input > -rw-r--r-- 1 root root 4.0K Oct 13 21:32 uevent > -r--r--r-- 1 root root 4.0K Oct 13 21:33 uniq Ah, right, it's under the event8 directory in this case. I guess that we can match name againts the VIRTUAL_DEVICE string instead. -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v2] Add test for UI_GET_NAME ioctl 2023-10-16 15:49 ` Cyril Hrubis @ 2023-10-16 23:52 ` Wei Gao via ltp 0 siblings, 0 replies; 12+ messages in thread From: Wei Gao via ltp @ 2023-10-16 23:52 UTC (permalink / raw) To: Cyril Hrubis; +Cc: ltp On Mon, Oct 16, 2023 at 05:49:34PM +0200, Cyril Hrubis wrote: > Hi! > > > > +static int check_ui_get_sysname_ioctl(int fd) > > > > +{ > > > > + char name[256]; > > > > + > > > > + SAFE_IOCTL(NULL, fd, UI_GET_SYSNAME(sizeof(name)), name, NULL); > > > > + > > > > + DIR *test_dir; > > > > + > > > > + struct dirent *ent; > > > > + > > > > + test_dir = SAFE_OPENDIR(NULL, "/sys/devices/virtual/input/"); > > > > + > > > > + while ((ent = SAFE_READDIR(NULL, test_dir))) { > > > > + if (!strcmp(ent->d_name, name)) > > > > + return 1; > > > > + else > > > > + continue; > > > > + } > > > > > > Why do we loop over the directory here? Can't we just directly check > > > that the path /sys/devices/virtual/input/$name/ exists? > > > > > > I guess that we can as well read the > > > /sys/devices/virtual/input/$name/dev and match that against fstat() on > > > the fd. > > Seems no dev node can be found under /sys/devices/virtual/input/$name/. > > > > ll /sys/devices/virtual/input/input13/ > > total 0 > > drwxr-xr-x 2 root root 0 Oct 13 21:32 capabilities > > drwxr-xr-x 3 root root 0 Oct 13 21:32 event8 > > drwxr-xr-x 2 root root 0 Oct 13 21:32 id > > -rw-r--r-- 1 root root 4.0K Oct 13 21:33 inhibited > > -r--r--r-- 1 root root 4.0K Oct 13 21:33 modalias > > drwxr-xr-x 3 root root 0 Oct 13 21:32 mouse3 > > -r--r--r-- 1 root root 4.0K Oct 13 21:32 name > > -r--r--r-- 1 root root 4.0K Oct 13 21:32 phys > > drwxr-xr-x 2 root root 0 Oct 13 21:33 power > > -r--r--r-- 1 root root 4.0K Oct 13 21:32 properties > > lrwxrwxrwx 1 root root 0 Oct 13 21:32 subsystem -> ../../../../class/input > > -rw-r--r-- 1 root root 4.0K Oct 13 21:32 uevent > > -r--r--r-- 1 root root 4.0K Oct 13 21:33 uniq > > Ah, right, it's under the event8 directory in this case. I guess that we > can match name againts the VIRTUAL_DEVICE string instead. Yes, in v3 patch i start match name againts the VIRTUAL_DEVICE. Thanks for the suggestion. > > -- > Cyril Hrubis > chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
* [LTP] [PATCH v3] Add test for UI_GET_NAME ioctl 2023-10-12 11:25 ` [LTP] [PATCH v2] " Wei Gao via ltp 2023-10-12 14:05 ` Cyril Hrubis @ 2023-10-14 3:31 ` Wei Gao via ltp 2023-10-17 11:08 ` Cyril Hrubis 2023-10-17 13:16 ` [LTP] [PATCH v4] " Wei Gao via ltp 1 sibling, 2 replies; 12+ messages in thread From: Wei Gao via ltp @ 2023-10-14 3:31 UTC (permalink / raw) To: ltp Fix:#573 Signed-off-by: Wei Gao <wegao@suse.com> --- testcases/kernel/input/input_helper.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/testcases/kernel/input/input_helper.c b/testcases/kernel/input/input_helper.c index 09530fb4d..b9dc50a7f 100644 --- a/testcases/kernel/input/input_helper.c +++ b/testcases/kernel/input/input_helper.c @@ -32,6 +32,7 @@ static int uinput_loaded; static int check_device(void); +static void check_ui_get_sysname_ioctl(int fd); static int try_open_device(void) { @@ -185,6 +186,22 @@ void send_rel_move(int fd, int x, int 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); + SAFE_FILE_SCANF(NULL, path, "%s", dev_name); + + if (strcmp(VIRTUAL_DEVICE, dev_name)) { + tst_brkm(TBROK, NULL, "Unable to find the input device through ioctl"); + } + free(path); +} + void create_device(int fd) { int nb; @@ -202,8 +219,10 @@ void create_device(int fd) SAFE_IOCTL(NULL, 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); } -- 2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v3] Add test for UI_GET_NAME ioctl 2023-10-14 3:31 ` [LTP] [PATCH v3] " Wei Gao via ltp @ 2023-10-17 11:08 ` Cyril Hrubis 2023-10-17 13:16 ` [LTP] [PATCH v4] " Wei Gao via ltp 1 sibling, 0 replies; 12+ messages in thread From: Cyril Hrubis @ 2023-10-17 11:08 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi! > Fix:#573 > Signed-off-by: Wei Gao <wegao@suse.com> > --- > testcases/kernel/input/input_helper.c | 21 ++++++++++++++++++++- > 1 file changed, 20 insertions(+), 1 deletion(-) > > diff --git a/testcases/kernel/input/input_helper.c b/testcases/kernel/input/input_helper.c > index 09530fb4d..b9dc50a7f 100644 > --- a/testcases/kernel/input/input_helper.c > +++ b/testcases/kernel/input/input_helper.c > @@ -32,6 +32,7 @@ > > static int uinput_loaded; > static int check_device(void); > +static void check_ui_get_sysname_ioctl(int fd); I do not think that this is needed, we do not call the function before it's definition. > static int try_open_device(void) > { > @@ -185,6 +186,22 @@ void send_rel_move(int fd, int x, int 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); > + SAFE_FILE_SCANF(NULL, path, "%s", dev_name); I would be inclined to use the FILE_SCANF() instead here and report failure if the file does not exist or couldn't be read, something as: if (FILE_SCANF(NULL, path, "%s", dev_name)) { tst_res(TFAIL, "Failed to read name from the sysfs path"); free(path); return; } > + if (strcmp(VIRTUAL_DEVICE, dev_name)) { > + tst_brkm(TBROK, NULL, "Unable to find the input device through ioctl"); > + } I do not think that tst_brkm() is the right here either, this is simple TPASS/TFAIL situation. Can we just print TPASS/TFAIL based on if these names match? > + free(path); > +} > + > void create_device(int fd) > { > int nb; > @@ -202,8 +219,10 @@ void create_device(int fd) > SAFE_IOCTL(NULL, 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); > } > > -- > 2.35.3 > > > -- > Mailing list info: https://lists.linux.it/listinfo/ltp -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
* [LTP] [PATCH v4] Add test for UI_GET_NAME ioctl 2023-10-14 3:31 ` [LTP] [PATCH v3] " Wei Gao via ltp 2023-10-17 11:08 ` Cyril Hrubis @ 2023-10-17 13:16 ` Wei Gao via ltp 2023-10-23 14:16 ` Cyril Hrubis 1 sibling, 1 reply; 12+ messages in thread From: Wei Gao via ltp @ 2023-10-17 13:16 UTC (permalink / raw) To: ltp Fix:#573 Signed-off-by: Wei Gao <wegao@suse.com> --- testcases/kernel/input/input_helper.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/testcases/kernel/input/input_helper.c b/testcases/kernel/input/input_helper.c index 09530fb4d..609002e3e 100644 --- a/testcases/kernel/input/input_helper.c +++ b/testcases/kernel/input/input_helper.c @@ -185,6 +185,29 @@ void send_rel_move(int fd, int x, int 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 name from the sysfs path"); + free(path); + return; + } + + if (!strcmp(VIRTUAL_DEVICE, dev_name)) + tst_resm(TPASS, "Find the input device through ioctl"); + else + tst_resm(TFAIL, "Unable to find the input device through ioctl"); + + free(path); +} + void create_device(int fd) { int nb; @@ -202,8 +225,10 @@ void create_device(int fd) SAFE_IOCTL(NULL, 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); } -- 2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v4] Add test for UI_GET_NAME ioctl 2023-10-17 13:16 ` [LTP] [PATCH v4] " Wei Gao via ltp @ 2023-10-23 14:16 ` Cyril Hrubis 2023-10-24 9:10 ` [LTP] [CI FAILURE] " Petr Vorel 0 siblings, 1 reply; 12+ messages in thread From: Cyril Hrubis @ 2023-10-23 14:16 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi! I've adjusted the FAIL/PASS messages and pushed, thanks. -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
* [LTP] [CI FAILURE] Re: [PATCH v4] Add test for UI_GET_NAME ioctl 2023-10-23 14:16 ` Cyril Hrubis @ 2023-10-24 9:10 ` Petr Vorel 2023-10-24 9:33 ` Cyril Hrubis 0 siblings, 1 reply; 12+ messages in thread From: Petr Vorel @ 2023-10-24 9:10 UTC (permalink / raw) To: Cyril Hrubis; +Cc: ltp Hi all, > Hi! > I've adjusted the FAIL/PASS messages and pushed, thanks. UI_GET_NAME() from include/uapi/linux/uinput.h is not on the old CentOS 7 we still support: https://github.com/linux-test-project/ltp/actions/runs/6614554688/job/17964785134 /__w/ltp/ltp/testcases/kernel/input/input_helper.c:194:2: error: implicit declaration of function 'UI_GET_SYSNAME' [-Werror=implicit-function-declaration] SAFE_IOCTL(NULL, fd, UI_GET_SYSNAME(sizeof(sys_name)), sys_name, NULL); ^ I'll have look later today for the fix. I suppose we need lapi/uinput.h with adds a fallback definition. It was added in kernel v3.15 in e3480a61fca7 ("Input: uinput - add UI_GET_SYSNAME ioctl to retrieve the sysfs path") Also, there is also an API version change, we could use this if simple ifndef UI_GET_SYSNAME + fallback will not be enough (e.g. test fails because it requires newer kernel API). -#define UINPUT_VERSION 3 +#define UINPUT_VERSION 4 Kind regards, Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [CI FAILURE] Re: [PATCH v4] Add test for UI_GET_NAME ioctl 2023-10-24 9:10 ` [LTP] [CI FAILURE] " Petr Vorel @ 2023-10-24 9:33 ` Cyril Hrubis 0 siblings, 0 replies; 12+ messages in thread From: Cyril Hrubis @ 2023-10-24 9:33 UTC (permalink / raw) To: Petr Vorel; +Cc: ltp Hi! > > I've adjusted the FAIL/PASS messages and pushed, thanks. > > UI_GET_NAME() from include/uapi/linux/uinput.h is not on the old CentOS 7 we > still support: > > https://github.com/linux-test-project/ltp/actions/runs/6614554688/job/17964785134 > /__w/ltp/ltp/testcases/kernel/input/input_helper.c:194:2: error: implicit declaration of function 'UI_GET_SYSNAME' [-Werror=implicit-function-declaration] > SAFE_IOCTL(NULL, fd, UI_GET_SYSNAME(sizeof(sys_name)), sys_name, NULL); > ^ > > I'll have look later today for the fix. I suppose we need lapi/uinput.h with > adds a fallback definition. It was added in kernel v3.15 in > e3480a61fca7 ("Input: uinput - add UI_GET_SYSNAME ioctl to retrieve the sysfs path") > > Also, there is also an API version change, we could use this if simple ifndef > UI_GET_SYSNAME + fallback will not be enough (e.g. test fails because it > requires newer kernel API). > > -#define UINPUT_VERSION 3 > +#define UINPUT_VERSION 4 Given that UI_GET_SYSNAME is a macro we can do as well: #ifndef UI_GET_SYSNAME # define UI_GET_SYSNAME(len) ... #endif However at the same time we would need to actually check if the ioctl is supported or not, because if the CentOS 7 kernel does not support UI_GET_SYSNAME ioctl() the SAFE_IOCTL() will fail with EINVAL. Also looking at the linux/uinput.h there are three more ioctls() added in version 5 that should be tested as well. I suppose that we will need add an issue for that. -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2023-10-24 9:32 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-10-12 11:13 [LTP] [PATCH v1] Add test for UI_GET_NAME ioctl Wei Gao via ltp 2023-10-12 11:25 ` [LTP] [PATCH v2] " Wei Gao via ltp 2023-10-12 14:05 ` Cyril Hrubis 2023-10-14 3:36 ` Wei Gao via ltp 2023-10-16 15:49 ` Cyril Hrubis 2023-10-16 23:52 ` Wei Gao via ltp 2023-10-14 3:31 ` [LTP] [PATCH v3] " Wei Gao via ltp 2023-10-17 11:08 ` Cyril Hrubis 2023-10-17 13:16 ` [LTP] [PATCH v4] " Wei Gao via ltp 2023-10-23 14:16 ` Cyril Hrubis 2023-10-24 9:10 ` [LTP] [CI FAILURE] " Petr Vorel 2023-10-24 9:33 ` Cyril Hrubis
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox