Author: stsp
Date: Wed Sep 19 11:52:46 2012
New Revision: 1387534

URL: http://svn.apache.org/viewvc?rev=1387534&view=rev
Log:
Improve progress reporting for python tests during make check PARALLEL=1.

In parallel mode, progress was only reported when all tests from a single
python test file had finished, which somewhat defeats the purpose of
having progress reporting :)

* subversion/tests/cmdline/svntest/main.py
  (TestSpawningThread.__init__): Add progress_func and tests_total params,
    store them in self.
  (TestSpawningThread.run): Signal progress after pulling a test from the
   test queue and running it, based on the number of tests left in the
   queue and the total number of tests to be run.
  (_internal_run_tests): Pass newly expected parameters to the test spawning
   thread and stop calling progress_func here.

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=1387534&r1=1387533&r2=1387534&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Wed Sep 19 
11:52:46 2012
@@ -1229,10 +1229,12 @@ 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, queue, progress_func, tests_total):
     threading.Thread.__init__(self)
     self.queue = queue
     self.results = []
+    self.progress_func = progress_func
+    self.tests_total = tests_total
 
   def run(self):
     while True:
@@ -1243,6 +1245,11 @@ class TestSpawningThread(threading.Threa
 
       self.run_one(next_index)
 
+      # signal progress
+      if self.progress_func:
+        self.progress_func(self.tests_total - self.queue.qsize(),
+                           self.tests_total)
+
   def run_one(self, index):
     command = os.path.abspath(sys.argv[0])
 
@@ -1499,7 +1506,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(number_queue, progress_func,
+                                   len(testnums)) for i in range(parallel) ]
     for t in threads:
       t.start()
 
@@ -1512,10 +1520,6 @@ def _internal_run_tests(test_list, testn
       results += t.results
     results.sort()
 
-    # signal some kind of progress
-    if progress_func:
-      progress_func(len(testnums), len(testnums))
-
     # terminate the line of dots
     print("")
 


Reply via email to