[clutter] conform/events-touch: Silently bail out if init failed
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] conform/events-touch: Silently bail out if init failed
- Date: Thu, 7 Jun 2012 11:32:33 +0000 (UTC)
commit 1ab6fc0b39abb646b787eb1d12b46c6cb967db8d
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Thu Jun 7 12:23:49 2012 +0100
conform/events-touch: Silently bail out if init failed
This removes the need to conditionally run the test.
tests/conform/events-touch.c | 33 ++++++++++++++++++++++++---------
tests/conform/test-conform-main.c | 11 ++---------
2 files changed, 26 insertions(+), 18 deletions(-)
---
diff --git a/tests/conform/events-touch.c b/tests/conform/events-touch.c
index 80a0d15..52ee4d7 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 54afb57..41922c0 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)
{
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]