Changeset 3b4cc8f for tests


Ignore:
Timestamp:
2006-12-06T13:34:15Z (18 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
7bcdde3
Parents:
6a90967
Message:

Support arguments passed to tests/check to enable verbose logging or
to disable forking (for debugging purposes).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/check.c

    r6a90967 r3b4cc8f  
    3838Suite *md5_suite(void);
    3939
    40 int main (void)
     40int main (int argc, char **argv)
    4141{
    4242        int nf;
    43         SRunner *sr = srunner_create(util_suite());
     43        SRunner *sr;
     44        GOptionContext *pc;
     45        gboolean no_fork = FALSE;
     46        gboolean verbose = FALSE;
     47        GOptionEntry options[] = {
     48                {"no-fork", 'n', 0, G_OPTION_ARG_NONE, &no_fork, "Don't fork" },
     49                {"verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Be verbose", NULL },
     50                { NULL }
     51        };
     52        int i;
     53
     54        pc = g_option_context_new("");
     55        g_option_context_add_main_entries(pc, options, NULL);
     56
     57        if(!g_option_context_parse(pc, &argc, &argv, NULL))
     58                return 1;
     59
     60        g_option_context_free(pc);
     61
     62
     63        sr = srunner_create(util_suite());
    4464        srunner_add_suite(sr, nick_suite());
    4565        srunner_add_suite(sr, md5_suite());
    46         srunner_run_all (sr, CK_NORMAL);
     66        if (no_fork)
     67                srunner_set_fork_status(sr, CK_NOFORK);
     68        srunner_run_all (sr, verbose?CK_VERBOSE:CK_NORMAL);
    4769        nf = srunner_ntests_failed(sr);
    4870        srunner_free(sr);
Note: See TracChangeset for help on using the changeset viewer.