test/harness/loupe-test.c
changeset 99 783eff3047bc
parent 11 4a80c6053a66
child 102 ff0aa9b1397a
     1.1 --- a/test/harness/loupe-test.c	Mon Jan 30 23:32:47 2012 +0000
     1.2 +++ b/test/harness/loupe-test.c	Sat Oct 05 21:37:31 2013 +0100
     1.3 @@ -6,6 +6,14 @@
     1.4  #include "testcase.h"
     1.5  #include "testcaseio.h"
     1.6  
     1.7 +static gboolean show_output;
     1.8 +
     1.9 +static GOptionEntry options[]={
    1.10 +    { "show-output", 'o', 0, G_OPTION_ARG_NONE, &show_output,
    1.11 +      "Show bookloupe output", NULL },
    1.12 +    { NULL }
    1.13 +};
    1.14 +
    1.15  /*
    1.16   * Returns FALSE if the test should be considered to have failed.
    1.17   * (returns TRUE on pass or expected-fail).
    1.18 @@ -17,7 +25,10 @@
    1.19      testcase=testcase_parse_file(filename);
    1.20      if (!testcase)
    1.21  	return FALSE;
    1.22 -    retval=testcase_run(testcase);
    1.23 +    if (show_output)
    1.24 +	retval=testcase_show_output(testcase);
    1.25 +    else
    1.26 +	retval=testcase_run(testcase);
    1.27      testcase_free(testcase);
    1.28      return retval;
    1.29  }
    1.30 @@ -26,6 +37,16 @@
    1.31  {
    1.32      int i;
    1.33      gboolean pass=TRUE;
    1.34 +    GError *err=NULL;
    1.35 +    GOptionContext *context;
    1.36 +    context=g_option_context_new("file - run a bookloupe testcase");
    1.37 +    g_option_context_add_main_entries(context,options,NULL);
    1.38 +    if (!g_option_context_parse(context,&argc,&argv,&err))
    1.39 +    {
    1.40 +	g_printerr("loupe-test: %s\n",err->message);
    1.41 +	g_printerr("Use \"%s --help\" for help\n",argv[0]);
    1.42 +	exit(1);
    1.43 +    }
    1.44      bl_set_print_handlers();
    1.45      for(i=1;i<argc;i++)
    1.46  	pass&=run_test(argv[i]);