1
0
Fork 0

conform/events-touch: Silently bail out if init failed

This removes the need to conditionally run the test.
This commit is contained in:
Emmanuele Bassi 2012-06-07 12:23:49 +01:00
parent 9371029a89
commit 1ab6fc0b39
2 changed files with 26 additions and 18 deletions

View file

@ -316,7 +316,7 @@ error:
}
static int
init_uinput ()
init_uinput (void)
{
struct uinput_user_dev dev;
@ -324,22 +324,35 @@ init_uinput ()
if (fd < 0 && errno == ENODEV)
fd = open ("/dev/input/uinput", O_RDWR);
if (fd < 0)
goto error;
{
if (g_test_verbose ())
perror ("open");
return 0;
};
memset (&dev, 0, sizeof (dev));
setup (&dev, fd);
if (write (fd, &dev, sizeof (dev)) < sizeof (dev))
goto error;
{
if (g_test_verbose ())
perror ("write");
goto error;
}
if (ioctl (fd, UI_DEV_CREATE, NULL) == -1)
goto error;
{
if (g_test_verbose ())
perror ("ioctl");
goto error;
}
return 0;
error:
if (g_test_verbose ())
g_print ("error: %s\n", strerror (errno));
if (fd != -1)
close (fd);
@ -355,6 +368,10 @@ events_touch (void)
ClutterActor *stage;
State state;
/* bail out if we could not initialize evdev */
if (!init_uinput ())
return;
state.pass = TRUE;
state.gesture_points = 0;
@ -363,8 +380,6 @@ events_touch (void)
clutter_stage_set_fullscreen (CLUTTER_STAGE (stage), TRUE);
clutter_actor_show (stage);
g_assert (init_uinput () == 0);
clutter_threads_add_timeout (500, perform_gesture, &state);
clutter_main ();

View file

@ -116,13 +116,6 @@ clutter_test_init (gint *argc,
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
main (int argc, char **argv)
{
@ -239,6 +232,8 @@ main (int argc, char **argv)
TEST_CONFORM_SIMPLE ("/behaviours", behaviours_base);
TEST_CONFORM_SIMPLE ("/events", events_touch);
/* FIXME - see bug https://bugzilla.gnome.org/show_bug.cgi?id=655588 */
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_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
* break subsequent tests! */
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_viewport);