[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Add the --help option for the test suite.

From: Madan U Sreenivasan <madan_at_collab.net>
Date: 2006-05-24 19:35:50 CEST

[[[
Add the --help option for the test suite.

Review by: djames

* subversion/tests/cmdline/svntest/main.py
   (usage): New function to print usage information.
   (run_tests): Implemented the `--help' option.
]]]

Index: subversion/tests/cmdline/svntest/main.py
===================================================================
--- subversion/tests/cmdline/svntest/main.py (revision 19800)
+++ subversion/tests/cmdline/svntest/main.py (working copy)
@@ -767,6 +767,31 @@
   return exit_code
 
 
+def usage(testscript):
+ """Print the usage information for the given testscript.
+ The arguments/options list is the same for all tests."""
+
+ usage_str = """usage: %s [options] [arguments]
+If the `testnum' argument is provided, execute that test.
+Otherwise execute all the tests in %s.
+
+Available options are:
+ --help : Print this usage message.
+ --url arg : Use ARG as the base url for test execution.
+ --list : List the tests available in %s.
+ --fs-type arg : Create repositories using fs backend ARG.
+ ARG could be either 'bdb' (default) or 'fsfs'.
+ -v [--verbose] : Print verbose output.
+ --cleanup : Cleanup the data leftover from the earlier
+ test executions.
+
+Available arguments are:
+ testnum : A valid test case number.
+ list : The deprecated form of --list.
+ BASE_URL=arg : An alternate form of --url.\n""" \
+ % (testscript, testscript, testscript)
+ print usage_str
+
 # Main func. This is the "entry point" that all the test scripts call
 # to run their list of tests.
 #
@@ -790,6 +815,7 @@
   global fs_type
   global verbose_mode
   global cleanup_mode
+ print_usage = False
   testnums = []
   # Should the tests be listed (as opposed to executed)?
   list_tests = 0
@@ -799,7 +825,9 @@
   os.environ['SVN_EDITOR'] = ''
 
   opts, args = my_getopt(sys.argv[1:], 'v',
- ['url=', 'fs-type=', 'verbose', 'cleanup', 'list'])
+ ['url=', 'fs-type=', 'verbose', 'cleanup', 'list',
+ 'help'])
+ cmd = os.path.basename(sys.argv[0])
 
   for arg in args:
     if arg == "list":
@@ -811,6 +839,9 @@
       testnums.append(int(arg))
 
   for opt, val in opts:
+ if opt == "--help":
+ print_usage = True
+
     if opt == "--url":
       test_area_url = val
 
@@ -826,6 +857,10 @@
     elif opt == "--list":
       list_tests = 1
 
+ if print_usage:
+ usage(cmd)
+ sys.exit(0)
+
   if test_area_url[-1:] == '/': # Normalize url to have no trailing slash
     test_area_url = test_area_url[:-1]
 

Add the --help option for the test suite.

Review by: djames

* subversion/tests/cmdline/svntest/main.py
  (usage): New function to print usage information.
  (run_tests): Implemented the `--help' option.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed May 24 19:05:40 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.