GTest: Improve --help output

https://bugzilla.gnome.org/show_bug.cgi?id=550433
This commit is contained in:
Matthias Clasen 2012-08-16 20:18:37 -04:00
parent 55ca95c220
commit bf3262dd93
2 changed files with 41 additions and 53 deletions

View File

@ -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); g_print ("gtester version %d.%d.%d\n", GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
return; return;
} }
g_print ("Usage: gtester [OPTIONS] testprogram...\n"); g_print ("Usage:\n");
g_print ("gtester [OPTIONS] testprogram...\n\n");
/* 12345678901234567890123456789012345678901234567890123456789012345678901234567890 */ /* 12345678901234567890123456789012345678901234567890123456789012345678901234567890 */
g_print ("Options:\n"); g_print ("Help Options:\n");
g_print (" -h, --help show this help message\n"); g_print (" -h, --help Show this help message\n\n");
g_print (" -v, --version print version informations\n"); g_print ("Utility Options:\n");
g_print (" --g-fatal-warnings make warnings fatal (abort)\n"); g_print (" -v, --version Print version informations\n");
g_print (" -k, --keep-going continue running after tests failed\n"); g_print (" --g-fatal-warnings Make warnings fatal (abort)\n");
g_print (" -l list paths of available test cases\n"); g_print (" -k, --keep-going Continue running after tests failed\n");
g_print (" -m=perf, -m=slow, -m=quick -m=thorough\n"); g_print (" -l List paths of available test cases\n");
g_print (" run test cases in mode perf, slow/thorough or quick (default)\n"); g_print (" -m {perf|slow|thorough|quick} Run test cases according to mode\n");
g_print (" -m=no-undefined don't run test cases that provoke assertions\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 (" -p=TESTPATH Only start test cases matching TESTPATH\n");
g_print (" -s=TESTPATH skip 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 (" --seed=SEEDSTRING Start tests with random seed SEEDSTRING\n");
g_print (" -o=LOGFILE write the test log to LOGFILE\n"); g_print (" -o=LOGFILE Write the test log to LOGFILE\n");
g_print (" -q, --quiet suppress per test binary output\n"); g_print (" -q, --quiet Suppress per test binary output\n");
g_print (" --verbose report success per testcase\n"); g_print (" --verbose Report success per testcase\n");
} }
static void static void

View File

@ -784,26 +784,25 @@ parse_args (gint *argc_p,
} }
argv[i] = NULL; 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" printf ("Usage:\n"
" %s [OPTION...]\n\n" " %s [OPTION...]\n\n"
"Help Options:\n" "Help Options:\n"
" -?, --help Show help options\n" " -h, --help Show help options\n\n"
"Test Options:\n" "Test Options:\n"
" --g-fatal-warnings Make all warnings fatal\n"
" -l List test cases available in a test executable\n" " -l List test cases available in a test executable\n"
" -seed=RANDOMSEED Provide a random seed to reproduce test\n" " -m {perf|slow|thorough|quick} Execute tests according to mode\n"
" runs using random numbers\n" " -m {undefined|no-undefined} Execute tests according to mode\n"
" --verbose Run tests verbosely\n" " -p TESTPATH Only start test cases matching TESTPATH\n"
" -q, --quiet Run tests quietly\n" " -s TESTPATH Skip all tests matching TESTPATH\n"
" -p TESTPATH execute all tests matching TESTPATH\n" " -seed=SEEDSTRING Start tests with random seed SEEDSTRING\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"
" --debug-log debug test logging output\n" " --debug-log debug test logging output\n"
" -k, --keep-going gtester-specific argument\n" " -q, --quiet Run tests quietly\n"
" --GTestLogFD=N gtester-specific argument\n" " --verbose Run tests verbosely\n",
" --GTestSkipCount=N gtester-specific argument\n",
argv[0]); argv[0]);
exit (0); exit (0);
} }
@ -836,57 +835,57 @@ parse_args (gint *argc_p,
* <varlistentry> * <varlistentry>
* <term><option>-l</option></term> * <term><option>-l</option></term>
* <listitem><para> * <listitem><para>
* list test cases available in a test executable. * List test cases available in a test executable.
* </para></listitem> * </para></listitem>
* </varlistentry> * </varlistentry>
* <varlistentry> * <varlistentry>
* <term><option>--seed=<replaceable>RANDOMSEED</replaceable></option></term> * <term><option>--seed=<replaceable>RANDOMSEED</replaceable></option></term>
* <listitem><para> * <listitem><para>
* provide a random seed to reproduce test runs using random numbers. * Provide a random seed to reproduce test runs using random numbers.
* </para></listitem> * </para></listitem>
* </varlistentry> * </varlistentry>
* <varlistentry> * <varlistentry>
* <term><option>--verbose</option></term> * <term><option>--verbose</option></term>
* <listitem><para>run tests verbosely.</para></listitem> * <listitem><para>Run tests verbosely.</para></listitem>
* </varlistentry> * </varlistentry>
* <varlistentry> * <varlistentry>
* <term><option>-q</option>, <option>--quiet</option></term> * <term><option>-q</option>, <option>--quiet</option></term>
* <listitem><para>run tests quietly.</para></listitem> * <listitem><para>Run tests quietly.</para></listitem>
* </varlistentry> * </varlistentry>
* <varlistentry> * <varlistentry>
* <term><option>-p <replaceable>TESTPATH</replaceable></option></term> * <term><option>-p <replaceable>TESTPATH</replaceable></option></term>
* <listitem><para> * <listitem><para>
* execute all tests matching <replaceable>TESTPATH</replaceable>. * Execute all tests matching <replaceable>TESTPATH</replaceable>.
* </para></listitem> * </para></listitem>
* </varlistentry> * </varlistentry>
* <varlistentry> * <varlistentry>
* <term><option>-m {perf|slow|thorough|quick|undefined|no-undefined}</option></term> * <term><option>-m {perf|slow|thorough|quick|undefined|no-undefined}</option></term>
* <listitem><para> * <listitem><para>
* execute tests according to these test modes: * Execute tests according to these test modes:
* <variablelist> * <variablelist>
* <varlistentry> * <varlistentry>
* <term>perf</term> * <term>perf</term>
* <listitem><para> * <listitem><para>
* performance tests, may take long and report results. * Performance tests, may take long and report results.
* </para></listitem> * </para></listitem>
* </varlistentry> * </varlistentry>
* <varlistentry> * <varlistentry>
* <term>slow, thorough</term> * <term>slow, thorough</term>
* <listitem><para> * <listitem><para>
* slow and thorough tests, may take quite long and * Slow and thorough tests, may take quite long and
* maximize coverage. * maximize coverage.
* </para></listitem> * </para></listitem>
* </varlistentry> * </varlistentry>
* <varlistentry> * <varlistentry>
* <term>quick</term> * <term>quick</term>
* <listitem><para> * <listitem><para>
* quick tests, should run really quickly and give good coverage. * Quick tests, should run really quickly and give good coverage.
* </para></listitem> * </para></listitem>
* </varlistentry> * </varlistentry>
* <varlistentry> * <varlistentry>
* <term>undefined</term> * <term>undefined</term>
* <listitem><para> * <listitem><para>
* 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 * under g_test_trap_fork() to check that appropriate assertions
* or warnings are given * or warnings are given
* </para></listitem> * </para></listitem>
@ -894,7 +893,7 @@ parse_args (gint *argc_p,
* <varlistentry> * <varlistentry>
* <term>no-undefined</term> * <term>no-undefined</term>
* <listitem><para> * <listitem><para>
* avoid tests for undefined behaviour * Avoid tests for undefined behaviour
* </para></listitem> * </para></listitem>
* </varlistentry> * </varlistentry>
* </variablelist> * </variablelist>
@ -902,19 +901,7 @@ parse_args (gint *argc_p,
* </varlistentry> * </varlistentry>
* <varlistentry> * <varlistentry>
* <term><option>--debug-log</option></term> * <term><option>--debug-log</option></term>
* <listitem><para>debug test logging output.</para></listitem> * <listitem><para>Debug test logging output.</para></listitem>
* </varlistentry>
* <varlistentry>
* <term><option>-k</option>, <option>--keep-going</option></term>
* <listitem><para>gtester-specific argument.</para></listitem>
* </varlistentry>
* <varlistentry>
* <term><option>--GTestLogFD <replaceable>N</replaceable></option></term>
* <listitem><para>gtester-specific argument.</para></listitem>
* </varlistentry>
* <varlistentry>
* <term><option>--GTestSkipCount <replaceable>N</replaceable></option></term>
* <listitem><para>gtester-specific argument.</para></listitem>
* </varlistentry> * </varlistentry>
* </variablelist> * </variablelist>
* *