[134] | 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- |
---|
| 2 | * |
---|
| 3 | * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu> |
---|
| 4 | * |
---|
| 5 | * This library is free software; you can redistribute it and/or |
---|
| 6 | * modify it under the terms of the GNU Library General Public |
---|
| 7 | * License as published by the Free Software Foundation; either |
---|
| 8 | * version 2 of the License, or (at your option) any later version. |
---|
| 9 | * |
---|
| 10 | * This library is distributed in the hope that it will be useful, |
---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 13 | * Library General Public License for more details. |
---|
| 14 | * |
---|
| 15 | * You should have received a copy of the GNU Library General Public |
---|
| 16 | * License along with this library; if not, write to the |
---|
| 17 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
| 18 | * Boston, MA 02111-1307, USA. |
---|
| 19 | */ |
---|
| 20 | |
---|
| 21 | #include <stdlib.h> |
---|
| 22 | #include <glib/gi18n.h> |
---|
| 23 | #include <glib.h> |
---|
| 24 | #include <glib-object.h> |
---|
| 25 | |
---|
| 26 | #include "s-common-address.h" |
---|
| 27 | #include "s-common-utils.h" |
---|
| 28 | |
---|
| 29 | static gboolean no_fork = FALSE; |
---|
| 30 | static gboolean verbose = FALSE; |
---|
| 31 | |
---|
| 32 | static GOptionEntry entries[] = { |
---|
| 33 | {"no-fork", 0, 0, G_OPTION_ARG_NONE, &no_fork, "Don't fork individual tests", NULL}, |
---|
| 34 | {"verbose", 0, 0, G_OPTION_ARG_NONE, &verbose, "Enable verbose output", NULL}, |
---|
| 35 | {NULL} |
---|
| 36 | }; |
---|
| 37 | |
---|
| 38 | int |
---|
| 39 | main (int argc, char **argv) |
---|
| 40 | { |
---|
| 41 | GOptionContext *context; |
---|
| 42 | SRunner *r; |
---|
| 43 | int failed; |
---|
| 44 | GError *error; |
---|
| 45 | |
---|
| 46 | failed = 0; |
---|
| 47 | |
---|
| 48 | g_type_init (); |
---|
| 49 | |
---|
| 50 | context = g_option_context_new (""); |
---|
| 51 | g_option_context_add_main_entries (context, entries, NULL); |
---|
| 52 | error = NULL; |
---|
| 53 | g_option_context_parse (context, &argc, &argv, &error); |
---|
| 54 | g_option_context_free (context); |
---|
| 55 | |
---|
| 56 | if (error != NULL) { |
---|
| 57 | g_warning ("%s", error->message); |
---|
| 58 | g_error_free (error); |
---|
| 59 | exit (1); |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | r = srunner_create (suite_common_utils ()); |
---|
| 63 | srunner_add_suite (r, suite_common_address ()); |
---|
| 64 | |
---|
| 65 | if (no_fork) { |
---|
| 66 | srunner_set_fork_status (r, CK_NOFORK); |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | srunner_run_all (r, verbose ? CK_VERBOSE : CK_NORMAL); |
---|
| 70 | failed = srunner_ntests_failed (r); |
---|
| 71 | srunner_free (r); |
---|
| 72 | |
---|
| 73 | return failed != 0; |
---|
| 74 | } |
---|