Message ID | 20241210-fix_input_suite-v1-1-f8bb1d80d2fc@suse.com |
---|---|
State | Accepted |
Headers | show |
Series | Verify virtual device availability | expand |
Hi Andrea,
Looks reasonable.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
Hi Andrea, ... > static void setup(void) > { > fd_send = open_uinput(); > + if (fd_send == -1) > + tst_brk(TCONF, "Virtual device is not available"); Thinking about it twice, how about renaming the function safe_open_uinput() and add tst_brk(TCONF, ...) there? Function is not used in library where tst_brk(TCONF, ...) would be problematic, therefore I would not even bother with having SAFE_OPEN_UINPUT() which would evaluate open_uinput(). Kind regards, Petr
Hi Petr, On 12/10/24 21:22, Petr Vorel wrote: > Hi Andrea, > > ... >> static void setup(void) >> { >> fd_send = open_uinput(); >> + if (fd_send == -1) >> + tst_brk(TCONF, "Virtual device is not available"); > Thinking about it twice, how about renaming the function safe_open_uinput() > and add tst_brk(TCONF, ...) there? > > Function is not used in library where tst_brk(TCONF, ...) would be problematic, > therefore I would not even bother with having SAFE_OPEN_UINPUT() which would > evaluate open_uinput(). Usually SAFE_* macros just TBROK the tests, so I'm not sure about this approach. Alternatives? > Kind regards, > Petr Andrea
Pushed, thanks!
Andrea
On 12/10/24 18:21, Petr Vorel wrote:
> Reviewed-by: Petr Vorel<pvorel@suse.cz>
diff --git a/testcases/kernel/input/input01.c b/testcases/kernel/input/input01.c index 0872204111b81fd19a1525ef7f099e8ddead9658..5e85133028e25ea4a4596475f9aa876cb913694d 100644 --- a/testcases/kernel/input/input01.c +++ b/testcases/kernel/input/input01.c @@ -53,6 +53,9 @@ static void run(void) static void setup(void) { fd_send = open_uinput(); + if (fd_send == -1) + tst_brk(TCONF, "Virtual device is not available"); + setup_mouse_events(fd_send); create_input_device(fd_send); diff --git a/testcases/kernel/input/input02.c b/testcases/kernel/input/input02.c index eeff54ed21cbff6eac2d90dc53c6447d379e29ed..8e48f12d9a1108c9a5b1d8452e07386d5534fbfb 100644 --- a/testcases/kernel/input/input02.c +++ b/testcases/kernel/input/input02.c @@ -53,6 +53,9 @@ static void run(void) static void setup(void) { fd_send = open_uinput(); + if (fd_send == -1) + tst_brk(TCONF, "Virtual device is not available"); + setup_mouse_events(fd_send); create_input_device(fd_send); diff --git a/testcases/kernel/input/input03.c b/testcases/kernel/input/input03.c index 4a3eb464ee0322b134f44158a08dbb4ed000216f..2e6161beefccc1133b654be8cf2529e97610960f 100644 --- a/testcases/kernel/input/input03.c +++ b/testcases/kernel/input/input03.c @@ -82,6 +82,8 @@ static void run(void) static void setup(void) { fd_send = open_uinput(); + if (fd_send == -1) + tst_brk(TCONF, "Virtual device is not available"); setup_mouse_events(fd_send); SAFE_IOCTL(fd_send, UI_SET_EVBIT, EV_KEY); diff --git a/testcases/kernel/input/input04.c b/testcases/kernel/input/input04.c index 3c76d7c82ad7fe76f35f5a4ecfc78f27069d3fa0..fb13500fe6ab5eba7fed4640ed51dfbc8105cd09 100644 --- a/testcases/kernel/input/input04.c +++ b/testcases/kernel/input/input04.c @@ -33,6 +33,9 @@ static void run(void) static void setup(void) { fd_send = open_uinput(); + if (fd_send == -1) + tst_brk(TCONF, "Virtual device is not available"); + setup_mouse_events(fd_send); create_input_device(fd_send); diff --git a/testcases/kernel/input/input05.c b/testcases/kernel/input/input05.c index 4e5072a038ea8e4f7b8e0899d88a58bdf18e9e94..fa37ac7acb22b690b7bb35d9fe655d3e49532a61 100644 --- a/testcases/kernel/input/input05.c +++ b/testcases/kernel/input/input05.c @@ -38,6 +38,9 @@ static void run(void) static void setup(void) { fd_send = open_uinput(); + if (fd_send == -1) + tst_brk(TCONF, "Virtual device is not available"); + SAFE_IOCTL(fd_send, UI_SET_EVBIT, EV_KEY); SAFE_IOCTL(fd_send, UI_SET_KEYBIT, BTN_LEFT); create_input_device(fd_send); diff --git a/testcases/kernel/input/input06.c b/testcases/kernel/input/input06.c index cb871cbaec0fc8e35182dc0256dc2672dae4a419..d3584a2b0b9f540b29def3d98b7c77db09faefe9 100644 --- a/testcases/kernel/input/input06.c +++ b/testcases/kernel/input/input06.c @@ -178,6 +178,8 @@ static void run(void) static void setup(void) { fd_send = open_uinput(); + if (fd_send == -1) + tst_brk(TCONF, "Virtual device is not available"); SAFE_IOCTL(fd_send, UI_SET_EVBIT, EV_KEY); SAFE_IOCTL(fd_send, UI_SET_EVBIT, EV_REP); diff --git a/testcases/kernel/uevents/uevent03.c b/testcases/kernel/uevents/uevent03.c index 5b3dd701f0cf8f2f12a910b57d5f49d58712fe52..f7072db1c5f076e811e473438db3aa895644eaec 100644 --- a/testcases/kernel/uevents/uevent03.c +++ b/testcases/kernel/uevents/uevent03.c @@ -27,6 +27,9 @@ static int mouse_fd; static void create_uinput_mouse(void) { mouse_fd = open_uinput(); + if (mouse_fd == -1) + tst_brk(TCONF, "Virtual device is not available"); + setup_mouse_events(mouse_fd); create_input_device(mouse_fd); }