summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas James Alexander Thurman <tthurman@src.gnome.org>2009-01-23 04:32:36 +0000
committerThomas James Alexander Thurman <tthurman@src.gnome.org>2009-01-23 04:32:36 +0000
commit76fa22ad6b955c173949311e00554c149bd6f07a (patch)
treece9b2b71ef2b1fbcf214426df63dd0a994754041
parentb4fe3c8356a09a751dc4214662e9525fab6af2cb (diff)
downloadmetacity-veracity.tar.gz
some basic option parsingveracity
* test/veracity/veracity.c: some basic option parsing svn path=/branches/veracity/; revision=4086
-rw-r--r--ChangeLog4
-rw-r--r--test/veracity/veracity.c47
2 files changed, 41 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 1964e626..bd0411c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2009-01-22 Thomas Thurman <tthurman@gnome.org>
+ * test/veracity/veracity.c: some basic option parsing
+
+2009-01-22 Thomas Thurman <tthurman@gnome.org>
+
Fix autotools thanks to Andreas Dalsgaard;
fix veracity.c to let it compile under our setup.
diff --git a/test/veracity/veracity.c b/test/veracity/veracity.c
index 31ab5102..794aef2d 100644
--- a/test/veracity/veracity.c
+++ b/test/veracity/veracity.c
@@ -30,6 +30,8 @@
#include <strings.h>
#include <stdlib.h>
#include <gconf/gconf.h>
+#include <glib.h>
+#include <gtk/gtk.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@@ -147,8 +149,8 @@ gconf_test (char *test)
static void
die (const char *reason)
{
- fprintf (stderr, "Fatal error: %s\n", reason);
- exit (255);
+ g_error ("Fatal error: %s\n", reason);
+ exit (EXIT_FAILURE);
}
static void
@@ -160,9 +162,7 @@ start_dbus_daemon ()
ssize_t size;
if (pipe (pipes)==-1)
- {
- die ("Can't create pipes to talk to dbus");
- }
+ die ("Can't create pipes to talk to dbus");
if (!(dbus_daemon = fork()))
{
@@ -292,16 +292,43 @@ finish ()
XCloseDisplay (current_display);
}
+gboolean list = FALSE;
+gboolean naked = FALSE;
+
+static GOptionEntry entries[] =
+ {
+ { "list-tests", 'l', 0, G_OPTION_ARG_NONE, &list, "List all available tests", NULL },
+ { "naked", 'n', 0, G_OPTION_ARG_NONE, &naked, "Don't hide the X server when it runs", NULL },
+ { NULL }
+ };
+
int
main (int argc, char *argv[])
{
- start ();
+ GError *error = NULL;
+ GOptionContext *context = g_option_context_new ("- test metacity");
+
+ g_option_context_add_main_entries (context, entries, /*GETTEXT_PACKAGE*/"veracity");
+ g_option_context_add_group (context, gtk_get_option_group (TRUE));
+ if (!g_option_context_parse (context, &argc, &argv, &error))
+ die (error->message);
+
+ if (list)
+ {
+ die ("List mode not implemented.");
+ }
+ else
+ {
+ start ();
+
+ run_test ("unit/reparent.scm");
- run_test ("001-reparent.scm");
+ finish ();
- finish ();
+ /* I'm making a note here: HUGE SUCCESS. */
+ exit(EXIT_SUCCESS);
+ }
- /* I'm making a note here: HUGE SUCCESS. */
- exit(EXIT_SUCCESS);
+ exit(EXIT_FAILURE);
}