From e38b63a4dac98c4c37cc6d4fc19e468d2a662699 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Thu, 13 Mar 2014 08:21:32 +0300 Subject: runtest.py: Show usage lines on error, improve help message --- runtest.py | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/runtest.py b/runtest.py index 393c880..9bb3ada 100755 --- a/runtest.py +++ b/runtest.py @@ -18,10 +18,9 @@ # # -3 Run with the python -3 option, # -# -a Run all tests; does a virtual 'find' for -# all SCons tests under the current directory. -# You can also specify a list of subdirectories. Then, -# only the given folders are searched for test files. +# -a Run all tests found under the current directory. +# It is also possible to specify a list of +# subdirectories to search. # # -d Debug. Runs the script under the Python # debugger (pdb.py) so you don't have to @@ -33,8 +32,6 @@ # -f file Only execute the tests listed in the specified # file. # -# -h Print the help and exit. -# # -k Suppress printing of count and percent progress for # the single tests. # @@ -124,8 +121,11 @@ suppress_stderr = False allow_pipe_files = True quit_on_failure = False -helpstr = """\ +usagestr = """\ Usage: runtest.py [OPTIONS] [TEST ...] + runtest.py -h|--help +""" +helpstr = usagestr + """\ Options: -3 Warn about Python 3.x incompatibilities. -a, --all Run all tests. @@ -134,7 +134,6 @@ Options: -d, --debug Run test scripts under the Python debugger. -e, --external Run the script in external mode (for testing separate Tools) -f FILE, --file FILE Run tests in specified FILE. - -h, --help Print this message and exit. -k, --no-progress Suppress count and percent progress messages. -l, --list List available tests and exit. -n, --no-exec No execute, just print command lines. @@ -145,8 +144,7 @@ Options: run into some deadlocks else. -o FILE, --output FILE Save the output from a test run to the log file. -P Python Use the specified Python interpreter. - -p PACKAGE, --package PACKAGE - Test against the specified PACKAGE: + -p, --package PACKAGE Test against the specified PACKAGE: deb Debian local-tar-gz .tar.gz standalone package local-zip .zip standalone package @@ -173,7 +171,7 @@ Options: Environment Variables: PRESERVE, PRESERVE_{PASS,FAIL,NO_RESULT}: preserve test subdirs - TESTCMD_VERBOSE: turn on verbosity in TestCommand + TESTCMD_VERBOSE: turn on verbosity in TestCommand\ """ @@ -282,12 +280,10 @@ for o, a in opts: scons = a if not args and not options.all and not testlistfile: - sys.stderr.write("""\ + sys.stderr.write(usagestr + """ runtest.py: No tests were specified. - List one or more tests on the command line, use the - -f option to specify a file containing a list of tests, - or use the -a option to find and run all tests. - + Tests can be specified on the command line, read from file + with -f option, or discovered with -a to run all tests. """) sys.exit(1) -- cgit v0.12