conform/events-touch: Silently bail out if init failed
This removes the need to conditionally run the test.
This commit is contained in:
parent
9371029a89
commit
1ab6fc0b39
@ -316,7 +316,7 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
init_uinput ()
|
init_uinput (void)
|
||||||
{
|
{
|
||||||
struct uinput_user_dev dev;
|
struct uinput_user_dev dev;
|
||||||
|
|
||||||
@ -324,22 +324,35 @@ init_uinput ()
|
|||||||
if (fd < 0 && errno == ENODEV)
|
if (fd < 0 && errno == ENODEV)
|
||||||
fd = open ("/dev/input/uinput", O_RDWR);
|
fd = open ("/dev/input/uinput", O_RDWR);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
goto error;
|
{
|
||||||
|
if (g_test_verbose ())
|
||||||
|
perror ("open");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|
||||||
memset (&dev, 0, sizeof (dev));
|
memset (&dev, 0, sizeof (dev));
|
||||||
setup (&dev, fd);
|
setup (&dev, fd);
|
||||||
|
|
||||||
if (write (fd, &dev, sizeof (dev)) < sizeof (dev))
|
if (write (fd, &dev, sizeof (dev)) < sizeof (dev))
|
||||||
|
{
|
||||||
|
if (g_test_verbose ())
|
||||||
|
perror ("write");
|
||||||
|
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
if (ioctl (fd, UI_DEV_CREATE, NULL) == -1)
|
if (ioctl (fd, UI_DEV_CREATE, NULL) == -1)
|
||||||
|
{
|
||||||
|
if (g_test_verbose ())
|
||||||
|
perror ("ioctl");
|
||||||
|
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (g_test_verbose ())
|
|
||||||
g_print ("error: %s\n", strerror (errno));
|
|
||||||
|
|
||||||
if (fd != -1)
|
if (fd != -1)
|
||||||
close (fd);
|
close (fd);
|
||||||
|
|
||||||
@ -355,6 +368,10 @@ events_touch (void)
|
|||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
State state;
|
State state;
|
||||||
|
|
||||||
|
/* bail out if we could not initialize evdev */
|
||||||
|
if (!init_uinput ())
|
||||||
|
return;
|
||||||
|
|
||||||
state.pass = TRUE;
|
state.pass = TRUE;
|
||||||
state.gesture_points = 0;
|
state.gesture_points = 0;
|
||||||
|
|
||||||
@ -363,8 +380,6 @@ events_touch (void)
|
|||||||
clutter_stage_set_fullscreen (CLUTTER_STAGE (stage), TRUE);
|
clutter_stage_set_fullscreen (CLUTTER_STAGE (stage), TRUE);
|
||||||
clutter_actor_show (stage);
|
clutter_actor_show (stage);
|
||||||
|
|
||||||
g_assert (init_uinput () == 0);
|
|
||||||
|
|
||||||
clutter_threads_add_timeout (500, perform_gesture, &state);
|
clutter_threads_add_timeout (500, perform_gesture, &state);
|
||||||
|
|
||||||
clutter_main ();
|
clutter_main ();
|
||||||
|
@ -116,13 +116,6 @@ clutter_test_init (gint *argc,
|
|||||||
shared_state->argv_addr = argv;
|
shared_state->argv_addr = argv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
can_write_to_uinput ()
|
|
||||||
{
|
|
||||||
return g_access ("/dev/uinput", R_OK | W_OK) ||
|
|
||||||
g_access ("/dev/input/uinput", R_OK | W_OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -239,6 +232,8 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
TEST_CONFORM_SIMPLE ("/behaviours", behaviours_base);
|
TEST_CONFORM_SIMPLE ("/behaviours", behaviours_base);
|
||||||
|
|
||||||
|
TEST_CONFORM_SIMPLE ("/events", events_touch);
|
||||||
|
|
||||||
/* FIXME - see bug https://bugzilla.gnome.org/show_bug.cgi?id=655588 */
|
/* FIXME - see bug https://bugzilla.gnome.org/show_bug.cgi?id=655588 */
|
||||||
TEST_CONFORM_TODO ("/cally", cally_text);
|
TEST_CONFORM_TODO ("/cally", cally_text);
|
||||||
|
|
||||||
@ -260,8 +255,6 @@ main (int argc, char **argv)
|
|||||||
TEST_CONFORM_SIMPLE ("/cogl/vertex-buffer", test_cogl_vertex_buffer_interleved);
|
TEST_CONFORM_SIMPLE ("/cogl/vertex-buffer", test_cogl_vertex_buffer_interleved);
|
||||||
TEST_CONFORM_SIMPLE ("/cogl/vertex-buffer", test_cogl_vertex_buffer_mutability);
|
TEST_CONFORM_SIMPLE ("/cogl/vertex-buffer", test_cogl_vertex_buffer_mutability);
|
||||||
|
|
||||||
TEST_CONFORM_SKIP (can_write_to_uinput (), "/events", events_touch);
|
|
||||||
|
|
||||||
/* left to the end because they aren't currently very orthogonal and tend to
|
/* left to the end because they aren't currently very orthogonal and tend to
|
||||||
* break subsequent tests! */
|
* break subsequent tests! */
|
||||||
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_viewport);
|
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_viewport);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user