summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2009-06-26 12:02:31 +0200
committerDamien Lespiau <damien.lespiau@intel.com>2009-06-26 12:02:31 +0200
commitea5e74aebad96c373c18618d12f2dc042fe01427 (patch)
tree3debe0cc68c36ab3c05bfe0635052e6ae6f0a61f /tests
parentf4566fc57b6472e38dc962fe2d0c231325a2f77d (diff)
downloadclutter-gst-ea5e74aebad96c373c18618d12f2dc042fe01427.tar.gz
[tests] Check for errors in g_option_context_parse()
./tests/test-yuv-upload -f1 made the test segfault for instance. Checking for errors helps a lot, who knew?
Diffstat (limited to 'tests')
-rw-r--r--tests/test-rgb-upload.c13
-rw-r--r--tests/test-yuv-upload.c13
2 files changed, 22 insertions, 4 deletions
diff --git a/tests/test-rgb-upload.c b/tests/test-rgb-upload.c
index ba20b5d..8491f5a 100644
--- a/tests/test-rgb-upload.c
+++ b/tests/test-rgb-upload.c
@@ -102,6 +102,7 @@ int
main (int argc, char *argv[])
{
GOptionContext *context;
+ GError *error = NULL;
gboolean result;
ClutterActor *stage;
ClutterActor *texture;
@@ -118,7 +119,15 @@ main (int argc, char *argv[])
g_option_context_add_group (context, gst_init_get_option_group ());
g_option_context_add_group (context, clutter_get_option_group ());
g_option_context_add_main_entries (context, options, NULL);
- g_option_context_parse (context, &argc, &argv, NULL);
+
+ if (!g_option_context_parse (context, &argc, &argv, &error))
+ {
+ g_option_context_free (context);
+
+ g_print ("%s\n", error->message);
+ g_error_free (error);
+ exit(EXIT_FAILURE);
+ }
stage = clutter_stage_get_default ();
clutter_actor_set_size (CLUTTER_ACTOR (stage), 320.0f, 240.0f);
@@ -167,5 +176,5 @@ main (int argc, char *argv[])
clutter_main();
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/tests/test-yuv-upload.c b/tests/test-yuv-upload.c
index a319f5e..abc399e 100644
--- a/tests/test-yuv-upload.c
+++ b/tests/test-yuv-upload.c
@@ -101,6 +101,7 @@ int
main (int argc, char *argv[])
{
GOptionContext *context;
+ GError *error = NULL;
gboolean result;
ClutterActor *stage;
ClutterActor *texture;
@@ -117,7 +118,15 @@ main (int argc, char *argv[])
g_option_context_add_group (context, gst_init_get_option_group ());
g_option_context_add_group (context, clutter_get_option_group ());
g_option_context_add_main_entries (context, options, NULL);
- g_option_context_parse (context, &argc, &argv, NULL);
+
+ if (!g_option_context_parse (context, &argc, &argv, &error))
+ {
+ g_option_context_free (context);
+
+ g_print ("%s\n", error->message);
+ g_error_free (error);
+ exit(EXIT_FAILURE);
+ }
stage = clutter_stage_get_default ();
clutter_actor_set_size (CLUTTER_ACTOR(stage), 320.0f, 240.0f);
@@ -162,5 +171,5 @@ main (int argc, char *argv[])
clutter_main();
- return 0;
+ return EXIT_SUCCESS;
}