From bf3262dd935ecbe72374311447de1f1c70a43fcc Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 16 Aug 2012 20:18:37 -0400 Subject: [PATCH] GTest: Improve --help output https://bugzilla.gnome.org/show_bug.cgi?id=550433 --- glib/gtester.c | 33 ++++++++++++------------- glib/gtestutils.c | 61 +++++++++++++++++++---------------------------- 2 files changed, 41 insertions(+), 53 deletions(-) diff --git a/glib/gtester.c b/glib/gtester.c index 279f6f27b..89f9294c0 100644 --- a/glib/gtester.c +++ b/glib/gtester.c @@ -474,23 +474,24 @@ usage (gboolean just_version) g_print ("gtester version %d.%d.%d\n", GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); return; } - g_print ("Usage: gtester [OPTIONS] testprogram...\n"); + g_print ("Usage:\n"); + g_print ("gtester [OPTIONS] testprogram...\n\n"); /* 12345678901234567890123456789012345678901234567890123456789012345678901234567890 */ - g_print ("Options:\n"); - g_print (" -h, --help show this help message\n"); - g_print (" -v, --version print version informations\n"); - g_print (" --g-fatal-warnings make warnings fatal (abort)\n"); - g_print (" -k, --keep-going continue running after tests failed\n"); - g_print (" -l list paths of available test cases\n"); - g_print (" -m=perf, -m=slow, -m=quick -m=thorough\n"); - g_print (" run test cases in mode perf, slow/thorough or quick (default)\n"); - g_print (" -m=no-undefined don't run test cases that provoke assertions\n"); - g_print (" -p=TESTPATH only start test cases matching TESTPATH\n"); - g_print (" -s=TESTPATH skip test cases matching TESTPATH\n"); - g_print (" --seed=SEEDSTRING start all tests with random number seed SEEDSTRING\n"); - g_print (" -o=LOGFILE write the test log to LOGFILE\n"); - g_print (" -q, --quiet suppress per test binary output\n"); - g_print (" --verbose report success per testcase\n"); + g_print ("Help Options:\n"); + g_print (" -h, --help Show this help message\n\n"); + g_print ("Utility Options:\n"); + g_print (" -v, --version Print version informations\n"); + g_print (" --g-fatal-warnings Make warnings fatal (abort)\n"); + g_print (" -k, --keep-going Continue running after tests failed\n"); + g_print (" -l List paths of available test cases\n"); + g_print (" -m {perf|slow|thorough|quick} Run test cases according to mode\n"); + g_print (" -m {undefined|no-undefined} Run test cases according to mode\n"); + g_print (" -p=TESTPATH Only start test cases matching TESTPATH\n"); + g_print (" -s=TESTPATH Skip test cases matching TESTPATH\n"); + g_print (" --seed=SEEDSTRING Start tests with random seed SEEDSTRING\n"); + g_print (" -o=LOGFILE Write the test log to LOGFILE\n"); + g_print (" -q, --quiet Suppress per test binary output\n"); + g_print (" --verbose Report success per testcase\n"); } static void diff --git a/glib/gtestutils.c b/glib/gtestutils.c index ffdbea33c..2e3b41584 100644 --- a/glib/gtestutils.c +++ b/glib/gtestutils.c @@ -784,26 +784,25 @@ parse_args (gint *argc_p, } argv[i] = NULL; } - else if (strcmp ("-?", argv[i]) == 0 || strcmp ("--help", argv[i]) == 0) + else if (strcmp ("-?", argv[i]) == 0 || + strcmp ("-h", argv[i]) == 0 || + strcmp ("--help", argv[i]) == 0) { printf ("Usage:\n" " %s [OPTION...]\n\n" "Help Options:\n" - " -?, --help Show help options\n" + " -h, --help Show help options\n\n" "Test Options:\n" + " --g-fatal-warnings Make all warnings fatal\n" " -l List test cases available in a test executable\n" - " -seed=RANDOMSEED Provide a random seed to reproduce test\n" - " runs using random numbers\n" - " --verbose Run tests verbosely\n" - " -q, --quiet Run tests quietly\n" - " -p TESTPATH execute all tests matching TESTPATH\n" - " -s TESTPATH skip all tests matching TESTPATH\n" - " -m {perf|slow|thorough|quick} Execute tests according modes\n" - " -m {undefined|no-undefined} Execute tests according modes\n" + " -m {perf|slow|thorough|quick} Execute tests according to mode\n" + " -m {undefined|no-undefined} Execute tests according to mode\n" + " -p TESTPATH Only start test cases matching TESTPATH\n" + " -s TESTPATH Skip all tests matching TESTPATH\n" + " -seed=SEEDSTRING Start tests with random seed SEEDSTRING\n" " --debug-log debug test logging output\n" - " -k, --keep-going gtester-specific argument\n" - " --GTestLogFD=N gtester-specific argument\n" - " --GTestSkipCount=N gtester-specific argument\n", + " -q, --quiet Run tests quietly\n" + " --verbose Run tests verbosely\n", argv[0]); exit (0); } @@ -836,57 +835,57 @@ parse_args (gint *argc_p, * * * - * list test cases available in a test executable. + * List test cases available in a test executable. * * * * * - * provide a random seed to reproduce test runs using random numbers. + * Provide a random seed to reproduce test runs using random numbers. * * * * - * run tests verbosely. + * Run tests verbosely. * * * , - * run tests quietly. + * Run tests quietly. * * * * - * execute all tests matching TESTPATH. + * Execute all tests matching TESTPATH. * * * * * - * execute tests according to these test modes: + * Execute tests according to these test modes: * * * perf * - * performance tests, may take long and report results. + * Performance tests, may take long and report results. * * * * slow, thorough * - * slow and thorough tests, may take quite long and + * Slow and thorough tests, may take quite long and * maximize coverage. * * * * quick * - * quick tests, should run really quickly and give good coverage. + * Quick tests, should run really quickly and give good coverage. * * * * undefined * - * tests for undefined behaviour, may provoke programming errors + * Tests for undefined behaviour, may provoke programming errors * under g_test_trap_fork() to check that appropriate assertions * or warnings are given * @@ -894,7 +893,7 @@ parse_args (gint *argc_p, * * no-undefined * - * avoid tests for undefined behaviour + * Avoid tests for undefined behaviour * * * @@ -902,19 +901,7 @@ parse_args (gint *argc_p, * * * - * debug test logging output. - * - * - * , - * gtester-specific argument. - * - * - * - * gtester-specific argument. - * - * - * - * gtester-specific argument. + * Debug test logging output. * * *