subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From phi...@apache.org
Subject svn commit: r1033646 - /subversion/trunk/subversion/tests/cmdline/svntest/main.py
Date Wed, 10 Nov 2010 19:09:05 GMT
Author: philip
Date: Wed Nov 10 19:09:05 2010
New Revision: 1033646

URL: http://svn.apache.org/viewvc?rev=1033646&view=rev
Log:
Make sure that serial_only tests can obtain srcdir from sys.argv[0].

* subversion/tests/cmdline/svntest/main.py
  (TestSpawningThread::__init__): Remove srcdir.
  (TestSpawningThread::run_one): Don't join to srcdir.
  (_internal_run_tests): Set sys.argv[0] to include srcdir.

Modified:
    subversion/trunk/subversion/tests/cmdline/svntest/main.py

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1033646&r1=1033645&r2=1033646&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Wed Nov 10 19:09:05 2010
@@ -1092,9 +1092,8 @@ 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, srcdir, queue):
+  def __init__(self, queue):
     threading.Thread.__init__(self)
-    self.srcdir = srcdir
     self.queue = queue
     self.results = []
 
@@ -1108,11 +1107,7 @@ class TestSpawningThread(threading.Threa
       self.run_one(next_index)
 
   def run_one(self, index):
-    if self.srcdir:
-      command = os.path.join(self.srcdir, 'subversion/tests/cmdline',
-                             sys.argv[0])
-    else:
-      command = os.path.abspath(sys.argv[0])
+    command = os.path.abspath(sys.argv[0])
 
     args = []
     args.append(str(index))
@@ -1294,6 +1289,12 @@ def _internal_run_tests(test_list, testn
   finished_tests = []
   tests_started = 0
 
+  # Some of the tests use sys.argv[0] to locate their test data
+  # directory.  Perhaps we should just be passing srcdir to the tests?
+  if srcdir:
+    sys.argv[0] = os.path.join(srcdir, 'subversion', 'tests', 'cmdline',
+                               sys.argv[0])
+
   if not parallel:
     for i, testnum in enumerate(testnums):
       if run_one_test(testnum, test_list) == 1:
@@ -1306,8 +1307,7 @@ def _internal_run_tests(test_list, testn
     for num in testnums:
       number_queue.put(num)
 
-    threads = [ TestSpawningThread(srcdir, number_queue)
-                for i in range(parallel) ]
+    threads = [ TestSpawningThread(number_queue) for i in range(parallel) ]
     for t in threads:
       t.start()
 



Mime
View raw message