You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2010/11/09 12:45:48 UTC
svn commit: r1032940 - in /subversion/branches/py-tests-as-modules:
build/run_tests.py subversion/tests/cmdline/svntest/main.py
Author: rhuijben
Date: Tue Nov 9 11:45:47 2010
New Revision: 1032940
URL: http://svn.apache.org/viewvc?rev=1032940&view=rev
Log:
On the py-tests-as-modules branch:
Fix running the tests in parallel mode on Windows (out-of-tree tests) by
passing a --srcdir argument between the modules.
* build/run_tests.py
(_run_py_test): Initialize the srcdir on the options class.
* subversion/tests/cmdline/svntest/main.py
(_run_py_test::__init__): Store srcdir.
(_run_py_test::run_one): Use srcdir instead of cwd.
(_internal_run_tests): Pass srcdir to threads.
(_create_parser): Add srcdir argument.
(execute_tests): Pass srcdir to the test runner.
Modified:
subversion/branches/py-tests-as-modules/build/run_tests.py
subversion/branches/py-tests-as-modules/subversion/tests/cmdline/svntest/main.py
Modified: subversion/branches/py-tests-as-modules/build/run_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/py-tests-as-modules/build/run_tests.py?rev=1032940&r1=1032939&r2=1032940&view=diff
==============================================================================
--- subversion/branches/py-tests-as-modules/build/run_tests.py (original)
+++ subversion/branches/py-tests-as-modules/build/run_tests.py Tue Nov 9 11:45:47 2010
@@ -325,6 +325,8 @@ class TestHarness:
if self.fsfs_packing is not None:
svntest.main.options.fsfs_packing = self.fsfs_packing
+ svntest.main.options.srcdir = self.srcdir
+
# setup the output pipes
if self.log:
sys.stdout.flush()
Modified: subversion/branches/py-tests-as-modules/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/branches/py-tests-as-modules/subversion/tests/cmdline/svntest/main.py?rev=1032940&r1=1032939&r2=1032940&view=diff
==============================================================================
--- subversion/branches/py-tests-as-modules/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/branches/py-tests-as-modules/subversion/tests/cmdline/svntest/main.py Tue Nov 9 11:45:47 2010
@@ -1099,8 +1099,9 @@ class TestSpawningThread(threading.Threa
"""A thread that runs test cases in their own processes.
Receives test numbers to run from the queue, and saves results into
the results field."""
- def __init__(self, queue):
+ def __init__(self, srcdir, queue):
threading.Thread.__init__(self)
+ self.srcdir = srcdir
self.queue = queue
self.results = []
@@ -1114,8 +1115,8 @@ class TestSpawningThread(threading.Threa
self.run_one(next_index)
def run_one(self, index):
- command = os.path.join(os.getcwd(), sys.argv[0])
-
+ command = os.path.join(self.srcdir, 'subversion/tests/cmdline',
+ sys.argv[0])
args = []
args.append(str(index))
args.append('-c')
@@ -1284,7 +1285,7 @@ def run_one_test(n, test_list, finished_
exit_code = TestRunner(test_list[n], n).run()
return exit_code
-def _internal_run_tests(test_list, testnums, parallel, progress_func):
+def _internal_run_tests(test_list, testnums, parallel, srcdir, progress_func):
"""Run the tests from TEST_LIST whose indices are listed in TESTNUMS.
If we're running the tests in parallel spawn as much parallel processes
@@ -1308,7 +1309,8 @@ def _internal_run_tests(test_list, testn
for num in testnums:
number_queue.put(num)
- threads = [ TestSpawningThread(number_queue) for i in range(parallel) ]
+ threads = [ TestSpawningThread(srcdir, number_queue)
+ for i in range(parallel) ]
for t in threads:
t.start()
@@ -1400,6 +1402,8 @@ def _create_parser():
'test output and ignores all exceptions in the ' +
'run_and_verify* functions. This option is only ' +
'useful during test development!')
+ parser.add_option('--srcdir', action='store', dest='srcdir',
+ help='Source directory.')
# most of the defaults are None, but some are other values, set them here
parser.set_defaults(
@@ -1582,7 +1586,7 @@ def execute_tests(test_list, serial_only
# Run the tests.
exit_code = _internal_run_tests(test_list, testnums, options.parallel,
- progress_func)
+ options.srcdir, progress_func)
# Remove all scratchwork: the 'pristine' repository, greek tree, etc.
# This ensures that an 'import' will happen the next time we run.