summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@linux.intel.com>2012-06-07 12:23:49 +0100
committerTomeu Vizoso <tomeu.vizoso@collabora.com>2012-06-08 09:55:58 +0200
commitaf198b7f40dc3b075ae0290c5de51671bf11246f (patch)
treef9004b225e8c8d0bb2f2271f84467df4f752cf1d
parent0a012b7efdb93f98e1d37b1194f16ba308a7a7e7 (diff)
downloadclutter-af198b7f40dc3b075ae0290c5de51671bf11246f.tar.gz
conform/events-touch: Silently bail out if init failed
This removes the need to conditionally run the test.
-rw-r--r--tests/conform/events-touch.c33
-rw-r--r--tests/conform/test-conform-main.c11
2 files changed, 26 insertions, 18 deletions
diff --git a/tests/conform/events-touch.c b/tests/conform/events-touch.c
index 80a0d1572..52ee4d7bf 100644
--- a/tests/conform/events-touch.c
+++ b/tests/conform/events-touch.c
@@ -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 ();
diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c
index ce61c3a38..699c3c4a0 100644
--- a/tests/conform/test-conform-main.c
+++ b/tests/conform/test-conform-main.c
@@ -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)
{
@@ -238,6 +231,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);
@@ -259,8 +254,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);