You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2010/01/22 17:40:13 UTC
svn commit: r902160 - in /subversion/trunk: build/run_tests.py win-tests.py
Author: julianfoad
Date: Fri Jan 22 16:40:13 2010
New Revision: 902160
URL: http://svn.apache.org/viewvc?rev=902160&view=rev
Log:
Make it easy to (re)run specific tests on windows by adding a --test/-t
option. The tests can also specify specific test number(s) to run.
* win-tests.py
(_usage_exit): Add the --test/-t option to the help.
(tests_to_run): New. List of tests to be run by the TestHarness.
* build/run_tests.py
(_run_test): Break the progname at a '#' and use the rhs as a list of
test numbers to run.
Patch by: Chris Foote <cafoote{_AT_}yahoo.com>
(tweaked by me)
Modified:
subversion/trunk/build/run_tests.py
subversion/trunk/win-tests.py
Modified: subversion/trunk/build/run_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/run_tests.py?rev=902160&r1=902159&r2=902160&view=diff
==============================================================================
--- subversion/trunk/build/run_tests.py (original)
+++ subversion/trunk/build/run_tests.py Fri Jan 22 16:40:13 2010
@@ -33,6 +33,10 @@
The optional flags and the first two parameters are passed unchanged
to the TestHarness constructor. All other parameters are names of
test programs.
+
+Each <prog> should be the full path (absolute or from the current directory)
+and filename of a test program, optionally followed by '#' and a comma-
+separated list of test numbers; the default is to run all the tests in it.
'''
import os, sys
@@ -216,11 +220,15 @@
else:
log = sys.stdout
+ test_nums = None
+ if '#' in prog:
+ prog, test_nums = prog.split('#')
+
progdir, progbase = os.path.split(prog)
if self.log:
# Using write here because we don't want even a trailing space
test_info = '%s [%d/%d]' % (progbase, test_nr + 1, total_tests)
- sys.stdout.write('Running all tests in %s' % (test_info, ))
+ sys.stdout.write('Running tests in %s' % (test_info, ))
sys.stdout.write('.'*(35 - len(test_info)))
log.write('START: %s\n' % progbase)
@@ -268,6 +276,10 @@
if self.fsfs_packing is not None:
cmdline.append('--fsfs-packing')
+ if test_nums:
+ test_nums = test_nums.split(',')
+ cmdline.extend(test_nums)
+
old_cwd = os.getcwd()
try:
os.chdir(progdir)
Modified: subversion/trunk/win-tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/win-tests.py?rev=902160&r1=902159&r2=902160&view=diff
==============================================================================
--- subversion/trunk/win-tests.py (original)
+++ subversion/trunk/win-tests.py Fri Jan 22 16:40:13 2010
@@ -61,6 +61,9 @@
print(" -v, --verbose : talk more")
print(" -f, --fs-type=type : filesystem type to use (fsfs is default)")
print(" -c, --cleanup : cleanup after running a test")
+ print(" -t, --test=TEST : Run the TEST test (all is default); use")
+ print(" TEST#n to run a particular test number,")
+ print(" multiples also accepted e.g. '2,4-7'")
print(" --svnserve-args=list : comma-separated list of arguments for")
print(" svnserve")
@@ -107,9 +110,9 @@
dll_basename = section.name + "-" + str(gen_obj.version) + ".dll"
svn_dlls.append(os.path.join("subversion", section.name, dll_basename))
-opts, args = my_getopt(sys.argv[1:], 'hrdvcpu:f:',
- ['release', 'debug', 'verbose', 'cleanup', 'url=',
- 'svnserve-args=', 'fs-type=', 'asp.net-hack',
+opts, args = my_getopt(sys.argv[1:], 'hrdvct:pu:f:',
+ ['release', 'debug', 'verbose', 'cleanup', 'test=',
+ 'url=', 'svnserve-args=', 'fs-type=', 'asp.net-hack',
'httpd-dir=', 'httpd-port=', 'httpd-daemon',
'httpd-server', 'http-library=', 'help',
'fsfs-packing', 'fsfs-sharding=',
@@ -137,6 +140,7 @@
fsfs_packing = None
server_minor_version = None
config_file = None
+tests_to_run = []
for opt, val in opts:
if opt in ('-h', '--help'):
@@ -149,6 +153,8 @@
verbose = 1
elif opt in ('-c', '--cleanup'):
cleanup = 1
+ elif opt in ('-t', '--test'):
+ tests_to_run.append(val)
elif opt in ['-r', '--release']:
objdir = 'Release'
elif opt in ['-d', '--debug']:
@@ -599,6 +605,32 @@
if daemon:
daemon.start()
+# Find the full path and filename of any test that is specified just by
+# its base name.
+if len(tests_to_run) != 0:
+ tests = []
+ for t in tests_to_run:
+ tns = None
+ if '#' in t:
+ t, tns = t.split('#')
+
+ test = [x for x in all_tests if x.split('/')[-1] == t]
+ if not test and not (t.endswith('-test.exe') or t.endswith('_tests.py')):
+ # The lengths of '-test.exe' and of '_tests.py' are both 9.
+ test = [x for x in all_tests if x.split('/')[-1][:-9] == t]
+
+ if not test:
+ print("Skipping test '%s', test not found." % t)
+ elif tns:
+ tests.append('%s#%s' % (test[0], tns))
+ else:
+ tests.extend(test)
+
+ tests_to_run = tests
+else:
+ tests_to_run = all_tests
+
+
print('Testing %s configuration on %s' % (objdir, repo_loc))
sys.path.insert(0, os.path.join(abs_srcdir, 'build'))
import run_tests
@@ -612,7 +644,7 @@
old_cwd = os.getcwd()
try:
os.chdir(abs_builddir)
- failed = th.run(all_tests)
+ failed = th.run(tests_to_run)
except:
os.chdir(old_cwd)
raise